mirror of
https://pagure.io/fm-orchestrator.git
synced 2026-04-09 05:38:04 +08:00
Merge #802 Add an integration test to make sure module builds fail when a component fails
This commit is contained in:
29
contrib/test-mbs-fedora-staging-failed-build.sh
Executable file
29
contrib/test-mbs-fedora-staging-failed-build.sh
Executable file
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash -xe
|
||||
|
||||
which fedpkg-stage || (echo "sudo dnf install fedpkg-stage" && exit 1)
|
||||
which jq || (echo "sudo dnf install jq" && exit 1)
|
||||
|
||||
FAS=$USER
|
||||
rm -rf /var/tmp/mbs-test-rebuild
|
||||
mkdir /var/tmp/mbs-test-rebuild
|
||||
cd /var/tmp/mbs-test-rebuild
|
||||
git clone ssh://$FAS@pkgs.stg.fedoraproject.org/modules/testmodule
|
||||
cd testmodule
|
||||
git checkout fail-mbs-test
|
||||
git commit --allow-empty -m "Empty test commit, for MBS in staging."
|
||||
git push origin fail-mbs-test
|
||||
|
||||
build_id=$(fedpkg-stage module-build | tail -1 | awk '{ print $3 }' | cut -c 2-)
|
||||
echo "Working with module build $build_id"
|
||||
fedpkg-stage module-build-watch $build_id
|
||||
|
||||
url=https://mbs.stg.fedoraproject.org/module-build-service/1/module-builds/$build_id
|
||||
state=$(curl $url | jq '.state')
|
||||
state_reason=$(curl $url | jq '.state_reason')
|
||||
if [ "$state" -ne "4" ]; then
|
||||
echo "module build state for #$build_id was $state. It should have failed."; exit 1;
|
||||
fi
|
||||
if [ "$state_reason" != "\"Some components failed to build.\"" ]; then
|
||||
echo "module build state_reason for #$build_id was \"$state_reason\". It should have been \"Some components failed to build.\""; exit 1;
|
||||
fi
|
||||
echo "HOORAY! It worked.. I think."
|
||||
Reference in New Issue
Block a user