Skip to content

Commit

Permalink
test: update all calls to image-info
Browse files Browse the repository at this point in the history
Call the script without a path since it's now in the PATH.

In osbuild-image-tests, we set it to /usr/sbin/osbuild-image-info, which
will be the new location soon [1].

Drop the SELinux labelling workaround (chcon) from filesystem.sh and
image_tests.sh.  The packaged tool is already labelled correctly.

[1] osbuild/osbuild#1970
  • Loading branch information
achilleas-k committed Jan 30, 2025
1 parent 2391f05 commit 24e4c7b
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 14 deletions.
4 changes: 2 additions & 2 deletions cmd/osbuild-image-tests/constants/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ func GetOsbuildCommand(store, outputDirectory string, exports []string) *exec.Cm

func GetImageInfoCommand(imagePath string) *exec.Cmd {
return exec.Command(
"/usr/libexec/osbuild-composer-test/image-info",
"osbuild-image-info",
imagePath,
)
}
Expand All @@ -34,7 +34,7 @@ var TestPaths = struct {
MetaData string
AzureDeploymentTemplate string
}{
ImageInfo: "/usr/libexec/osbuild-composer-test/image-info",
ImageInfo: "osbuild-image-info",
PrivateKey: "/usr/share/tests/osbuild-composer/keyring/id_rsa",
TestCasesDirectory: "/usr/share/tests/osbuild-composer/manifests",
UserData: "/usr/share/tests/osbuild-composer/cloud-init/user-data",
Expand Down
2 changes: 1 addition & 1 deletion test/cases/api/common/s3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ function verifyDisk() {
greenprint "Verifying contents of ${filename}"

infofile="${filename}-info.json"
sudo /usr/libexec/osbuild-composer-test/image-info "${filename}" | tee "${infofile}" > /dev/null
sudo osbuild-image-info "${filename}" | tee "${infofile}" > /dev/null

# save image info to artifacts
cp -v "${infofile}" "${ARTIFACTS}/image-info.json"
Expand Down
2 changes: 1 addition & 1 deletion test/cases/container-embedding.sh
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ sudo composer-cli compose image "${COMPOSE_ID}" > /dev/null
IMAGE_FILENAME="${COMPOSE_ID}-disk.qcow2"

greenprint "💬 Checking that image exists"
INFO="$(sudo /usr/libexec/osbuild-composer-test/image-info "${IMAGE_FILENAME}")"
INFO="$(sudo osbuild-image-info "${IMAGE_FILENAME}")"

IMAGE_ID="d4ee87dab8193afad523b1042b9d3f5ec887555a704e5aaec2876798ebb585a6"
FEDORA_CONTAINER_EXISTS=$(jq -e --arg id "${IMAGE_ID}" 'any(."container-images" | select(. != null and .[].Id == $id); .)' <<< "${INFO}")
Expand Down
6 changes: 1 addition & 5 deletions test/cases/filesystem.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ function cleanup_on_exit() {
}
trap cleanup_on_exit EXIT

# Workaround the problem that 'image-info' can not read SELinux labels unknown to the host from the image
OSBUILD_LABEL=$(matchpathcon -n "$(type -p osbuild)")
sudo chcon "$OSBUILD_LABEL" /usr/libexec/osbuild-composer-test/image-info

# Build ostree image.
build_image() {
blueprint_file=$1
Expand Down Expand Up @@ -204,7 +200,7 @@ sudo composer-cli compose image "${COMPOSE_ID}" > /dev/null
IMAGE_FILENAME="${COMPOSE_ID}-disk.qcow2"

greenprint "💬 Checking mountpoints"
if ! INFO="$(sudo /usr/libexec/osbuild-composer-test/image-info "${IMAGE_FILENAME}")"; then
if ! INFO="$(sudo osbuild-image-info "${IMAGE_FILENAME}")"; then
echo "ERROR image-info failed, show last few kernel message to debug"
dmesg | tail -n10
exit 2
Expand Down
4 changes: 0 additions & 4 deletions test/cases/image_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,6 @@ run_test_case () {
# Change to the working directory.
cd $WORKING_DIRECTORY

# Workaround the problem that 'image-info' can not read SELinux labels unknown to the host from the image
OSBUILD_LABEL=$(matchpathcon -n "$(type -p osbuild)")
sudo chcon "$OSBUILD_LABEL" /usr/libexec/osbuild-composer-test/image-info

# Run each test case.
for TEST_CASE in $(get_test_cases); do
run_test_case "$IMAGE_TEST_CASE_RUNNER" "$TEST_CASE"
Expand Down
2 changes: 1 addition & 1 deletion test/cases/regression-old-worker-new-composer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,7 @@ function verifyDisk() {
greenprint "Verifying contents of ${filename}"

infofile="${filename}-info.json"
sudo /usr/libexec/osbuild-composer-test/image-info "${filename}" | tee "${infofile}" > /dev/null
sudo osbuild-image-info "${filename}" | tee "${infofile}" > /dev/null

# save image info to artifacts
cp -v "${infofile}" "${ARTIFACTS}/image-info.json"
Expand Down

0 comments on commit 24e4c7b

Please sign in to comment.