Skip to content

Commit

Permalink
feat: basic integration testing with tmt
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
ptoscano committed Dec 8, 2023
1 parent 3b4cde9 commit 610ceaa
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 0 deletions.
1 change: 1 addition & 0 deletions .fmf/version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1
1 change: 1 addition & 0 deletions integration-tests/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
git+https://github.com/ptoscano/pytest-client-tools@main
4 changes: 4 additions & 0 deletions integration-tests/test_version.py
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
6 changes: 6 additions & 0 deletions systemtest/plans/main.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
summary: rhc test suite
discover:
how: fmf

execute:
how: tmt
3 changes: 3 additions & 0 deletions systemtest/tests/integration/main.fmf
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
summary: Runs tmt tests
test: ./test.sh
duration: 10m
17 changes: 17 additions & 0 deletions systemtest/tests/integration/test.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/bash
set -eu
set -x

# 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

0 comments on commit 610ceaa

Please sign in to comment.