diff options
author | Sergey V. Lobanov <sergey@lobanov.in> | 2022-09-04 18:49:42 +0300 |
---|---|---|
committer | Sergey V. Lobanov <sergey@lobanov.in> | 2022-09-04 19:06:49 +0300 |
commit | c92ff6266b18a9655edef231391739f0479dfb3a (patch) | |
tree | 0196077cbd54c9607ba918a42cac567411197663 /tests/accel-pppd/pppoe/conftest.py | |
parent | 38d96b8e20608fb743d543fe3f08ad4b9d1dcd66 (diff) | |
download | accel-ppp-c92ff6266b18a9655edef231391739f0479dfb3a.tar.gz accel-ppp-c92ff6266b18a9655edef231391739f0479dfb3a.zip |
add tests and ci workflow for running tests
This commit adds tests (using python3 pytest framework):
1. Test basic accel-cmd commands (show version, show stat, etc)
2. Test ipoe shared session up (dhcpv4) without radius
3. Test pppoe discovery (without PADO delay)
4. Test pppoe discovery (without PADO delay)
5. Test pppoe session up (ipv4) without radius
6. Test vlan creation using vlan-mon (pppoe)
These tests require external utils. Please read tests/README.md how to setup
environment, how to run the tests and how to generate coverage report
Also, run-tests.yml contains step-by-step instruction how to run the tests
Signed-off-by: Sergey V. Lobanov <sergey@lobanov.in>
Diffstat (limited to 'tests/accel-pppd/pppoe/conftest.py')
-rw-r--r-- | tests/accel-pppd/pppoe/conftest.py | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/accel-pppd/pppoe/conftest.py b/tests/accel-pppd/pppoe/conftest.py new file mode 100644 index 00000000..8ebaaed3 --- /dev/null +++ b/tests/accel-pppd/pppoe/conftest.py @@ -0,0 +1,42 @@ +import pytest +from common import pppd_process + +# pppd executable file name +@pytest.fixture() +def pppd(pytestconfig): + return pytestconfig.getoption("pppd") + + +# pppd configuration as string (should be redefined by specific test) +# all configs should contain "nodetach" option +@pytest.fixture() +def pppd_config(): + return "" + + +# pppd configuration as command line args +@pytest.fixture() +def pppd_args(pppd_config): + return pppd_config.split() + + +# setup and teardown for tests that required running pppd (after accel-pppd) +@pytest.fixture() +def pppd_instance(accel_pppd_instance, veth_pair_netns, pppd, pppd_args): + # test setup: + print("pppd_instance: accel_pppd_instance = " + str(accel_pppd_instance)) + is_started, pppd_thread, pppd_control = pppd_process.start( + veth_pair_netns["netns"], + pppd, + pppd_args, + ) + + # test execution: + yield { + "is_started": is_started, + "pppd_thread": pppd_thread, + "pppd_control": pppd_control, + } + + # test teardown: + pppd_process.end(pppd_thread, pppd_control) |