Skip to content

Commit

Permalink
Update the Autobahn test suite to v0.8.2 (#5679)
Browse files Browse the repository at this point in the history
Co-authored-by: Dmitry Erlikh <derlih@gmail.com>
Co-authored-by: Sviatoslav Sydorenko <wk.cvs.github@sydorenko.org.ua>
  • Loading branch information
3 people authored Jun 18, 2021
1 parent ca2a1fd commit fd2ea56
Show file tree
Hide file tree
Showing 13 changed files with 94 additions and 21 deletions.
1 change: 1 addition & 0 deletions CHANGES/4247.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updated the Autobahn test suite to v0.8.2.
1 change: 1 addition & 0 deletions CONTRIBUTORS.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Andrew Lytvyn
Andrew Svetlov
Andrew Zhou
Andrii Soldatenko
Anes Abismail
Antoine Pietri
Anton Kasyanov
Anton Zhdan-Pushkin
Expand Down
1 change: 1 addition & 0 deletions tests/autobahn/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/reports
17 changes: 17 additions & 0 deletions tests/autobahn/Dockerfile.aiohttp
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
FROM python:3.9.5

COPY ./ /src

WORKDIR /src

RUN pip install .
# NOTE: The attrs lib is necessary because it's
# NOTE: still a de-facto runtime dependency of
# NOTE: aiohttp. Although it shouldn't be anymore
# NOTE: after the effort to get rid of it.
# NOTE: It must be removed once made redundant.
# Refs:
# * https://github.com/aio-libs/aiohttp/issues/5806
# * https://github.com/aio-libs/aiohttp/pull/5679/files#r654428147
# * https://github.com/aio-libs/aiohttp/pull/5284
RUN pip install attrs
14 changes: 4 additions & 10 deletions tests/autobahn/client.py → tests/autobahn/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import aiohttp


async def client(loop, url, name):
async def client(url, name):
async with aiohttp.ClientSession() as session:
async with session.ws_connect(url + "/getCaseCount") as ws:
num_tests = int((await ws.receive()).data)
Expand All @@ -28,20 +28,14 @@ async def client(loop, url, name):
print("finally requesting %s" % url)


async def run(loop, url, name):
async def run(url, name):
try:
await client(loop, url, name)
await client(url, name)
except Exception:
import traceback

traceback.print_exc()


if __name__ == "__main__":
loop = asyncio.get_event_loop()
try:
loop.run_until_complete(run(loop, "http://localhost:9001", "aiohttp"))
except KeyboardInterrupt:
pass
finally:
loop.close()
asyncio.run(run("http://autobahn:9001", "aiohttp"))
17 changes: 17 additions & 0 deletions tests/autobahn/client/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
version: "3.9"
services:
autobahn:
image: crossbario/autobahn-testsuite:0.8.2
volumes:
- type: bind
source: ./fuzzingserver.json
target: /config/fuzzingserver.json
- type: bind
source: ../reports
target: /reports

aiohttp:
image: aiohttp-autobahn_aiohttp
depends_on:
- autobahn
command: ["python", "tests/autobahn/client/client.py"]
File renamed without changes.
6 changes: 6 additions & 0 deletions tests/autobahn/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
version: "3.9"
services:
aiohttp:
build:
context: ../..
dockerfile: tests/autobahn/Dockerfile.aiohttp
10 changes: 0 additions & 10 deletions tests/autobahn/fuzzingclient.json

This file was deleted.

12 changes: 12 additions & 0 deletions tests/autobahn/run-tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

rm -rf $PWD/reports
mkdir $PWD/reports

docker-compose -p aiohttp-autobahn build

docker-compose -f $PWD/client/docker-compose.yml up --abort-on-container-exit
docker-compose -f $PWD/client/docker-compose.yml down

docker-compose -f $PWD/server/docker-compose.yml up --abort-on-container-exit
docker-compose -f $PWD/server/docker-compose.yml down
18 changes: 18 additions & 0 deletions tests/autobahn/server/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: "3.9"
services:
autobahn:
image: crossbario/autobahn-testsuite:0.8.2
depends_on:
- aiohttp
volumes:
- type: bind
source: ./fuzzingclient.json
target: /config/fuzzingclient.json
- type: bind
source: ../reports
target: /reports
command: ["wstest", "--mode", "fuzzingclient", "--spec", "/config/fuzzingclient.json"]

aiohttp:
image: aiohttp-autobahn_aiohttp
command: ["python", "tests/autobahn/server/server.py"]
16 changes: 16 additions & 0 deletions tests/autobahn/server/fuzzingclient.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"options": { "failByDrop": false },
"outdir": "./reports/servers",

"servers": [
{
"agent": "AutobahnServer",
"url": "ws://aiohttp:9001",
"options": { "version": 18 }
}
],

"cases": ["*"],
"exclude-cases": ["12.*", "13.*"],
"exclude-agent-cases": {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,6 @@ async def on_shutdown(app):
app.router.add_route("GET", "/", wshandler)
app.on_shutdown.append(on_shutdown)
try:
web.run_app(app, host="127.0.0.1", port=9001)
web.run_app(app, port=9001)
except KeyboardInterrupt:
print("Server stopped at http://127.0.0.1:9001")

0 comments on commit fd2ea56

Please sign in to comment.