From 1c6e6ed0870f06c01175102438a73a67af75b831 Mon Sep 17 00:00:00 2001 From: Chris Boden Date: Sun, 5 Dec 2021 17:04:01 -0500 Subject: [PATCH] Rever use of host.docker.internal It's only supported on macOS --- tests/ab/clientRunner.php | 2 +- tests/ab/docker_bootstrap.sh | 12 ++++++++++++ tests/ab/fuzzingclient.json | 2 +- tests/ab/fuzzingclient_skip_deflate.json | 2 +- tests/ab/run_ab_tests.sh | 2 +- 5 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 tests/ab/docker_bootstrap.sh diff --git a/tests/ab/clientRunner.php b/tests/ab/clientRunner.php index cfc534f..f38a075 100644 --- a/tests/ab/clientRunner.php +++ b/tests/ab/clientRunner.php @@ -15,7 +15,7 @@ require __DIR__ . '/../bootstrap.php'; define('AGENT', 'RatchetRFC/0.3'); -$testServer = "host.docker.internal"; +$testServer = $argc > 1 ? $argv[1] : "127.0.0.1"; $loop = React\EventLoop\Factory::create(); diff --git a/tests/ab/docker_bootstrap.sh b/tests/ab/docker_bootstrap.sh new file mode 100644 index 0000000..44d4581 --- /dev/null +++ b/tests/ab/docker_bootstrap.sh @@ -0,0 +1,12 @@ +#!/bin/bash +set -x + +echo "Running $0" + +echo Adding "$1 host.ratchet.internal" to /etc/hosts file + +echo $1 host.ratchet.internal >> /etc/hosts + +echo /etc/hosts contains: +cat /etc/hosts +echo diff --git a/tests/ab/fuzzingclient.json b/tests/ab/fuzzingclient.json index b8d34d0..d410be3 100644 --- a/tests/ab/fuzzingclient.json +++ b/tests/ab/fuzzingclient.json @@ -5,7 +5,7 @@ , "outdir": "/reports/servers" , "servers": [{ "agent": "RatchetRFC/0.3" - , "url": "ws://host.docker.internal:9001" + , "url": "ws://host.ratchet.internal:9001" , "options": {"version": 18} }] , "cases": [ diff --git a/tests/ab/fuzzingclient_skip_deflate.json b/tests/ab/fuzzingclient_skip_deflate.json index 5031b34..b1fddbe 100644 --- a/tests/ab/fuzzingclient_skip_deflate.json +++ b/tests/ab/fuzzingclient_skip_deflate.json @@ -5,7 +5,7 @@ , "outdir": "/reports/servers" , "servers": [{ "agent": "RatchetRFC/0.3" - , "url": "ws://host.docker.internal:9001" + , "url": "ws://host.ratchet.internal:9001" , "options": {"version": 18} }] , "cases": ["*"] diff --git a/tests/ab/run_ab_tests.sh b/tests/ab/run_ab_tests.sh index 65ae3a4..1d8d0c1 100644 --- a/tests/ab/run_ab_tests.sh +++ b/tests/ab/run_ab_tests.sh @@ -48,7 +48,7 @@ if [ "$ABTEST" = "server" ]; then -v ${PWD}:/config \ -v ${PWD}/reports:/reports \ --name fuzzingclient \ - crossbario/autobahn-testsuite /bin/sh -c "wstest -m fuzzingclient -s /config/fuzzingclient$SKIP_DEFLATE.json" + crossbario/autobahn-testsuite /bin/sh -c "sh /config/docker_bootstrap.sh $IPADDR; wstest -m fuzzingclient -s /config/fuzzingclient$SKIP_DEFLATE.json" sleep 1 # send the shutdown command to the PHP echo server