Skip to content

Commit

Permalink
test/docker: Fix relying on .dockerenv file
Browse files Browse the repository at this point in the history
Newer versions of Docker don't seem to have it, nor do we want to rely
on the implementation details of a specific container runtime anyway.
  • Loading branch information
CyberShadow committed Oct 28, 2023
1 parent 66c8c15 commit 5949071
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
1 change: 1 addition & 0 deletions test/docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ RUN pacman -Sy
RUN pacman --noconfirm -S rubygems ruby-rdoc pacutils expect aur
RUN sudo -u aconfmgr gem install bashcov

ENV ACONFMGR_IN_CONTAINER=1
RUN /opt/aur/setup.sh

RUN useradd billy
2 changes: 1 addition & 1 deletion test/docker/aur/setup.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
set -eEuo pipefail

if [[ ! -f /.dockerenv ]]
if [[ ! -v ACONFMGR_IN_CONTAINER ]]
then
echo 'Refusing to run setup outside Docker.'
exit 1
Expand Down
2 changes: 1 addition & 1 deletion test/docker/aur/start.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash
set -eEuo pipefail

if [[ ! -f /.dockerenv ]]
if [[ ! -v ACONFMGR_IN_CONTAINER ]]
then
echo 'Refusing to start outside Docker.'
exit 1
Expand Down
7 changes: 6 additions & 1 deletion test/t/lib-funcs-integ.bash
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,13 @@ function TestInitAUR() {

LogEnter 'Initializing AUR support...\n'

if [[ ! -v ACONFMGR_IN_CONTAINER ]]
then
FatalError 'Refusing to start outside Docker.\n'
fi

LogEnter 'Starting AUR...\n'
command sudo /opt/aur/start.sh
command sudo env ACONFMGR_IN_CONTAINER=1 /opt/aur/start.sh
LogLeave

LogEnter 'Generating a SSH key...\n'
Expand Down

0 comments on commit 5949071

Please sign in to comment.