From 254cf4f4e083b36f94a7008a620b59a069ce12c2 Mon Sep 17 00:00:00 2001 From: Colin Walters Date: Wed, 31 Aug 2022 15:33:26 -0400 Subject: [PATCH] tests/content-origins: Verify expected vendor for all RPM packages As we move to support multiple streams (particularly for C9S versus RHEL) we should ensure that we're not accidentally including content from CentOS in official RHEL builds, and vice versa. The RPM vendor field is useful for this. For now, this test just verifies Fedora and RHEL vendors, and I tested on both. --- tests/kola/content-origins/data/commonlib.sh | 1 + tests/kola/content-origins/test.sh | 28 ++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 120000 tests/kola/content-origins/data/commonlib.sh create mode 100755 tests/kola/content-origins/test.sh diff --git a/tests/kola/content-origins/data/commonlib.sh b/tests/kola/content-origins/data/commonlib.sh new file mode 120000 index 0000000000..1742d51e67 --- /dev/null +++ b/tests/kola/content-origins/data/commonlib.sh @@ -0,0 +1 @@ +../../data/commonlib.sh \ No newline at end of file diff --git a/tests/kola/content-origins/test.sh b/tests/kola/content-origins/test.sh new file mode 100755 index 0000000000..b67483d5ab --- /dev/null +++ b/tests/kola/content-origins/test.sh @@ -0,0 +1,28 @@ +#!/bin/bash +# kola: {"platforms": "qemu", "exclusive": false, "distros": "fcos rhcos" } +# Verify the RPM %{vendor} flag for everything installed matches what we expect. +# +# - platforms: qemu +# - This test should pass everywhere if it passes anywhere. +# - distros: This only handles Fedora and RHEL today. + +set -xeuo pipefail + +. $KOLA_EXT_DATA/commonlib.sh + +. /usr/lib/os-release + +case "${ID}" in + fedora) vendor='Fedora Project';; + rhel|rhcos) vendor='Red Hat, Inc.';; + *) echo "Unknown operating system ID=${ID}; skipping this test"; exit 0;; +esac + +cd $(mktemp -d) +rpm -qa --queryformat='%{name},%{vendor}\n' > rpmvendors.txt +if grep -vF ",${vendor}" rpmvendors.txt > unmatched.txt; then + cat unmatched.txt + fatal "Expected only vendor ${vendor} for all packages" +fi +echo "ok all RPMs produced by Vendor: ${vendor}" +