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
All threads resolved!
1 file
+ 12
14
Compare changes
  • Side-by-side
  • Inline
+ 12
14
@@ -42,13 +42,12 @@ 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 compatibility with Netbox_v4 branches.
- if [[ $(cat requirements.txt | grep -e mac -e cert | wc -l) != 0 ]];
then
rm -r $CI_PROJECT_DIR/tests/e2e/netbox/{netbox_cert_plugin,netbox_mac_address_plugin};
echo "Removed mac's and cert's tests.";
ls "$CI_PROJECT_DIR/tests/e2e/netbox/";
fi
# Remove some tests if plugins are not installed, to keep CI compatibility with different testing branches.
- for str in {cert,mac,rps};
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
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:
@@ -67,13 +66,12 @@ 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 compatibility with Netbox_v4 branches.
- if [[ $(cat requirements.txt | grep -e mac -e cert | wc -l) != 0 ]];
then
rm -r $CI_PROJECT_DIR/tests/robot/netbox_mac_address_plugin;
echo "Removed mac's tests.";
ls "$CI_PROJECT_DIR/tests/robot/";
fi
# Remove some tests if plugins are not installed, to keep CI compatibility with different testing branches.
- for str in {mac,};
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
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