From cdb37b17a4114371fc0191265bdd56ea9d631260 Mon Sep 17 00:00:00 2001 From: Matt Bonneau Date: Sat, 11 Apr 2020 19:31:44 -0400 Subject: [PATCH] Separate travis server and client tests --- .travis.yml | 4 + tests/AbResultsTest.php | 6 +- tests/ab/run_ab_tests.sh | 74 ++++++++++--------- .../PermessageDeflateOptionsTest.php | 3 +- tests/unit/Handshake/RequestVerifierTest.php | 7 +- tests/unit/Handshake/ResponseVerifierTest.php | 7 +- tests/unit/Handshake/ServerNegotiatorTest.php | 3 +- tests/unit/Messaging/FrameTest.php | 5 +- tests/unit/Messaging/MessageBufferTest.php | 3 +- tests/unit/Messaging/MessageTest.php | 5 +- 10 files changed, 70 insertions(+), 47 deletions(-) diff --git a/.travis.yml b/.travis.yml index a7be1be..f8f7b7c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,10 @@ php: - 7.4 - nightly +env: + - ABTEST=client + - ABTEST=server + matrix: allow_failures: - php: nightly diff --git a/tests/AbResultsTest.php b/tests/AbResultsTest.php index 9bc502d..9bd799e 100644 --- a/tests/AbResultsTest.php +++ b/tests/AbResultsTest.php @@ -1,7 +1,9 @@ markTestSkipped('Autobahn TestSuite results not found'); diff --git a/tests/ab/run_ab_tests.sh b/tests/ab/run_ab_tests.sh index 4b46c87..b924480 100644 --- a/tests/ab/run_ab_tests.sh +++ b/tests/ab/run_ab_tests.sh @@ -9,48 +9,50 @@ if [ $(phpenv version-name) = "hhvm" -o $(phpenv version-name) = "5.4" -o $(phpe fi fi -docker run --rm \ - -d \ - -v ${PWD}:/config \ - -v ${PWD}/reports:/reports \ - -p 9001:9001 \ - --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 -fi -php -d memory_limit=256M clientRunner.php +if [ "$ABTEST" = "client" ]; then + docker run --rm \ + -d \ + -v ${PWD}:/config \ + -v ${PWD}/reports:/reports \ + -p 9001:9001 \ + --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 + fi + php -d memory_limit=256M clientRunner.php -docker ps -a + docker ps -a -docker logs fuzzingserver + docker logs fuzzingserver -docker stop fuzzingserver + docker stop fuzzingserver - - -sleep 2 - -php -d memory_limit=256M startServer.php & -sleep 3 - -if [ "$OSTYPE" = "linux-gnu" ]; then - IPADDR=`hostname -I | cut -f 1 -d ' '` -else - IPADDR=`ifconfig | grep "inet " | grep -Fv 127.0.0.1 | awk '{print $2}' | head -1 | tr -d 'adr:'` + sleep 2 fi -docker run --rm \ - -it \ - -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" -sleep 1 +if [ "$ABTEST" = "server" ]; then + php -d memory_limit=256M startServer.php & + sleep 3 -# send the shutdown command to the PHP echo server -wget -O - -q http://127.0.0.1:9001/shutdown + if [ "$OSTYPE" = "linux-gnu" ]; then + IPADDR=`hostname -I | cut -f 1 -d ' '` + else + IPADDR=`ifconfig | grep "inet " | grep -Fv 127.0.0.1 | awk '{print $2}' | head -1 | tr -d 'adr:'` + fi + + docker run --rm \ + -it \ + -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" + sleep 1 + + # send the shutdown command to the PHP echo server + wget -O - -q http://127.0.0.1:9001/shutdown +fi diff --git a/tests/unit/Handshake/PermessageDeflateOptionsTest.php b/tests/unit/Handshake/PermessageDeflateOptionsTest.php index 4b5fbe1..11d3739 100644 --- a/tests/unit/Handshake/PermessageDeflateOptionsTest.php +++ b/tests/unit/Handshake/PermessageDeflateOptionsTest.php @@ -3,8 +3,9 @@ namespace Ratchet\RFC6455\Test\Unit\Handshake; use Ratchet\RFC6455\Handshake\PermessageDeflateOptions; +use PHPUnit\Framework\TestCase; -class PermessageDeflateOptionsTest extends \PHPUnit_Framework_TestCase +class PermessageDeflateOptionsTest extends TestCase { public static function versionSupportProvider() { return [ diff --git a/tests/unit/Handshake/RequestVerifierTest.php b/tests/unit/Handshake/RequestVerifierTest.php index 239de33..e6dea0e 100644 --- a/tests/unit/Handshake/RequestVerifierTest.php +++ b/tests/unit/Handshake/RequestVerifierTest.php @@ -1,17 +1,20 @@ _v = new RequestVerifier(); } diff --git a/tests/unit/Handshake/ResponseVerifierTest.php b/tests/unit/Handshake/ResponseVerifierTest.php index 312930e..b916005 100644 --- a/tests/unit/Handshake/ResponseVerifierTest.php +++ b/tests/unit/Handshake/ResponseVerifierTest.php @@ -1,17 +1,20 @@ _v = new ResponseVerifier; } diff --git a/tests/unit/Handshake/ServerNegotiatorTest.php b/tests/unit/Handshake/ServerNegotiatorTest.php index 6fa8e64..c08b9f3 100644 --- a/tests/unit/Handshake/ServerNegotiatorTest.php +++ b/tests/unit/Handshake/ServerNegotiatorTest.php @@ -4,8 +4,9 @@ namespace Ratchet\RFC6455\Test\Unit\Handshake; use Ratchet\RFC6455\Handshake\RequestVerifier; use Ratchet\RFC6455\Handshake\ServerNegotiator; +use PHPUnit\Framework\TestCase; -class ServerNegotiatorTest extends \PHPUnit_Framework_TestCase +class ServerNegotiatorTest extends TestCase { public function testNoUpgradeRequested() { $negotiator = new ServerNegotiator(new RequestVerifier()); diff --git a/tests/unit/Messaging/FrameTest.php b/tests/unit/Messaging/FrameTest.php index b73f600..54a4599 100644 --- a/tests/unit/Messaging/FrameTest.php +++ b/tests/unit/Messaging/FrameTest.php @@ -1,13 +1,16 @@