kytos-ng / kytos-end-to-end-tests

Kytos End-to-End Tests
0 stars 10 forks source link

feat: potentially provide a way to run e2e without `kytos` container #238

Closed viniarck closed 8 months ago

viniarck commented 1 year ago

This is a feature request to allow developers to be able to execute e2e tests, but optionally without kytos service container amlight/kytos:latest. For most cases it's easy to build a new docker image and parametrize a branch, however, as @Ktmi also pointed out sometime ago, it'd be great to also have the possibility to target kytosd running on the host machine, since that way you can even have a faster iteration edit/test development loop when you're assessing if tests are still passing.

To allow this, it's not too far away, basically, if we allowed to start with a different entry point when executing kytosd without a container then parametrizing the DB parameters, and also trying to infer if it's on a virtual env and avoid assuming that certain files would be on /var/.* (same way as kytos already does with config files prepending the venv path when it exists). That would also imply that when running e2e you wouln't be running another kytosd instance, since only a single kytosd should be running, which is fine, but something to be aware.

Another benefit from running it without the container, is that mininet sometimes behaves a bit sluggish or slow to start on certain newer recent kernels when running in a container, so for developers in that situation they can run mininet on their host machine directly which typically don't have any issues. On my laptop with kernel 6+, sometimes I have to increase pytest timeout just so it can get started and run the tests.

Let me know what you guys think you'd be onboard with this additional option or if you have any other suggestions.

viniarck commented 11 months ago

Here's an example, of how the env prefix can get discovered

viniarck commented 11 months ago

The ultimate expected result is that, locally a development should be able to run any of the pytest command that currently needs to be run inside the container, for instance:

python3 -m pytest --timeout=60 tests/test_e2e_10_mef_eline.py::TestE2EMefEline::test_on_primary_path_fail_should_migrate_to_backup

Although locally, the database instances still need to be composed up but without kytos container service, so we can also consider introducing a new docker-compose.yml file.