Have travis use docker for wstest while testing
This commit is contained in:
parent
1cb14114c3
commit
7ef269aca1
11
.travis.yml
11
.travis.yml
@ -1,5 +1,7 @@
|
|||||||
language: php
|
language: php
|
||||||
|
|
||||||
|
services: docker
|
||||||
|
|
||||||
php:
|
php:
|
||||||
- 5.6
|
- 5.6
|
||||||
- 7.0
|
- 7.0
|
||||||
@ -7,11 +9,14 @@ php:
|
|||||||
- 7.2
|
- 7.2
|
||||||
- 7.3
|
- 7.3
|
||||||
- 7.4
|
- 7.4
|
||||||
|
- nightly
|
||||||
|
|
||||||
|
matrix:
|
||||||
|
allow_failures:
|
||||||
|
- php: nightly
|
||||||
|
|
||||||
before_install:
|
before_install:
|
||||||
- export PATH=$HOME/.local/bin:$PATH
|
- docker pull crossbario/autobahn-testsuite
|
||||||
- pip install --user autobahntestsuite
|
|
||||||
- pip list --user autobahntestsuite
|
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- composer install
|
- composer install
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
"guzzlehttp/psr7": "^1.0"
|
"guzzlehttp/psr7": "^1.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpunit/phpunit": "4.8.*",
|
"phpunit/phpunit": "5.7.*",
|
||||||
"react/socket": "^1.3"
|
"react/socket": "^1.3"
|
||||||
},
|
},
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
@ -107,7 +107,8 @@ function getTestCases() {
|
|||||||
return $deferred->promise();
|
return $deferred->promise();
|
||||||
}
|
}
|
||||||
|
|
||||||
$cn = new \Ratchet\RFC6455\Handshake\ClientNegotiator(PermessageDeflateOptions::createEnabled());
|
$cn = new \Ratchet\RFC6455\Handshake\ClientNegotiator(
|
||||||
|
PermessageDeflateOptions::permessageDeflateSupported() ? PermessageDeflateOptions::createEnabled() : null);
|
||||||
|
|
||||||
function runTest($case)
|
function runTest($case)
|
||||||
{
|
{
|
||||||
@ -120,7 +121,8 @@ function runTest($case)
|
|||||||
$deferred = new Deferred();
|
$deferred = new Deferred();
|
||||||
|
|
||||||
$connector->connect($testServer . ':9001')->then(function (ConnectionInterface $connection) use ($deferred, $casePath, $case) {
|
$connector->connect($testServer . ':9001')->then(function (ConnectionInterface $connection) use ($deferred, $casePath, $case) {
|
||||||
$cn = new ClientNegotiator(PermessageDeflateOptions::createEnabled());
|
$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://127.0.0.1:9001' . $casePath));
|
||||||
|
|
||||||
$rawResponse = "";
|
$rawResponse = "";
|
||||||
@ -178,7 +180,9 @@ function createReport() {
|
|||||||
$deferred = new Deferred();
|
$deferred = new Deferred();
|
||||||
|
|
||||||
$connector->connect($testServer . ':9001')->then(function (ConnectionInterface $connection) use ($deferred) {
|
$connector->connect($testServer . ':9001')->then(function (ConnectionInterface $connection) use ($deferred) {
|
||||||
$reportPath = "/updateReports?agent=" . AGENT . "&shutdownOnComplete=true";
|
// $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();
|
$cn = new ClientNegotiator();
|
||||||
$cnRequest = $cn->generateRequest(new Uri('ws://127.0.0.1:9001' . $reportPath));
|
$cnRequest = $cn->generateRequest(new Uri('ws://127.0.0.1:9001' . $reportPath));
|
||||||
|
|
||||||
@ -242,6 +246,7 @@ getTestCases()->then(function ($count) use ($loop) {
|
|||||||
$allDeferred->resolve();
|
$allDeferred->resolve();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
echo "Running test $i/$count\n";
|
||||||
runTest($i)->then($runNextCase);
|
runTest($i)->then($runNextCase);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -5,32 +5,11 @@
|
|||||||
, "outdir": "./reports/servers"
|
, "outdir": "./reports/servers"
|
||||||
, "servers": [{
|
, "servers": [{
|
||||||
"agent": "RatchetRFC/0.1.0"
|
"agent": "RatchetRFC/0.1.0"
|
||||||
, "url": "ws://localhost:9001"
|
, "url": "ws://host.docker.internal:9001"
|
||||||
, "options": {"version": 18}
|
, "options": {"version": 18}
|
||||||
}]
|
}]
|
||||||
, "cases": [
|
, "cases": [
|
||||||
"1.*",
|
"*"
|
||||||
"2.*",
|
|
||||||
"3.*",
|
|
||||||
"4.*",
|
|
||||||
"5.*",
|
|
||||||
"6.*",
|
|
||||||
"7.*",
|
|
||||||
"8.*",
|
|
||||||
"9.*",
|
|
||||||
"10.*",
|
|
||||||
"12.1.1",
|
|
||||||
"12.2.1",
|
|
||||||
"12.3.1",
|
|
||||||
"12.4.1",
|
|
||||||
"12.5.1",
|
|
||||||
"13.1.1",
|
|
||||||
"13.2.1",
|
|
||||||
"13.3.1",
|
|
||||||
"13.4.1",
|
|
||||||
"13.5.1",
|
|
||||||
"13.6.1",
|
|
||||||
"13.7.1"
|
|
||||||
]
|
]
|
||||||
, "exclude-cases": []
|
, "exclude-cases": []
|
||||||
, "exclude-agent-cases": {}
|
, "exclude-agent-cases": {}
|
||||||
|
@ -5,28 +5,7 @@
|
|||||||
}
|
}
|
||||||
, "outdir": "./reports/clients"
|
, "outdir": "./reports/clients"
|
||||||
, "cases": [
|
, "cases": [
|
||||||
"1.*",
|
"*"
|
||||||
"2.*",
|
|
||||||
"3.*",
|
|
||||||
"4.*",
|
|
||||||
"5.*",
|
|
||||||
"6.*",
|
|
||||||
"7.*",
|
|
||||||
"8.*",
|
|
||||||
"9.*",
|
|
||||||
"10.*",
|
|
||||||
"12.1.1",
|
|
||||||
"12.2.1",
|
|
||||||
"12.3.1",
|
|
||||||
"12.4.1",
|
|
||||||
"12.5.1",
|
|
||||||
"13.1.1",
|
|
||||||
"13.2.1",
|
|
||||||
"13.3.1",
|
|
||||||
"13.4.1",
|
|
||||||
"13.5.1",
|
|
||||||
"13.6.1",
|
|
||||||
"13.7.1"
|
|
||||||
]
|
]
|
||||||
, "exclude-cases": []
|
, "exclude-cases": []
|
||||||
, "exclude-agent-cases": {}
|
, "exclude-agent-cases": {}
|
||||||
|
@ -9,16 +9,43 @@ if [ $(phpenv version-name) = "hhvm" -o $(phpenv version-name) = "5.4" -o $(phpe
|
|||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
wstest -m fuzzingserver -s fuzzingserver$SKIP_DEFLATE.json &
|
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
|
sleep 5
|
||||||
php clientRunner.php
|
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 logs fuzzingserver
|
||||||
|
|
||||||
|
docker stop fuzzingserver
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
sleep 2
|
sleep 2
|
||||||
|
|
||||||
php startServer.php &
|
php -d memory_limit=256M startServer.php &
|
||||||
sleep 3
|
sleep 3
|
||||||
|
|
||||||
wstest -m fuzzingclient -s fuzzingclient$SKIP_DEFLATE.json
|
|
||||||
sleep 1
|
docker run --rm \
|
||||||
kill $(ps aux | grep 'php startServer.php' | awk '{print $2}' | head -n 1)
|
-it \
|
||||||
|
-v ${PWD}:/config \
|
||||||
|
-v ${PWD}/reports:/reports \
|
||||||
|
--name fuzzingclient \
|
||||||
|
crossbario/autobahn-testsuite 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
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use GuzzleHttp\Psr7\Response;
|
||||||
use Ratchet\RFC6455\Handshake\PermessageDeflateOptions;
|
use Ratchet\RFC6455\Handshake\PermessageDeflateOptions;
|
||||||
use Ratchet\RFC6455\Messaging\MessageBuffer;
|
use Ratchet\RFC6455\Messaging\MessageBuffer;
|
||||||
use Ratchet\RFC6455\Messaging\MessageInterface;
|
use Ratchet\RFC6455\Messaging\MessageInterface;
|
||||||
@ -12,16 +14,16 @@ $loop = \React\EventLoop\Factory::create();
|
|||||||
$socket = new \React\Socket\Server('127.0.0.1:9001', $loop);
|
$socket = new \React\Socket\Server('127.0.0.1:9001', $loop);
|
||||||
|
|
||||||
$closeFrameChecker = new \Ratchet\RFC6455\Messaging\CloseFrameChecker;
|
$closeFrameChecker = new \Ratchet\RFC6455\Messaging\CloseFrameChecker;
|
||||||
$negotiator = new \Ratchet\RFC6455\Handshake\ServerNegotiator(new \Ratchet\RFC6455\Handshake\RequestVerifier, true);
|
$negotiator = new \Ratchet\RFC6455\Handshake\ServerNegotiator(new \Ratchet\RFC6455\Handshake\RequestVerifier, PermessageDeflateOptions::permessageDeflateSupported());
|
||||||
|
|
||||||
$uException = new \UnderflowException;
|
$uException = new \UnderflowException;
|
||||||
|
|
||||||
|
|
||||||
$socket->on('connection', function (React\Socket\ConnectionInterface $connection) use ($negotiator, $closeFrameChecker, $uException) {
|
$socket->on('connection', function (React\Socket\ConnectionInterface $connection) use ($negotiator, $closeFrameChecker, $uException, $socket) {
|
||||||
$headerComplete = false;
|
$headerComplete = false;
|
||||||
$buffer = '';
|
$buffer = '';
|
||||||
$parser = null;
|
$parser = null;
|
||||||
$connection->on('data', function ($data) use ($connection, &$parser, &$headerComplete, &$buffer, $negotiator, $closeFrameChecker, $uException) {
|
$connection->on('data', function ($data) use ($connection, &$parser, &$headerComplete, &$buffer, $negotiator, $closeFrameChecker, $uException, $socket) {
|
||||||
if ($headerComplete) {
|
if ($headerComplete) {
|
||||||
$parser->onData($data);
|
$parser->onData($data);
|
||||||
return;
|
return;
|
||||||
@ -38,6 +40,12 @@ $socket->on('connection', function (React\Socket\ConnectionInterface $connection
|
|||||||
|
|
||||||
$negotiatorResponse = $negotiatorResponse->withAddedHeader("Content-Length", "0");
|
$negotiatorResponse = $negotiatorResponse->withAddedHeader("Content-Length", "0");
|
||||||
|
|
||||||
|
if ($negotiatorResponse->getStatusCode() !== 101 && $psrRequest->getUri()->getPath() === '/shutdown') {
|
||||||
|
$connection->end(\GuzzleHttp\Psr7\str(new Response(200, [], 'Shutting down echo server.')));
|
||||||
|
$socket->close();
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
|
||||||
$connection->write(\GuzzleHttp\Psr7\str($negotiatorResponse));
|
$connection->write(\GuzzleHttp\Psr7\str($negotiatorResponse));
|
||||||
|
|
||||||
if ($negotiatorResponse->getStatusCode() !== 101) {
|
if ($negotiatorResponse->getStatusCode() !== 101) {
|
||||||
|
Loading…
Reference in New Issue
Block a user