| |
@@ -9,11 +9,12 @@
|
| |
source "$HERE/config"
|
| |
source "$HERE/helpers"
|
| |
|
| |
+ set -o pipefail
|
| |
|
| |
rlJournalStart
|
| |
rlPhaseStartSetup
|
| |
setup_checks
|
| |
- RESULTDIR=`mktemp -d`
|
| |
+ RESULTDIR=$(mktemp -d)
|
| |
rlPhaseEnd
|
| |
|
| |
rlPhaseStartTest
|
| |
@@ -22,42 +23,46 @@
|
| |
rlRun "parse_build_id"
|
| |
rlRun "copr watch-build $BUILD_ID"
|
| |
|
| |
- checkResults()
|
| |
- {
|
| |
- rlAssertEquals "There should be 4 results" `cat $RESULTDIR/results.json |jq '.packages | length'` 4
|
| |
- path=$1
|
| |
- rlRun "cat $path |jq -e '.packages[0].name == \"hello-debugsource\"'"
|
| |
- rlRun "cat $path |jq -e '.packages[0].epoch == 0'"
|
| |
- rlRun "cat $path |jq -e '.packages[0].version == \"2.8\"'"
|
| |
- rlRun "cat $path |jq -e '.packages[0].release == \"1.fc$FEDORA_VERSION\"'"
|
| |
- rlRun "cat $path |jq -e '.packages[0].arch == \"x86_64\"'"
|
| |
-
|
| |
- rlRun "cat $path |jq -e '.packages[1].name == \"hello\"'"
|
| |
- rlRun "cat $path |jq -e '.packages[1].epoch == 0'"
|
| |
- rlRun "cat $path |jq -e '.packages[1].version == \"2.8\"'"
|
| |
- rlRun "cat $path |jq -e '.packages[1].release == \"1.fc$FEDORA_VERSION\"'"
|
| |
- rlRun "cat $path |jq -e '.packages[1].arch == \"x86_64\"'"
|
| |
-
|
| |
- rlRun "cat $path |jq -e '.packages[2].name == \"hello\"'"
|
| |
- rlRun "cat $path |jq -e '.packages[2].epoch == 0'"
|
| |
- rlRun "cat $path |jq -e '.packages[2].version == \"2.8\"'"
|
| |
- rlRun "cat $path |jq -e '.packages[2].release == \"1.fc$FEDORA_VERSION\"'"
|
| |
- rlRun "cat $path |jq -e '.packages[2].arch == \"src\"'"
|
| |
-
|
| |
- rlRun "cat $path |jq -e '.packages[3].name == \"hello-debuginfo\"'"
|
| |
- rlRun "cat $path |jq -e '.packages[3].epoch == 0'"
|
| |
- rlRun "cat $path |jq -e '.packages[3].version == \"2.8\"'"
|
| |
- rlRun "cat $path |jq -e '.packages[3].release == \"1.fc$FEDORA_VERSION\"'"
|
| |
- rlRun "cat $path |jq -e '.packages[3].arch == \"x86_64\"'"
|
| |
- }
|
| |
-
|
| |
- # Check the results.json file that is stored on backend
|
| |
+ checkResults()
|
| |
+ {
|
| |
+ orig_file=$1
|
| |
+ path=$orig_file.sorted
|
| |
+
|
| |
+ jq -e '.packages|=sort_by(.name,.arch)' < "$orig_file" > "$path"
|
| |
+ rlAssertEquals "There should be 4 results" "$(jq '.packages|length' < "$path")" 4
|
| |
+
|
| |
+ rlRun "cat $path |jq -e '.packages[0].name == \"hello\"'"
|
| |
+ rlRun "cat $path |jq -e '.packages[0].epoch == 0'"
|
| |
+ rlRun "cat $path |jq -e '.packages[0].version == \"2.8\"'"
|
| |
+ rlRun "cat $path |jq -e '.packages[0].release == \"1.fc$FEDORA_VERSION\"'"
|
| |
+ rlRun "cat $path |jq -e '.packages[0].arch == \"src\"'"
|
| |
+
|
| |
+ rlRun "cat $path |jq -e '.packages[1].name == \"hello\"'"
|
| |
+ rlRun "cat $path |jq -e '.packages[1].epoch == 0'"
|
| |
+ rlRun "cat $path |jq -e '.packages[1].version == \"2.8\"'"
|
| |
+ rlRun "cat $path |jq -e '.packages[1].release == \"1.fc$FEDORA_VERSION\"'"
|
| |
+ rlRun "cat $path |jq -e '.packages[1].arch == \"x86_64\"'"
|
| |
+
|
| |
+ rlRun "cat $path |jq -e '.packages[2].name == \"hello-debuginfo\"'"
|
| |
+ rlRun "cat $path |jq -e '.packages[2].epoch == 0'"
|
| |
+ rlRun "cat $path |jq -e '.packages[2].version == \"2.8\"'"
|
| |
+ rlRun "cat $path |jq -e '.packages[2].release == \"1.fc$FEDORA_VERSION\"'"
|
| |
+ rlRun "cat $path |jq -e '.packages[2].arch == \"x86_64\"'"
|
| |
+
|
| |
+ rlRun "cat $path |jq -e '.packages[3].name == \"hello-debugsource\"'"
|
| |
+ rlRun "cat $path |jq -e '.packages[3].epoch == 0'"
|
| |
+ rlRun "cat $path |jq -e '.packages[3].version == \"2.8\"'"
|
| |
+ rlRun "cat $path |jq -e '.packages[3].release == \"1.fc$FEDORA_VERSION\"'"
|
| |
+ rlRun "cat $path |jq -e '.packages[3].arch == \"x86_64\"'"
|
| |
+ }
|
| |
+
|
| |
+ # Check the results.json file that is stored on backend
|
| |
URL_PATH="results/${NAME_PREFIX}TestResultsJson/$CHROOT/$(build_id_with_leading_zeroes)-hello/results.json"
|
| |
- rlRun "wget -P $RESULTDIR $BACKEND_URL/$URL_PATH"
|
| |
- checkResults "$RESULTDIR/results.json"
|
| |
+ rlRun "curl $BACKEND_URL/$URL_PATH > $RESULTDIR/results.json"
|
| |
+ checkResults "$RESULTDIR/results.json"
|
| |
|
| |
|
| |
- # Check the /build-chroot/built-packages/ APIv3 route
|
| |
+ # Check the /build-chroot/built-packages/ APIv3 route
|
| |
python << END
|
| |
from copr.v3 import Client
|
| |
from copr_cli.util import json_dumps
|
| |
@@ -67,10 +72,10 @@
|
| |
with open("$RESULTDIR/results-api-build-chroot.json", "w") as f:
|
| |
f.write(json_dumps(response))
|
| |
END
|
| |
- checkResults "$RESULTDIR/results-api-build-chroot.json"
|
| |
+ checkResults "$RESULTDIR/results-api-build-chroot.json"
|
| |
|
| |
|
| |
- # Check the /build/built-packages/ APIv3 route
|
| |
+ # Check the /build/built-packages/ APIv3 route
|
| |
python << END
|
| |
from copr.v3 import Client
|
| |
from copr_cli.util import json_dumps
|
| |
@@ -80,7 +85,7 @@
|
| |
with open("$RESULTDIR/results-api-build.json", "w") as f:
|
| |
f.write(json_dumps(response["$CHROOT"]))
|
| |
END
|
| |
- checkResults "$RESULTDIR/results-api-build.json"
|
| |
+ checkResults "$RESULTDIR/results-api-build.json"
|
| |
|
| |
|
| |
rlPhaseEnd
|
| |
Sort the results.json file (by default unsorted) and then compare the
contents correctly. Re-tab while I'm on it to avoid mixed spaces/tabs.
Fixes: #1846