From 8b1d30455a63a5d653877623ad75aa09128e7711 Mon Sep 17 00:00:00 2001 From: Oleksandr Mazur Date: Wed, 11 Dec 2024 16:10:50 +0200 Subject: [PATCH] Tests: execute tests in tmpfs context (folder) Whenever tests start, they might do some enviromental changes to local FS. Handle this by moving the 'context' of tests execution to a tmpfs folder, that can be easily purged after tests are done / new test run is being executed. NOTE: further changes in regard to tests isolation should potentially utilize a separate docker container that serves as a fresh clean and isolated enviroment for tests run. Signed-off-by: Oleksandr Mazur --- tests/requirements.txt | 1 + tests/run.sh | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/tests/requirements.txt b/tests/requirements.txt index 2d746a6..bc73e4c 100644 --- a/tests/requirements.txt +++ b/tests/requirements.txt @@ -4,3 +4,4 @@ pytest==8.3.3 randmac==0.1 psycopg2-binary==2.9.10 redis==5.2.0 +requests==2.32.3 diff --git a/tests/run.sh b/tests/run.sh index 4ecfdf6..088811e 100755 --- a/tests/run.sh +++ b/tests/run.sh @@ -2,6 +2,14 @@ # Separate exports for clearer visibility of _what exactly_ # we're putting in python path + +rm -rf /tmp/cgw_tests_runner; +mkdir /tmp/cgw_tests_runner && \ + cp -rf ../tests /tmp/cgw_tests_runner/ && \ + cp -rf ../utils /tmp/cgw_tests_runner/; + +cd /tmp/cgw_tests_runner/tests + export PYTHONPATH="$PYTHONPATH:$PWD" export PYTHONPATH="$PYTHONPATH:$PWD/../utils"