Commit fa99251d authored by Matt Traudt's avatar Matt Traudt Committed by Matt Traudt
Browse files

Smattering of integration test reorganization

parent 046ce48a
...@@ -27,9 +27,10 @@ and ...@@ -27,9 +27,10 @@ and
- `scripts/maint/` scripts for **maint**aining sbws and doing administrative - `scripts/maint/` scripts for **maint**aining sbws and doing administrative
things like regenerating the website or updating the AUTHORS file. things like regenerating the website or updating the AUTHORS file.
- `scripts/tools/` misc. scripts for users of sbws. - `scripts/tools/` misc. scripts for users of sbws.
- `tests/testnets/` scripts and code for running mini Tor networks locally and performing tests with them.
performing integration tests with them. - `tests/unit/` simple little tests that don't require Tor to be running
- `tests/` unit tests executed with `pytest` or `tox`. - `tests/integration/` more complex tests and/or tests that require Tor to be running
- `tests/testnets/` scripts and code for running mini Tor networks locally
## Boring things ## Boring things
......
...@@ -2,7 +2,7 @@ import sbws.util.stem as stem_utils ...@@ -2,7 +2,7 @@ import sbws.util.stem as stem_utils
from stem.descriptor.router_status_entry import RouterStatusEntryV3 from stem.descriptor.router_status_entry import RouterStatusEntryV3
def test_foo(persistent_launch_tor): def test_launch_and_okay(persistent_launch_tor):
cont = persistent_launch_tor cont = persistent_launch_tor
assert stem_utils.is_controller_okay(cont) assert stem_utils.is_controller_okay(cont)
assert stem_utils.is_bootstrapped(cont) assert stem_utils.is_bootstrapped(cont)
...@@ -25,3 +25,15 @@ def test_get_relay_from_nick(persistent_launch_tor): ...@@ -25,3 +25,15 @@ def test_get_relay_from_nick(persistent_launch_tor):
assert isinstance(relay, RouterStatusEntryV3) assert isinstance(relay, RouterStatusEntryV3)
assert relay.fingerprint == 'AA45C13025C037F056E734169891878ED0880231' assert relay.fingerprint == 'AA45C13025C037F056E734169891878ED0880231'
assert relay.nickname == 'auth1' assert relay.nickname == 'auth1'
def test_get_relay_from_bad_nick(persistent_launch_tor):
cont = persistent_launch_tor
relay = stem_utils.fp_or_nick_to_relay(cont, 'notarelaynick')
assert relay is None
def test_get_relay_from_bad_fp(persistent_launch_tor):
cont = persistent_launch_tor
relay = stem_utils.fp_or_nick_to_relay(cont, 'A'*40)
assert relay is None
[tox] [tox]
skip_missing_interpreters = True skip_missing_interpreters = True
envlist = clean, lint, py34, py35, py36, stats, integration envlist = clean, lint, py34, py35, py36, integration, stats
[travis] [travis]
python = python =
...@@ -20,19 +20,15 @@ commands= ...@@ -20,19 +20,15 @@ commands=
ignore_errors = True ignore_errors = True
deps = .[test] deps = .[test]
whitelist_externals = whitelist_externals =
rm
tar tar
time
bash bash
sleep time
changedir = {toxinidir}/tests/testnets
commands = commands =
rm -vrf reproducible tar -C {envtmpdir} -vxf {toxinidir}/tests/integration/net.tar
tar vxf reproducible.tar bash {envtmpdir}/net/start.sh
bash ./reproducible/start.sh time bash -c "python3 {envtmpdir}/net/wait.py {envtmpdir}/net/{auth,relay,exit}*"
time bash -c "python3 ./reproducible/wait.py ./reproducible/{auth,relay,exit}*" coverage run -a --rcfile={toxinidir}/.coveragerc --source=sbws -m pytest -s {toxinidir}/tests/integration -vv
coverage run --rcfile={toxinidir}/.coveragerc --source=sbws -m pytest -s {toxinidir}/tests/integration -vv bash {envtmpdir}/net/stop.sh
bash ./reproducible/stop.sh
[testenv:lint] [testenv:lint]
skip_install = True skip_install = True
...@@ -56,7 +52,7 @@ install_command = ...@@ -56,7 +52,7 @@ install_command =
pip install --process-dependency-links {opts} {packages} pip install --process-dependency-links {opts} {packages}
deps = .[test] deps = .[test]
commands = commands =
coverage run --rcfile={toxinidir}/.coveragerc --source=sbws -m pytest -s {toxinidir}/tests/unit -vv coverage run -a --rcfile={toxinidir}/.coveragerc --source=sbws -m pytest -s {toxinidir}/tests/unit -vv
passenv = passenv =
TRAVIS TRAVIS
TRAVIS_JOB_ID TRAVIS_JOB_ID
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment