From 4f99f1e2bc0aef773afdff485eb865c16002f606 Mon Sep 17 00:00:00 2001 From: Otavio Pontes Date: Mon, 26 Nov 2018 23:01:48 +0000 Subject: [PATCH] real_content: Check if bundle-list function is working before using the result Check if the list returned by bundle-list is consistent with the bundle list in server to make sure we aren't trying to bundle-add an invalid list of packages Signed-off-by: Otavio Pontes --- test/real_content/real_content_lib.bash | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/real_content/real_content_lib.bash b/test/real_content/real_content_lib.bash index 7f857b55..f2f96dfc 100644 --- a/test/real_content/real_content_lib.bash +++ b/test/real_content/real_content_lib.bash @@ -56,6 +56,16 @@ install_bundles() { if [ -z "$BUNDLE_LIST" ]; then run sudo sh -c "$SWUPD bundle-list --all $SWUPD_OPTS_SHORT" BUNDLE_LIST=$(echo "$output" | tr '\n' ' ') + num_pkgs=$(echo "$output" | wc -l) + + cur_version=$(grep VERSION_ID "${ROOT_DIR}/usr/lib/os-release" | cut -d = -f 2) + num_pkgs_mom=$(sh -c "curl ${URL}/$cur_version/Manifest.MoM 2>/dev/null | grep ^M\\\\. | wc -l") + + if [ "$num_pkgs" -ne "$num_pkgs_mom" ]; then + print "Number of packages on bundle-list --all is $num_pkgs. Expected is $num_pkgs_mom:" + print "$BUNDLE_LIST" + return 1 + fi fi print "Install bundles: $BUNDLE_LIST"