Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit 020cd23b authored by Diego MENDEZ's avatar Diego MENDEZ
Browse files

:twisted_rightwards_arrows: Merge branch 'feature/test_tags' into 'develop'

Run some tests just if plugin is installed.

See merge request !132
parents db58f866 82bcf234
No related branches found
No related tags found
2 merge requests!137Develop,!132Run some tests just if plugin is installed.
Pipeline #231103 passed
Pipeline: Netbox Plugins

#231107

    ...@@ -42,6 +42,13 @@ run-test-job: ...@@ -42,6 +42,13 @@ run-test-job:
    - python3 -m venv "$CI_PROJECT_DIR/plugins/venv" - python3 -m venv "$CI_PROJECT_DIR/plugins/venv"
    - source "$CI_PROJECT_DIR/plugins/venv/bin/activate" - source "$CI_PROJECT_DIR/plugins/venv/bin/activate"
    - pip install -r "$CI_PROJECT_DIR/tests/requirements.e2e.txt" - 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: 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/" - 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: after_script:
    ...@@ -60,6 +67,13 @@ run-robot-test-job: ...@@ -60,6 +67,13 @@ run-robot-test-job:
    - python3 -m venv "$CI_PROJECT_DIR/plugins/venv" - python3 -m venv "$CI_PROJECT_DIR/plugins/venv"
    - source "$CI_PROJECT_DIR/plugins/venv/bin/activate" - source "$CI_PROJECT_DIR/plugins/venv/bin/activate"
    - docker build -t robotframework:latest ./tests/docker/ - 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: script:
    - docker run --rm -v $CI_PROJECT_DIR:/project --network "host" robotframework:latest bash -c - 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/" "robot -v HOST:"${TEST_HOST}" -v PORT:"${TEST_PORT}" -v API_TOKEN:"$API_KEY" --outputdir /project/reports /project/tests/robot/"
    ......
    *** Settings *** *** Settings ***
    Test Tags core
    Library RequestsLibrary Library RequestsLibrary
    Variables variables.yaml Variables variables.yaml
    ......
    *** Settings *** *** Settings ***
    Test Tags Docs Test Tags mac
    Library RequestsLibrary Library RequestsLibrary
    Library OperatingSystem Library OperatingSystem
    Library Collections Library Collections
    ......
    *** Settings *** *** Settings ***
    Test Tags core
    Library RequestsLibrary Library RequestsLibrary
    Variables variables.yaml Variables variables.yaml
    ......
    *** Test Cases *** *** Test Cases ***
    TC01 Pass Test TC01 Pass Test
    [tags] testing
    Pass Execution A Passing Test Pass Execution A Passing Test
    \ No newline at end of file
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment