Automate autobhan test suite.

This commit is contained in:
Arijit Das 2021-04-15 13:14:41 +05:30 committed by jangko
parent f8cfcd1f99
commit ffeaaa9d68
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
4 changed files with 88 additions and 0 deletions

View File

@ -200,3 +200,28 @@ jobs:
cd nim-ws
nimble install -y --depsOnly
nimble test
- name: Setup Python version
if: runner.os == 'macos' && matrix.target.cpu == 'amd64'
uses: actions/setup-python@v2
with:
python-version: 2.7.17
- name: Setup and run Autobahn test suite.
if: runner.os == 'macos' && matrix.target.cpu == 'amd64'
run: |
pip install virtualenv
virtualenv --python=/usr/bin/python2 autobahn
source autobahn/bin/activate
pip install autobahntestsuite
cd nim-ws
./scripts/start_server.sh
cd autobahn
wstest --mode fuzzingclient --spec fuzzingclient.json
- name: Deploy autobahn report.
if: runner.os == 'macos' && matrix.target.cpu == 'amd64'
uses: peaceiris/actions-gh-pages@v3
with:
personal_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./nim-ws/autobahn/reports/servers

25
autobahn/Readme.md Normal file
View File

@ -0,0 +1,25 @@
## Running autobahn test suite.
### Start the websocket server
```bash
nim c -r examples/server.nim
```
### Install autobahn
```bash
# Set up virtualenv in autobahn folder
virtualenv --python=/usr/bin/python2 autobahn
# Activate the virtualenv
source autobahn/bin/activate
# Install autobahn
pip install autobahntestsuite
```
### Run the test Websocket client.
```bash
wstest --mode fuzzingclient --spec fuzzingclient.json
```
Reports will be generated in `reports/server` which can be configured in `fuzzingclient.json`

View File

@ -0,0 +1,11 @@
{
"outdir": "./reports/servers",
"servers": [
{
"url": "ws://127.0.0.1:8888/ws"
}
],
"cases": ["*"],
"exclude-cases": ["6.*", "9.*", "12.*", "13.*"],
"exclude-agent-cases": {}
}

27
scripts/start_server.sh Normal file
View File

@ -0,0 +1,27 @@
#!/bin/bash
nim c -r examples/server.nim &
max_iterations=10
wait_seconds=6
http_endpoint="http://127.0.0.1:8888/"
iterations=0
while true
do
((iterations++))
echo "Attempt $iterations"
sleep $wait_seconds
http_code=$(curl --verbose -s -o /tmp/result.txt -w '%{http_code}' "$http_endpoint";)
if [ "$http_code" -eq 200 ]; then
echo "Server Up"
break
fi
if [ "$iterations" -ge "$max_iterations" ]; then
echo "Loop Timeout"
exit 1
fi
done