autobahn: add test for tlsserver (#42)
also publish the result to github pages like ws server
This commit is contained in:
parent
90c664545d
commit
723971a39d
|
@ -202,27 +202,44 @@ jobs:
|
|||
nimble test
|
||||
|
||||
- name: Setup Python version
|
||||
if: runner.os == 'macos' && matrix.target.cpu == 'amd64'
|
||||
if: runner.os == 'linux' && matrix.target.cpu == 'amd64' && github.event_name == 'push'
|
||||
uses: actions/setup-python@v2
|
||||
with:
|
||||
python-version: pypy-2.7
|
||||
|
||||
- name: Setup and run Autobahn test suite.
|
||||
if: runner.os == 'macos' && matrix.target.cpu == 'amd64'
|
||||
# we switch to linux because
|
||||
# kill $(pidof server) not working on macos
|
||||
if: runner.os == 'linux' && matrix.target.cpu == 'amd64' && github.event_name == 'push'
|
||||
run: |
|
||||
sudo apt-get install -y python-dev
|
||||
pip install virtualenv
|
||||
pip install markdown2
|
||||
virtualenv --python=/usr/bin/python2 autobahn
|
||||
source autobahn/bin/activate
|
||||
pip install autobahntestsuite
|
||||
cd nim-ws
|
||||
mkdir autobahn/reports
|
||||
sed -i "s/COMMIT_SHA_SHORT/${GITHUB_SHA::7}/g" autobahn/index.md
|
||||
sed -i "s/COMMIT_SHA/$GITHUB_SHA/g" autobahn/index.md
|
||||
markdown2 autobahn/index.md > autobahn/reports/index.html
|
||||
|
||||
chmod +x ./scripts/start_server.sh
|
||||
./scripts/start_server.sh
|
||||
cd autobahn
|
||||
wstest --mode fuzzingclient --spec fuzzingclient.json
|
||||
kill $(pidof server)
|
||||
|
||||
cd ..
|
||||
chmod +x ./scripts/start_server_tls.sh
|
||||
./scripts/start_server_tls.sh
|
||||
cd autobahn
|
||||
wstest --mode fuzzingclient --spec fuzzingclient_tls.json
|
||||
kill $(pidof tlsserver)
|
||||
|
||||
- name: Deploy autobahn report.
|
||||
if: runner.os == 'macos' && matrix.target.cpu == 'amd64'
|
||||
if: runner.os == 'linux' && matrix.target.cpu == 'amd64' && github.event_name == 'push'
|
||||
uses: peaceiris/actions-gh-pages@v3
|
||||
with:
|
||||
personal_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
publish_dir: ./nim-ws/autobahn/reports/servers
|
||||
publish_dir: ./nim-ws/autobahn/reports
|
||||
|
|
|
@ -1,25 +1,22 @@
|
|||
## 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
|
||||
```bash
|
||||
# Set up virtualenv in autobahn folder
|
||||
virtualenv --python=/usr/bin/python2 autobahn
|
||||
|
||||
# Activate the virtualenv
|
||||
source autobahn/bin/activate
|
||||
# Activate the virtualenv
|
||||
source autobahn/bin/activate
|
||||
|
||||
# Install autobahn
|
||||
pip install autobahntestsuite
|
||||
```
|
||||
# Install autobahn
|
||||
pip install autobahntestsuite
|
||||
```
|
||||
|
||||
### Run the test Websocket client.
|
||||
```bash
|
||||
wstest --mode fuzzingclient --spec fuzzingclient.json
|
||||
```
|
||||
### Run the test Websocket client.
|
||||
* ws server: `nim c -r examples/server.nim`
|
||||
* autobahn: `wstest --mode fuzzingclient --spec fuzzingclient.json`
|
||||
* Reports will be generated in `reports/server` which can be configured in `fuzzingclient.json`
|
||||
|
||||
Reports will be generated in `reports/server` which can be configured in `fuzzingclient.json`
|
||||
* wss server: `nim c -r examples/tlsserver.nim`
|
||||
* autobahn: `wstest --mode fuzzingclient --spec fuzzingclient_tls.json`
|
||||
* Reports will be generated in `reports/server_tls` which can be configured in `fuzzingclient_tls.json`
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
{
|
||||
"outdir": "./reports/servers",
|
||||
"outdir": "./reports/server",
|
||||
"servers": [
|
||||
{
|
||||
"agent": "nim-ws example server",
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"outdir": "./reports/server_tls",
|
||||
|
||||
"servers": [{
|
||||
"agent": "nim-ws tls server",
|
||||
"url": "wss://127.0.0.1:8888/wss"
|
||||
}],
|
||||
|
||||
"cases": ["*"],
|
||||
"exclude-cases": [],
|
||||
"exclude-agent-cases": {}
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
# Autobahn summary report
|
||||
|
||||
Generated by commit [COMMIT_SHA_SHORT](https://github.com/status-im/nim-ws/commit/COMMIT_SHA).
|
||||
|
||||
* [ws server summary report](server/index.html)
|
||||
* [wss server summary report](server_tls/index.html)
|
|
@ -0,0 +1,27 @@
|
|||
#!/bin/bash
|
||||
|
||||
nim c -r examples/tlsserver.nim &
|
||||
|
||||
max_iterations=10
|
||||
wait_seconds=6
|
||||
http_endpoint="https://127.0.0.1:8888/"
|
||||
|
||||
iterations=0
|
||||
while true
|
||||
do
|
||||
((iterations++))
|
||||
echo "Attempt $iterations"
|
||||
sleep $wait_seconds
|
||||
|
||||
http_code=$(curl -k --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…
Reference in New Issue