From e321399f1d5b188d84ae1da1efd99d9c2abc8891 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20Stav=C4=9Bl=20=40=20RedHat?= Date: Fri, 13 Dec 2024 01:12:44 +0100 Subject: [PATCH] added preparation for the tests into test.sh --- .../tests/integration/extend-test-data.sh | 49 +++++++++++++++++++ systemtest/tests/integration/test.sh | 26 +++++++++- 2 files changed, 73 insertions(+), 2 deletions(-) create mode 100755 systemtest/tests/integration/extend-test-data.sh diff --git a/systemtest/tests/integration/extend-test-data.sh b/systemtest/tests/integration/extend-test-data.sh new file mode 100755 index 000000000..86cf4d411 --- /dev/null +++ b/systemtest/tests/integration/extend-test-data.sh @@ -0,0 +1,49 @@ +#!/bin/bash + +# +# this script creates +# - two additional activation keys +# - two environments for organization +# +# Those data are used in integration tests +# + +# +# Two environments +# +USERNAME=admin +PASSWORD=admin +ORG=donaldduck + +curl -k --request POST --user ${USERNAME}:${PASSWORD} \ + --data '{"id": "env-id-01", "name": "env-name-01", "description": "Testing environment num. 1"}' \ + --header 'accept: application/json' \ + --header 'content-type: application/json' \ + https://localhost:8443/candlepin/owners/${ORG}/environments + +curl -k --request POST --user ${USERNAME}:${PASSWORD} \ + --data '{"id": "env-id-02", "name": "env-name-02", "description": "Testing environment num. 2"}' \ + --header 'accept: application/json' \ + --header 'content-type: application/json' \ + https://localhost:8443/candlepin/owners/${ORG}/environments + +# +# Two activation keys +# + +USERNAME=duey +PASSWORD=password +ORG=donaldduck + +curl -k --request POST --user ${USERNAME}:${PASSWORD} \ + --data '{"name":"act-key-01"}' \ + --header 'accept: application/json' \ + --header 'content-type: application/json' \ + https://localhost:8443/candlepin/owners/${ORG}/activation_keys + + +curl -k --request POST --user ${USERNAME}:${PASSWORD} \ + --data '{"name":"act-key-02"}' \ + --header 'accept: application/json' \ + --header 'content-type: application/json' \ + https://localhost:8443/candlepin/owners/${ORG}/activation_keys diff --git a/systemtest/tests/integration/test.sh b/systemtest/tests/integration/test.sh index 0eaa8bd47..bdfa64eb9 100755 --- a/systemtest/tests/integration/test.sh +++ b/systemtest/tests/integration/test.sh @@ -22,8 +22,30 @@ python3 -m venv venv # Install requirements for integration tests pip install -r integration-tests/requirements.txt -# Run all integration tests -pytest --junit-xml=./junit.xml -v integration-tests +# configuration for the tests +cat < settings.toml +[testing] +candlepin.host = "localhost" +candlepin.port = 8443 +candlepin.insecure = true +candlepin.prefix = "/candlepin" +candlepin.username = "duey" +candlepin.password = "password" +candlepin.org = "donaldduck" +candlepin.activation_keys = ["act-key-01","act-key-02"] +candlepin.environment.names = ["env-name-01","env-name-02"] +candlepin.environment.ids = ["env-id-01","env-id-02"] +EOF + + +# run local candlepin for testing purpose +podman run -d --name candlepin -p 8080:8080 -p 8443:8443 --hostname candlepin.local ghcr.io/ptoscano/candlepin-unofficial:latest + +# create testing data in local candlepin +./extend-test-data.sh + +# Run all integration tests. They will use 'testing' environment in configuration +ENV_FOR_DYNACONF=testing pytest --junit-xml=./junit.xml -v integration-tests retval=$? # Copy artifacts of integration tests