From 960ff1c4f37f9d9ffab8f194aff3c5cdc551a554 Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Thu, 2 Nov 2017 14:49:20 -0400 Subject: [PATCH 1/2] Add a script to test MBS in fedora-stg. It does a little exercise... and it works! Used today to test mbs-1.4.1. We can probably expand on this later to add other tests as we like. --- contrib/test-mbs-fedora-staging.sh | 43 ++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100755 contrib/test-mbs-fedora-staging.sh diff --git a/contrib/test-mbs-fedora-staging.sh b/contrib/test-mbs-fedora-staging.sh new file mode 100755 index 00000000..eaab92a0 --- /dev/null +++ b/contrib/test-mbs-fedora-staging.sh @@ -0,0 +1,43 @@ +#!/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 +mkdir /var/tmp/mbs-test +cd /var/tmp/mbs-test + +git clone ssh://$FAS@pkgs.stg.fedoraproject.org/rpms/perl-List-Compare +git clone ssh://$FAS@pkgs.stg.fedoraproject.org/modules/testmodule + +cd perl-List-Compare +git commit --allow-empty -m "Empty test commit, for MBS in staging." +git push origin master +cd ../testmodule +git commit --allow-empty -m "Empty test commit, for MBS in staging." +git push origin master +build_id=$(fedpkg-stage module-build --optional rebuild_strategy=only-changed | 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') +if [ "$state" -ne "5" ]; then + echo "module build state for #$build_id was $state"; exit 1; +fi + +actual_task_id_1=$(curl $url | jq '.tasks.rpms."perl-List-Compare".task_id') +actual_task_id_2=$(curl $url | jq '.tasks.rpms."perl-Tangerine".task_id') +actual_task_id_3=$(curl $url | jq '.tasks.rpms.tangerine.task_id') + +if [ "$actual_task_id_1" -eq "90920002" ]; then + echo "perl-List-Compare task id was the same as before. It was re-used! Incorrect."; exit 1; +fi +if [ "$actual_task_id_2" -ne "90920003" ]; then + echo "perl-Tangerine task id was NOT the same as before. It was not reused, but should have been."; exit 1; +fi +if [ "$actual_task_id_3" -ne "90919823" ]; then + echo "tangerine task id was NOT the same as before. It was not reused, but should have been."; exit 1; +fi +echo "HOORAY! It worked.. I think." From 4200579835464b2f2b5d4ff9002f0e57cd5108db Mon Sep 17 00:00:00 2001 From: Ralph Bean Date: Fri, 3 Nov 2017 15:56:53 -0400 Subject: [PATCH 2/2] Add a second test script. --- ....sh => test-mbs-fedora-staging-rebuild.sh} | 6 ++-- contrib/test-mbs-fedora-staging-resume.sh | 31 +++++++++++++++++++ 2 files changed, 34 insertions(+), 3 deletions(-) rename contrib/{test-mbs-fedora-staging.sh => test-mbs-fedora-staging-rebuild.sh} (94%) create mode 100755 contrib/test-mbs-fedora-staging-resume.sh diff --git a/contrib/test-mbs-fedora-staging.sh b/contrib/test-mbs-fedora-staging-rebuild.sh similarity index 94% rename from contrib/test-mbs-fedora-staging.sh rename to contrib/test-mbs-fedora-staging-rebuild.sh index eaab92a0..b4022010 100755 --- a/contrib/test-mbs-fedora-staging.sh +++ b/contrib/test-mbs-fedora-staging-rebuild.sh @@ -4,9 +4,9 @@ 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 -mkdir /var/tmp/mbs-test -cd /var/tmp/mbs-test +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/rpms/perl-List-Compare git clone ssh://$FAS@pkgs.stg.fedoraproject.org/modules/testmodule diff --git a/contrib/test-mbs-fedora-staging-resume.sh b/contrib/test-mbs-fedora-staging-resume.sh new file mode 100755 index 00000000..b12c8c4e --- /dev/null +++ b/contrib/test-mbs-fedora-staging-resume.sh @@ -0,0 +1,31 @@ +#!/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-resume +mkdir /var/tmp/mbs-test-resume +cd /var/tmp/mbs-test-resume + +git clone ssh://$FAS@pkgs.stg.fedoraproject.org/rpms/perl-List-Compare +git clone ssh://$FAS@pkgs.stg.fedoraproject.org/modules/testmodule + +cd perl-List-Compare +git commit --allow-empty -m "Empty test commit, for MBS in staging." +git push origin master +cd ../testmodule +git commit --allow-empty -m "Empty test commit, for MBS in staging." +git push origin master +build_id=$(fedpkg-stage module-build --optional rebuild_strategy=only-changed | tail -1 | awk '{ print $3 }' | cut -c 2-) +echo "Working with module build $build_id" + +echo "Sleeping for 10 seconds before cancelling the build." +sleep 10 +fedpkg-stage module-build-cancel $build_id +echo "Build cancellation submitted." + +sleep 10 +echo "Submitting build again. Should resume." +fedpkg-stage module-build --optional rebuild_strategy=only-changed -w +echo "HOORAY! It worked.. I think."