diff --git a/.cico-pr.pipeline b/.cico-pr.pipeline index 56582c2d..1811c701 100644 --- a/.cico-pr.pipeline +++ b/.cico-pr.pipeline @@ -80,17 +80,17 @@ node('factory2'){ timeout(30) { parallel py2_sqlite: { stage('Test with Python 2 & SQLite') { - onmyduffynode '~/fm-orchestrator/contrib/run-unittests.sh --no-tty' + onmyduffynode '~/fm-orchestrator/run-unittests.sh --no-tty' } }, py3_sqlite: { stage('Test with Python 3 & SQLite') { - onmyduffynode '~/fm-orchestrator/contrib/run-unittests.sh --py3 --no-tty' + onmyduffynode '~/fm-orchestrator/run-unittests.sh --py3 --no-tty' } }, py3_postgres: { stage('Test with Python 3 & Postgresql') { - onmyduffynode '~/fm-orchestrator/contrib/run-unittests.sh --py3 --with-pgsql --no-tty' + onmyduffynode '~/fm-orchestrator/run-unittests.sh --py3 --with-pgsql --no-tty' } } } diff --git a/contrib/test-mbs-fedora-staging-failed-build.sh b/contrib/test-mbs-fedora-staging-failed-build.sh deleted file mode 100755 index 95f174f4..00000000 --- a/contrib/test-mbs-fedora-staging-failed-build.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/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 }') -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." diff --git a/contrib/test-mbs-fedora-staging-rebuild.sh b/contrib/test-mbs-fedora-staging-rebuild.sh deleted file mode 100755 index 7880cbbd..00000000 --- a/contrib/test-mbs-fedora-staging-rebuild.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/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/rpms/perl-List-Compare -git clone ssh://$FAS@pkgs.stg.fedoraproject.org/modules/testmodule - -# First, do a build without changes any components, just to set a baseline. -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 }') -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 "3" ] && [ "$state" -ne "5" ]; then - echo "initial module build state for #$build_id was $state"; exit 1; -fi -baseline_task_id_1=$(curl $url | jq '.tasks.rpms."perl-List-Compare".task_id') -baseline_task_id_2=$(curl $url | jq '.tasks.rpms."perl-Tangerine".task_id') -baseline_task_id_3=$(curl $url | jq '.tasks.rpms.tangerine.task_id') - -# Now that the baseline is established, modify a component and try again. -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 }') -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 "3" ] && [ "$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 "$baseline_task_id_1" ]; 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 "$baseline_task_id_2" ]; 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 "$baseline_task_id_3" ]; 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." diff --git a/contrib/test-mbs-fedora-staging-resume.sh b/contrib/test-mbs-fedora-staging-resume.sh deleted file mode 100755 index 7878b08c..00000000 --- a/contrib/test-mbs-fedora-staging-resume.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/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 }') -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." -build_id_two=$(fedpkg-stage module-build --optional rebuild_strategy=only-changed | tail -1 | awk '{ print $3 }') -if [ "$build_id_two" -ne "$build_id" ]; then - echo "The module build didn't resume."; exit 1; -fi - -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 "3" ] && [ "$state" -ne "5" ]; then - echo "module build state for #$build_id was $state"; exit 1; -fi - -echo "HOORAY! It worked.. I think." diff --git a/docs/CONTRIBUTING.rst b/docs/CONTRIBUTING.rst index 0f48f094..0898b505 100644 --- a/docs/CONTRIBUTING.rst +++ b/docs/CONTRIBUTING.rst @@ -20,7 +20,7 @@ section "Updating test images in Quay" to learn how to manage these images. .. _factory2: https://quay.io/organization/factory2 -To run the tests, just simply run: ``contrib/run-unittests.sh`` +To run the tests, just simply run: ``run-unittests.sh`` By default, this script runs tests inside container ``mbs-test-centos`` with Python 2 and SQLite database. @@ -34,13 +34,13 @@ There are options to change the tests enviornment: * ``--podman``: use Podman instead of Docker * ``--no-pull``: don't update Docker images -For example, ``contrib/run-unittests.sh --py3 --with-pgsql``. +For example, ``run-unittests.sh --py3 --with-pgsql``. You can specify the subset of tests to run inside the container as well. Tests specified from the command-line are passed to ``py.test`` directly. Please note that, the path of each test must be a relative path. For example:: - contrib/run-unittests.sh \ + run-unittests.sh \ tests/test_utils/ \ tests/test_mmd_resolver.py \ tests/test_builder/test_koji.py::TestKojiBuilder::test_tag_to_repo diff --git a/contrib/run-unittests.sh b/run-unittests.sh similarity index 100% rename from contrib/run-unittests.sh rename to run-unittests.sh