-
Notifications
You must be signed in to change notification settings - Fork 161
Add example tests for artifact providers #4449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
dc828a0 to
ca4c960
Compare
ca4c960 to
a5284c8
Compare
Add simple, example-based integration tests for artifact providers: - koji.build: Fetches packages from Koji using build IDs - repository-url: Configures external package repositories - multi: Demonstrates using multiple providers together These tests serve as usage examples and verify basic functionality. Each test: - Shows clear usage of the --provide argument - Runs a complete tmt workflow - Verifies packages are installed correctly Once the design is approved, additional providers (koji.task, koji.nvr, file, copr.build, brew.*) can be added following the same pattern. Related to #4420
LecrisUT
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the goal for this PR to split the /tests/prepare/artifact into individual provider tests? If so, why not add it to it instead? For example you can add a for loop in the test.sh to loop over each provider if that is the intent.
One concern with the current approach is that the koji list-tagged logic is quite non-trivial and would prefer to be defined in a single place.
| rpm -q make | ||
|
|
||
| # Install docker-ce-cli from the configured repository | ||
| dnf install -y docker-ce-cli |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not be installing from the script since this is uncontrolled by us.
d3d3e13 to
92bad06
Compare
| make_build_id=$(get_koji_build_id "make" "f${fedora_release}") | ||
| rlPhaseEnd | ||
|
|
||
| rlPhaseStartTest "Test koji.build provider" | ||
| rlRun "tmt run -i $run --scratch -vv --all \ | ||
| provision -h $PROVISION_HOW --image $TEST_IMAGE_PREFIX/fedora/${fedora_release}:latest \ | ||
| prepare --how artifact --provide koji.build:$make_build_id" 0 "Run with koji.build provider" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing error check after calling get_koji_build_id. If the function fails (returns empty string), the test continues with an invalid koji.build: provider (missing build ID) which will cause the tmt run to fail with an unclear error message.
Fix by adding a check:
make_build_id=$(get_koji_build_id "make" "f${fedora_release}")
if [ -z "$make_build_id" ]; then
rlDie "Failed to get koji build ID for make"
fi| make_build_id=$(get_koji_build_id "make" "f${fedora_release}") | |
| rlPhaseEnd | |
| rlPhaseStartTest "Test koji.build provider" | |
| rlRun "tmt run -i $run --scratch -vv --all \ | |
| provision -h $PROVISION_HOW --image $TEST_IMAGE_PREFIX/fedora/${fedora_release}:latest \ | |
| prepare --how artifact --provide koji.build:$make_build_id" 0 "Run with koji.build provider" | |
| make_build_id=$(get_koji_build_id "make" "f${fedora_release}") | |
| if [ -z "$make_build_id" ]; then | |
| rlDie "Failed to get koji build ID for make" | |
| fi | |
| rlPhaseEnd | |
| rlPhaseStartTest "Test koji.build provider" | |
| rlRun "tmt run -i $run --scratch -vv --all \ | |
| provision -h $PROVISION_HOW --image $TEST_IMAGE_PREFIX/fedora/${fedora_release}:latest \ | |
| prepare --how artifact --provide koji.build:$make_build_id" 0 "Run with koji.build provider" |
Spotted by Graphite Agent
Is this helpful? React 👍 or 👎 to let us know.
| make_build_id=$(get_koji_build_id "make" "f${fedora_release}") | ||
| rlPhaseEnd | ||
|
|
||
| rlPhaseStartTest "Test multiple providers" | ||
| rlRun "tmt run -i $run --scratch -vv --all \ | ||
| provision -h $PROVISION_HOW --image $TEST_IMAGE_PREFIX/fedora/${fedora_release}:latest \ | ||
| prepare --how artifact \ | ||
| --provide koji.build:$make_build_id \ | ||
| --provide repository-url:https://download.docker.com/linux/fedora/docker-ce.repo" 0 "Run with multiple providers" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing error check after calling get_koji_build_id. If the function fails (returns empty string), the test continues with an invalid koji.build: provider (missing build ID) which will cause the tmt run to fail with an unclear error message.
Fix by adding a check:
make_build_id=$(get_koji_build_id "make" "f${fedora_release}")
if [ -z "$make_build_id" ]; then
rlDie "Failed to get koji build ID for make"
fi| make_build_id=$(get_koji_build_id "make" "f${fedora_release}") | |
| rlPhaseEnd | |
| rlPhaseStartTest "Test multiple providers" | |
| rlRun "tmt run -i $run --scratch -vv --all \ | |
| provision -h $PROVISION_HOW --image $TEST_IMAGE_PREFIX/fedora/${fedora_release}:latest \ | |
| prepare --how artifact \ | |
| --provide koji.build:$make_build_id \ | |
| --provide repository-url:https://download.docker.com/linux/fedora/docker-ce.repo" 0 "Run with multiple providers" | |
| make_build_id=$(get_koji_build_id "make" "f${fedora_release}") | |
| if [ -z "$make_build_id" ]; then | |
| rlDie "Failed to get koji build ID for make" | |
| fi | |
| rlPhaseEnd | |
| rlPhaseStartTest "Test multiple providers" | |
| rlRun "tmt run -i $run --scratch -vv --all \ | |
| provision -h $PROVISION_HOW --image $TEST_IMAGE_PREFIX/fedora/${fedora_release}:latest \ | |
| prepare --how artifact \ | |
| --provide koji.build:$make_build_id \ | |
| --provide repository-url:https://download.docker.com/linux/fedora/docker-ce.repo" 0 "Run with multiple providers" | |
Spotted by Graphite Agent
Is this helpful? React 👍 or 👎 to let us know.
Add simple, example-based integration tests for artifact providers:
Once the design is approved, additional providers (koji.task, koji.nvr, file, copr.build, brew.*) can be added following the same pattern.
Related to #4420