Skip to content

Commit

Permalink
tests: use autobahn test suite as docker image
Browse files Browse the repository at this point in the history
According to the documentation from the Autobahn Suite GitHub page, it
seems like they do not support Python 3 which is currently the default
Python version used with our GitHub Actions.

The simplest way to workaround it properly seems to be using the Docker
image that the maintainers of the project suggest to use for running the
suite. This is more future-proof way that we should rely upon.

This commit also removes some redundant steps that are not required.
  • Loading branch information
daniel-abramov committed Apr 22, 2021
1 parent 287f477 commit 639b106
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 21 deletions.
12 changes: 2 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,16 +79,8 @@ jobs:
with:
rust-version: ${{ matrix.rust }}

- name: Install dependencies
run: |
sudo apt-get install libssl-dev python-unittest2
sudo pip install urllib3[secure] autobahntestsuite
- name: Build Autobahn TestSuite for client
run: cargo build --release --example autobahn-client

- name: Build Autobahn TestSuite for server
run: cargo build --release --example autobahn-server
- name: Install and configure docker
uses: docker-practice/actions-setup-docker@v1

- name: Running Autobahn TestSuite for client
run: ./scripts/autobahn-client.sh
Expand Down
5 changes: 2 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ language: rust
rust:
- stable

install:
- sudo apt-get install python-unittest2
- sudo pip install ghp-import urllib3[secure] autobahntestsuite
services:
- docker

before_script:
- export PATH="$PATH:$HOME/.cargo/bin"
Expand Down
13 changes: 9 additions & 4 deletions scripts/autobahn-client.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ SOURCE_DIR=$(readlink -f "${BASH_SOURCE[0]}")
SOURCE_DIR=$(dirname "$SOURCE_DIR")
cd "${SOURCE_DIR}/.."

CONTAINER_NAME=fuzzingserver
function cleanup() {
kill -9 ${FUZZINGSERVER_PID}
docker container stop "${CONTAINER_NAME}"
}
trap cleanup TERM EXIT

Expand All @@ -23,10 +24,14 @@ function test_diff() {
fi
}

cargo build --release --example autobahn-client
docker run -d --rm \
-v "${PWD}/autobahn:/autobahn" \
-p 9001:9001 \
--init \
--name "${CONTAINER_NAME}" \
crossbario/autobahn-testsuite \
wstest -m fuzzingserver -s 'autobahn/fuzzingserver.json'

wstest -m fuzzingserver -s 'autobahn/fuzzingserver.json' & FUZZINGSERVER_PID=$!
sleep 3
echo "Server PID: ${FUZZINGSERVER_PID}"
cargo run --release --example autobahn-client
test_diff
11 changes: 7 additions & 4 deletions scripts/autobahn-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ set -x
SOURCE_DIR=$(readlink -f "${BASH_SOURCE[0]}")
SOURCE_DIR=$(dirname "$SOURCE_DIR")
cd "${SOURCE_DIR}/.."
WSSERVER_PID=

function cleanup() {
kill -9 ${WSSERVER_PID}
Expand All @@ -23,9 +22,13 @@ function test_diff() {
fi
}

cargo build --release --example autobahn-server
cargo run --release --example autobahn-server & WSSERVER_PID=$!
echo "Server PID: ${WSSERVER_PID}"
sleep 3
wstest -m fuzzingclient -s 'autobahn/fuzzingclient.json'

docker run --rm \
-v "${PWD}/autobahn:/autobahn" \
--network host \
crossbario/autobahn-testsuite \
wstest -m fuzzingclient -s 'autobahn/fuzzingclient.json'

test_diff

0 comments on commit 639b106

Please sign in to comment.