Skip to content

Commit

Permalink
Merge pull request phusion#487 from unilynx/support-maketest-on-osx
Browse files Browse the repository at this point in the history
Allow 'make test' to work on macOS by publishing the SSH port
  • Loading branch information
Theaxiom authored Jul 18, 2018
2 parents 92a357a + 2f0e1ad commit ed15d0d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ function cleanup()
PWD=`pwd`

echo " --> Starting insecure container"
ID=`docker run -d -v $PWD/test:/test $NAME:$VERSION /sbin/my_init --enable-insecure-key`
ID=`docker run -d -p 22 -v $PWD/test:/test $NAME:$VERSION /sbin/my_init --enable-insecure-key`
sleep 1

echo " --> Obtaining IP"
IP=`docker inspect -f "{{ .NetworkSettings.IPAddress }}" "$ID"`
if [[ "$IP" = "" ]]; then
abort "Unable to obtain container IP"
echo " --> Obtaining SSH port number"
SSHPORT=`docker inspect --format='{{(index (index .NetworkSettings.Ports "22/tcp") 0).HostPort}}' "$ID"`
if [[ "$SSHPORT" = "" ]]; then
abort "Unable to obtain container SSH port number"
fi

trap cleanup EXIT
Expand All @@ -38,5 +38,5 @@ echo " --> Logging into container and running tests"
cp image/services/sshd/keys/insecure_key /tmp/insecure_key
chmod 600 /tmp/insecure_key
sleep 1 # Give container some more time to start up.
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i /tmp/insecure_key root@$IP \
ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i /tmp/insecure_key -p $SSHPORT root@127.0.0.1 \
/bin/bash /test/test.sh

0 comments on commit ed15d0d

Please sign in to comment.