Skip to content

Commit

Permalink
added preparation for the tests into test.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
jstavel committed Dec 13, 2024
1 parent e910621 commit e321399
Show file tree
Hide file tree
Showing 2 changed files with 73 additions and 2 deletions.
49 changes: 49 additions & 0 deletions systemtest/tests/integration/extend-test-data.sh
Original file line number Diff line number Diff line change
@@ -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
26 changes: 24 additions & 2 deletions systemtest/tests/integration/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<EOF > 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
Expand Down

0 comments on commit e321399

Please sign in to comment.