Update AB test runners

Use variable to connect in clientRunner
Use new(ish) `host.docker.internal` address provided by Docker to connect to host machine
Run client tests port 9002 so suites can be run concurrently
This commit is contained in:
Chris Boden 2021-12-05 11:58:52 -05:00
parent fb8cf474be
commit d5c0684ab4
8 changed files with 15 additions and 27 deletions

View File

@ -30,7 +30,7 @@
"guzzlehttp/psr7": "^1.0"
},
"require-dev": {
"phpunit/phpunit": "5.7.*",
"phpunit/phpunit": "^5.7",
"react/socket": "^1.3"
},
"scripts": {

View File

@ -15,7 +15,7 @@ require __DIR__ . '/../bootstrap.php';
define('AGENT', 'RatchetRFC/0.3');
$testServer = "127.0.0.1";
$testServer = "host.docker.internal";
$loop = React\EventLoop\Factory::create();
@ -55,9 +55,9 @@ function getTestCases() {
$deferred = new Deferred();
$connector->connect($testServer . ':9001')->then(function (ConnectionInterface $connection) use ($deferred) {
$connector->connect($testServer . ':9002')->then(function (ConnectionInterface $connection) use ($deferred, $testServer) {
$cn = new ClientNegotiator();
$cnRequest = $cn->generateRequest(new Uri('ws://127.0.0.1:9001/getCaseCount'));
$cnRequest = $cn->generateRequest(new Uri('ws://' . $testServer . ':9002/getCaseCount'));
$rawResponse = "";
$response = null;
@ -120,10 +120,10 @@ function runTest($case)
$deferred = new Deferred();
$connector->connect($testServer . ':9001')->then(function (ConnectionInterface $connection) use ($deferred, $casePath, $case) {
$connector->connect($testServer . ':9002')->then(function (ConnectionInterface $connection) use ($deferred, $casePath, $case, $testServer) {
$cn = new ClientNegotiator(
PermessageDeflateOptions::permessageDeflateSupported() ? PermessageDeflateOptions::createEnabled() : null);
$cnRequest = $cn->generateRequest(new Uri('ws://127.0.0.1:9001' . $casePath));
$cnRequest = $cn->generateRequest(new Uri('ws://' . $testServer . ':9002' . $casePath));
$rawResponse = "";
$response = null;
@ -179,12 +179,12 @@ function createReport() {
$deferred = new Deferred();
$connector->connect($testServer . ':9001')->then(function (ConnectionInterface $connection) use ($deferred) {
$connector->connect($testServer . ':9002')->then(function (ConnectionInterface $connection) use ($deferred, $testServer) {
// $reportPath = "/updateReports?agent=" . AGENT . "&shutdownOnComplete=true";
// we will stop it using docker now instead of just shutting down
$reportPath = "/updateReports?agent=" . AGENT;
$cn = new ClientNegotiator();
$cnRequest = $cn->generateRequest(new Uri('ws://127.0.0.1:9001' . $reportPath));
$cnRequest = $cn->generateRequest(new Uri('ws://' . $testServer . ':9002' . $reportPath));
$rawResponse = "";
$response = null;

View File

@ -1,12 +0,0 @@
#!/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

View File

@ -5,7 +5,7 @@
, "outdir": "/reports/servers"
, "servers": [{
"agent": "RatchetRFC/0.3"
, "url": "ws://host.ratchet.internal:9001"
, "url": "ws://host.docker.internal:9001"
, "options": {"version": 18}
}]
, "cases": [

View File

@ -5,7 +5,7 @@
, "outdir": "/reports/servers"
, "servers": [{
"agent": "RatchetRFC/0.3"
, "url": "ws://host.ratchet.internal:9001"
, "url": "ws://host.docker.internal:9001"
, "options": {"version": 18}
}]
, "cases": ["*"]

View File

@ -1,5 +1,5 @@
{
"url": "ws://127.0.0.1:9001"
"url": "ws://127.0.0.1:9002"
, "options": {
"failByDrop": false
}

View File

@ -1,5 +1,5 @@
{
"url": "ws://127.0.0.1:9001"
"url": "ws://127.0.0.1:9002"
, "options": {
"failByDrop": false
}

View File

@ -14,13 +14,13 @@ if [ "$ABTEST" = "client" ]; then
-d \
-v ${PWD}:/config \
-v ${PWD}/reports:/reports \
-p 9001:9001 \
-p 9002:9002 \
--name fuzzingserver \
crossbario/autobahn-testsuite wstest -m fuzzingserver -s /config/fuzzingserver$SKIP_DEFLATE.json
sleep 5
if [ "$TRAVIS" != "true" ]; then
echo "Running tests vs Autobahn test client"
###docker run -it --rm --name abpytest crossbario/autobahn-testsuite wstest --mode testeeclient -w ws://host.docker.internal:9001
###docker run -it --rm --name abpytest crossbario/autobahn-testsuite wstest --mode testeeclient -w ws://host.docker.internal:9002
fi
php -d memory_limit=256M clientRunner.php
@ -48,7 +48,7 @@ if [ "$ABTEST" = "server" ]; then
-v ${PWD}:/config \
-v ${PWD}/reports:/reports \
--name fuzzingclient \
crossbario/autobahn-testsuite /bin/sh -c "sh /config/docker_bootstrap.sh $IPADDR; wstest -m fuzzingclient -s /config/fuzzingclient$SKIP_DEFLATE.json"
crossbario/autobahn-testsuite /bin/sh -c "wstest -m fuzzingclient -s /config/fuzzingclient$SKIP_DEFLATE.json"
sleep 1
# send the shutdown command to the PHP echo server