Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests/content-origins: Verify expected vendor for all RPM packages #1947

Merged
merged 1 commit into from
Sep 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/kola/content-origins/data/commonlib.sh
28 changes: 28 additions & 0 deletions tests/kola/content-origins/test.sh
Original file line number Diff line number Diff line change
@@ -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.
Copy link
Member

@dustymabe dustymabe Aug 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know you have some opposition to this so I'll say:

optional: mention exclusive=false here

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, my rationale against the duplicate comments is covered in coreos/coreos-assembler#3060 and coreos/coreos-assembler#3059

# - 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;;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should actually error here if an unknown vendor pops up?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean an unknown ID right? We could, but it seems unnecessarily painful for e.g. someone who is creating a *coreos derivative and wants to run our tests.

I didn't want to scope in looking at c9s, partially because based on active discussions it seems highly likely we may end up e.g. using a COPR or a SIG repo at some point, and we don't need to be strict.

Copy link
Member

@dustymabe dustymabe Aug 31, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's fair.. one counter is to make this run on distros of fcos and rhcos so this test won't even run on others?

still this is fine as is if we don't want to do that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

esac

cd $(mktemp -d)
rpm -qa --queryformat='%{name},%{vendor}\n' > rpmvendors.txt
if grep -vF ",${vendor}" rpmvendors.txt > unmatched.txt; then
cat unmatched.txt
cgwalters marked this conversation as resolved.
Show resolved Hide resolved
fatal "Expected only vendor ${vendor} for all packages"
fi
echo "ok all RPMs produced by Vendor: ${vendor}"

cgwalters marked this conversation as resolved.
Show resolved Hide resolved