Skip to content

Commit

Permalink
.github/workflows: integrate Jafar QA checks
Browse files Browse the repository at this point in the history
Part of #356
  • Loading branch information
bassosimone committed Jul 23, 2020
1 parent 9482173 commit 4c8d1d2
Show file tree
Hide file tree
Showing 6 changed files with 402 additions and 0 deletions.
17 changes: 17 additions & 0 deletions .github/workflows/qa.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: qa
on: [push]
jobs:
test:
runs-on: "${{ matrix.os }}"
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
go: ["1.14"]
experiment: ["telegram"]
steps:
- uses: actions/setup-go@v1
with:
go-version: ${{ matrix.go }}
- uses: actions/checkout@v2
- run: ./QA/docker/start.bash ./QA/docker/${{ matrix.experiment }}.sh
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/.vscode
/asn.mmdb
/badproxy.pem
/ca-bundle.pem
/country.mmdb
/jafar
Expand All @@ -8,3 +9,4 @@
/miniooni.exe
/oonipsiphon/
/report.jsonl
/telegram.jsonl
53 changes: 53 additions & 0 deletions QA/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# Quality Assurance scripts

This directory contains quality assurance scripts that use Jafar to
ensure that OONI implementations behave. These scripts take as unique
command line argument the path to a binary with a OONI Probe v2.x
compatible command line interface.

Tools with this CLI are:

1. `github.com/ooni/probe-legacy`
2. `github.com/measurement-kit/measurement-kit/src/measurement_kit`
3. `github.com/ooni/probe-engine/cmd/miniooni`

## Run QA on a Linux system

These scripts assume you're on a Linux system with `iptables`, `bash`,
`python3`, and possibly a bunch of other tools installed.

To start the QA script, run this command:

```bash
sudo ./QA/$nettest/$nettest.py $ooni_exe
```

where `$nettest` is the nettest name (e.g. `telegram`) and `$ooni_exe`
is the OONI Probe v2.x compatible binary to test.

The Python script needs to run as root. Note however that sudo will also
be used to run `$ooni_exe` with the privileges of the `$SUDO_USER` that
called `sudo ./QA/$nettest/$nettest.py ...`.

## Run QA using a docker container

Run test in a suitable Docker container using:

```
./QA/docker/start.sh ./QA/docker/$nettest.sh
```

Note that this will run a `--privileged` docker container.
This will eventually run the Python script you would run on Linux.

For now, the docker scripts only perform QA of `miniooni`.

## Diagnosing issues

The Python script that performs the QA runs a specific OONI test under
different failure conditions and stops at the first unexpected value found
in the resulting JSONL report. You can infer what went wrong by reading
the output of the `$ooni_exe` command itself, which should be above the point
where the Python script stopped, as well as by inspecting the JSONL file on
disk. By convention such file is named `$nettest.jsonl` and only contains
the result of the last run of `$nettest`.
5 changes: 5 additions & 0 deletions QA/docker/start.bash
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
set -ex
DOCKER=${DOCKER:-docker}
$DOCKER build -t jafar-qa ./cmd/jafar/
$DOCKER run --privileged -v`pwd`:/jafar -w/jafar jafar-qa "$@"
5 changes: 5 additions & 0 deletions QA/docker/telegram.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/sh
set -ex
go build -v ./cmd/miniooni
go build -v ./cmd/jafar
sudo ./QA/telegram/telegram.py ./miniooni

0 comments on commit 4c8d1d2

Please sign in to comment.