Code development platform for open source projects from the European Union institutions

Skip to content
Snippets Groups Projects

Run some tests just if plugin is installed.

Merged Diego MENDEZ requested to merge feature/test_tags into develop
Files
5
+ 14
0
@@ -42,6 +42,13 @@ run-test-job:
- python3 -m venv "$CI_PROJECT_DIR/plugins/venv"
- source "$CI_PROJECT_DIR/plugins/venv/bin/activate"
- pip install -r "$CI_PROJECT_DIR/tests/requirements.e2e.txt"
# Remove some tests if plugins are not installed, to keep CI compatibility with different testing branches.
- for str in {cert,mac,rps}; do
if [[ $(cat requirements.txt | grep -e ${str} | wc -l) == 0 ]]; then
rm -r $CI_PROJECT_DIR/tests/e2e/netbox/netbox_${str}*_plugin;
echo "Removed ${str}'s python tests.";
fi;
done
script:
- env HOST="${TEST_HOST}" PORT="${TEST_PORT}" API_KEY="$API_KEY" pytest -s --junit-xml=tests-report-netbox-dist-plugin.xml "$CI_PROJECT_DIR/tests/e2e/"
after_script:
@@ -60,6 +67,13 @@ run-robot-test-job:
- python3 -m venv "$CI_PROJECT_DIR/plugins/venv"
- source "$CI_PROJECT_DIR/plugins/venv/bin/activate"
- docker build -t robotframework:latest ./tests/docker/
# Remove some tests if plugins are not installed, to keep CI compatibility with different testing branches.
- for str in {mac,}; do
if [[ $(cat requirements.txt | grep -e ${str} | wc -l) == 0 ]]; then
rm -r $CI_PROJECT_DIR/tests/robot/netbox_${str}*_plugin;
echo "Removed ${str}'s robot tests.";
fi;
done
script:
- docker run --rm -v $CI_PROJECT_DIR:/project --network "host" robotframework:latest bash -c
"robot -v HOST:"${TEST_HOST}" -v PORT:"${TEST_PORT}" -v API_TOKEN:"$API_KEY" --outputdir /project/reports /project/tests/robot/"
Loading