mirror of
https://github.com/codex-storage/nim-websock.git
synced 2025-02-28 09:40:42 +00:00
Automate autobhan test suite.
This commit is contained in:
parent
f8cfcd1f99
commit
ffeaaa9d68
25
.github/workflows/ci.yml
vendored
25
.github/workflows/ci.yml
vendored
@ -200,3 +200,28 @@ jobs:
|
|||||||
cd nim-ws
|
cd nim-ws
|
||||||
nimble install -y --depsOnly
|
nimble install -y --depsOnly
|
||||||
nimble test
|
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
25
autobahn/Readme.md
Normal 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`
|
11
autobahn/fuzzingclient.json
Normal file
11
autobahn/fuzzingclient.json
Normal 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
27
scripts/start_server.sh
Normal 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
|
Loading…
x
Reference in New Issue
Block a user