-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: basic integration testing with packit + testing-farm + tmt (#158)
* feat: basic integration testing with tmt Introduce a minimal setup for integration tests of insights-client. The tests are written using pytest and an helper plugin for insights-client and other Red Hat client tools [1]. The tests are wrapped as single "integration" test for tmt [2], which makes it possible to run them automatically e.g. in testing-farm. There is a simple test added to show how the setup for the tests works. [1] https://github.com/ptoscano/pytest-client-tools/ [2] https://github.com/teemtee/tmt/ Signed-off-by: Pino Toscano <[email protected]> * feat: run integration tests in testing-farm Extend the packit configuration to trigger tests on testing-farm after the completion of the build jobs. The tests are split for the different distributions supported; this is due to the current limitation of testing-farm in the way additional repositories can be supplied: as the name of a Fedora Copr repository cannot be specified, each distribution needs to get the repository URL for it. Manually specify the RHEL targets/composes due to the limitations in the packit<->testing-farm mapping of RHEL composes. Signed-off-by: Pino Toscano <[email protected]> * fix: workaround newer gnupg & insights-core/insights-client It looks like gnupg as available in Fedora 39 and newer does not validate anymore signatures in case their key is not part of the current keyring (which is what insights-client does). Since the way both insights-core and insights-client validate GPG signatures is being reworked/improved [1][2], add a crude workaround on Fedora 39+. [1] RedHatInsights/insights-core#3930 [2] #154 Signed-off-by: Pino Toscano <[email protected]> --------- Signed-off-by: Pino Toscano <[email protected]>
- Loading branch information
Showing
7 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
git+https://github.com/ptoscano/pytest-client-tools@main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
def test_version(insights_client): | ||
proc = insights_client.run("--version") | ||
assert b"Client: " in proc.stdout | ||
assert b"Core: " in proc.stdout |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
summary: rhc test suite | ||
discover: | ||
how: fmf | ||
|
||
execute: | ||
how: tmt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
summary: Runs tmt tests | ||
test: ./test.sh | ||
duration: 10m |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#!/bin/bash | ||
set -eu | ||
set -x | ||
|
||
. /etc/os-release | ||
if test "${ID}" = fedora -a ${VERSION_ID} -ge 39; then | ||
# HACK | ||
# on newer gnupg import the key to the local keyring; this will be solved | ||
# once both insights-core and insights-client are fixed to not rely on | ||
# root's .gnupg directory: | ||
# - https://github.com/RedHatInsights/insights-core/pull/3930 | ||
# - https://github.com/RedHatInsights/insights-client/pull/154 | ||
gpg --import /etc/insights-client/redhattools.pub.gpg | ||
fi | ||
|
||
# get to project root | ||
cd ../../../ | ||
|
||
dnf --setopt install_weak_deps=False install -y \ | ||
podman git-core python3-pip python3-pytest | ||
|
||
python3 -m venv venv | ||
# shellcheck disable=SC1091 | ||
. venv/bin/activate | ||
|
||
pip install -r integration-tests/requirements.txt | ||
|
||
pytest -v integration-tests |