diff --git a/cmd/osbuild-image-tests/constants/constants.go b/cmd/osbuild-image-tests/constants/constants.go index bedf04ccf..2892c408b 100644 --- a/cmd/osbuild-image-tests/constants/constants.go +++ b/cmd/osbuild-image-tests/constants/constants.go @@ -16,7 +16,7 @@ func GetOsbuildCommand(store, outputDirectory string) *exec.Cmd { func GetImageInfoCommand(imagePath string) *exec.Cmd { return exec.Command( - "/usr/libexec/osbuild-composer/image-info", + "/usr/libexec/osbuild-composer-test/image-info", imagePath, ) } @@ -29,7 +29,7 @@ var TestPaths = struct { MetaData string AzureDeploymentTemplate string }{ - ImageInfo: "/usr/libexec/osbuild-composer/image-info", + ImageInfo: "/usr/libexec/osbuild-composer-test/image-info", PrivateKey: "/usr/share/tests/osbuild-composer/keyring/id_rsa", TestCasesDirectory: "/usr/share/tests/osbuild-composer/cases", UserData: "/usr/share/tests/osbuild-composer/cloud-init/user-data", diff --git a/internal/distro/distro_test.go b/internal/distro/distro_test.go index 48bbb88c1..e1f59b31f 100644 --- a/internal/distro/distro_test.go +++ b/internal/distro/distro_test.go @@ -15,7 +15,7 @@ import ( func TestDistro_Manifest(t *testing.T) { distro_test_common.TestDistro_Manifest( t, - "../../test/data/cases/", + "../../test/data/manifests/", "*", fedora32.New(), fedora33.New(), rhel8.New(), ) diff --git a/internal/distro/fedora32/distro_test.go b/internal/distro/fedora32/distro_test.go index 6a204e0be..144b83eb3 100644 --- a/internal/distro/fedora32/distro_test.go +++ b/internal/distro/fedora32/distro_test.go @@ -288,7 +288,7 @@ func TestImageType_BasePackages(t *testing.T) { } func TestDistro_Manifest(t *testing.T) { - distro_test_common.TestDistro_Manifest(t, "../../../test/data/cases/", "fedora_32*", fedora32.New()) + distro_test_common.TestDistro_Manifest(t, "../../../test/data/manifests/", "fedora_32*", fedora32.New()) } func TestFedora32_ListArches(t *testing.T) { diff --git a/internal/distro/fedora33/distro_test.go b/internal/distro/fedora33/distro_test.go index 273205155..15c458958 100644 --- a/internal/distro/fedora33/distro_test.go +++ b/internal/distro/fedora33/distro_test.go @@ -294,7 +294,7 @@ func TestImageType_BasePackages(t *testing.T) { } func TestDistro_Manifest(t *testing.T) { - distro_test_common.TestDistro_Manifest(t, "../../../test/data/cases/", "fedora_33*", fedora33.New()) + distro_test_common.TestDistro_Manifest(t, "../../../test/data/manifests/", "fedora_33*", fedora33.New()) } func TestFedora33_ListArches(t *testing.T) { diff --git a/internal/distro/rhel8/distro_test.go b/internal/distro/rhel8/distro_test.go index d8a852b61..b4fb0683b 100644 --- a/internal/distro/rhel8/distro_test.go +++ b/internal/distro/rhel8/distro_test.go @@ -347,7 +347,7 @@ func TestImageType_BasePackages(t *testing.T) { } func TestDistro_Manifest(t *testing.T) { - distro_test_common.TestDistro_Manifest(t, "../../../test/data/cases/", "rhel_8*", rhel8.New()) + distro_test_common.TestDistro_Manifest(t, "../../../test/data/manifests/", "rhel_8*", rhel8.New()) } func TestRhel8_ListArches(t *testing.T) { diff --git a/osbuild-composer.spec b/osbuild-composer.spec index d85c3fb0f..c65465059 100644 --- a/osbuild-composer.spec +++ b/osbuild-composer.spec @@ -169,17 +169,18 @@ install -m 0755 -vd %{buildroot}%{_l %if %{with tests} || 0%{?rhel} +install -m 0755 -vd %{buildroot}%{_libexecdir}/osbuild-composer-test +install -m 0755 -vp _bin/osbuild-composer-cli-tests %{buildroot}%{_libexecdir}/osbuild-composer-test/ +install -m 0755 -vp _bin/osbuild-weldr-tests %{buildroot}%{_libexecdir}/osbuild-composer-test/ +install -m 0755 -vp _bin/osbuild-dnf-json-tests %{buildroot}%{_libexecdir}/osbuild-composer-test/ +install -m 0755 -vp _bin/osbuild-image-tests %{buildroot}%{_libexecdir}/osbuild-composer-test/ +install -m 0755 -vp _bin/osbuild-auth-tests %{buildroot}%{_libexecdir}/osbuild-composer-test/ +install -m 0755 -vp _bin/cloud-cleaner %{buildroot}%{_libexecdir}/osbuild-composer-test/ +install -m 0755 -vp tools/image-info %{buildroot}%{_libexecdir}/osbuild-composer-test/ +install -m 0755 -vp tools/run-koji-container.sh %{buildroot}%{_libexecdir}/osbuild-composer-test/ +install -m 0755 -vp tools/koji-compose.py %{buildroot}%{_libexecdir}/osbuild-composer-test/ install -m 0755 -vd %{buildroot}%{_libexecdir}/tests/osbuild-composer -install -m 0755 -vp _bin/osbuild-composer-cli-tests %{buildroot}%{_libexecdir}/tests/osbuild-composer/ -install -m 0755 -vp _bin/osbuild-weldr-tests %{buildroot}%{_libexecdir}/tests/osbuild-composer/ -install -m 0755 -vp _bin/osbuild-dnf-json-tests %{buildroot}%{_libexecdir}/tests/osbuild-composer/ -install -m 0755 -vp _bin/osbuild-image-tests %{buildroot}%{_libexecdir}/tests/osbuild-composer/ -install -m 0755 -vp _bin/osbuild-auth-tests %{buildroot}%{_libexecdir}/tests/osbuild-composer/ -install -m 0755 -vp test/cmd/* %{buildroot}%{_libexecdir}/tests/osbuild-composer/ -install -m 0755 -vp _bin/cloud-cleaner %{buildroot}%{_libexecdir}/osbuild-composer/ -install -m 0755 -vp tools/image-info %{buildroot}%{_libexecdir}/osbuild-composer/ -install -m 0755 -vp tools/run-koji-container.sh %{buildroot}%{_libexecdir}/osbuild-composer/ -install -m 0755 -vp tools/koji-compose.py %{buildroot}%{_libexecdir}/osbuild-composer/ +install -m 0755 -vp test/cases/* %{buildroot}%{_libexecdir}/tests/osbuild-composer/ install -m 0755 -vd %{buildroot}%{_datadir}/tests/osbuild-composer/ansible install -m 0644 -vp test/data/ansible/* %{buildroot}%{_datadir}/tests/osbuild-composer/ansible/ @@ -199,8 +200,8 @@ install -m 0600 -vp test/data/ca/worker-key.pem %{buildroot}%{_d install -m 0644 -vp test/data/ca/client-crt.pem %{buildroot}%{_datadir}/tests/osbuild-composer/ca/ install -m 0644 -vp test/data/ca/client-key.pem %{buildroot}%{_datadir}/tests/osbuild-composer/ca/ -install -m 0755 -vd %{buildroot}%{_datadir}/tests/osbuild-composer/cases -install -m 0644 -vp test/data/cases/* %{buildroot}%{_datadir}/tests/osbuild-composer/cases/ +install -m 0755 -vd %{buildroot}%{_datadir}/tests/osbuild-composer/manifests +install -m 0644 -vp test/data/manifests/* %{buildroot}%{_datadir}/tests/osbuild-composer/manifests/ install -m 0755 -vd %{buildroot}%{_datadir}/tests/osbuild-composer/cloud-init install -m 0644 -vp test/data/cloud-init/* %{buildroot}%{_datadir}/tests/osbuild-composer/cloud-init/ @@ -338,12 +339,9 @@ Requires: edk2-aarch64 Integration tests to be run on a pristine-dedicated system to test the osbuild-composer package. %files tests +%{_libexecdir}/osbuild-composer-test/ %{_libexecdir}/tests/osbuild-composer/ %{_datadir}/tests/osbuild-composer/ -%{_libexecdir}/osbuild-composer/cloud-cleaner -%{_libexecdir}/osbuild-composer/image-info -%{_libexecdir}/osbuild-composer/run-koji-container.sh -%{_libexecdir}/osbuild-composer/koji-compose.py %endif diff --git a/schutzbot/run_cloud_cleaner.sh b/schutzbot/run_cloud_cleaner.sh index 1b213d961..4715a91bd 100755 --- a/schutzbot/run_cloud_cleaner.sh +++ b/schutzbot/run_cloud_cleaner.sh @@ -1,7 +1,7 @@ #!/bin/bash set -euo pipefail -CLEANER_CMD="env $(cat "$AZURE_CREDS") BRANCH_NAME=$BRANCH_NAME BUILD_ID=$BUILD_ID DISTRO_CODE=$DISTRO_CODE /usr/libexec/osbuild-composer/cloud-cleaner" +CLEANER_CMD="env $(cat "$AZURE_CREDS") BRANCH_NAME=$BRANCH_NAME BUILD_ID=$BUILD_ID DISTRO_CODE=$DISTRO_CODE /usr/libexec/osbuild-composer-test/cloud-cleaner" echo "🧹 Running the cloud cleaner" $CLEANER_CMD diff --git a/test/README.md b/test/README.md index 8bd8b4ed4..6e3be9ec9 100644 --- a/test/README.md +++ b/test/README.md @@ -5,10 +5,10 @@ in a dedicated RPM: osbulid-composer-tests, and they are meant to be installed onto a pristine system and executed from there, rather than executed from a git checkout. -Some tests are written as golang binaries, found in `cmd/*-test/`, and others -are written as scripts and found in `test/cmd/`. Either way, they are installed -into `/usr/libexec/tests/osbuild-composer/`, and any supporting test-data is -installed into `/usr/share/tests/osbuild-composer/`. +Test cases are found in `test/cases`. They are intended to be independent of +each other and they are installed into `/usr/libexec/tests/osbuild-composer/`, +with any supporting test-data in `/usr/share/tests/osbuild-composer/`, and +helper binaries in `/usr/libexec/osbuild-composer-test/`. Provisioning and orchestration of test-systems, as well as configuring what distros, versions and architectures to test against is out of scope of the diff --git a/test/cmd/api.sh b/test/cases/api.sh similarity index 100% rename from test/cmd/api.sh rename to test/cases/api.sh diff --git a/test/cmd/aws.sh b/test/cases/aws.sh similarity index 100% rename from test/cmd/aws.sh rename to test/cases/aws.sh diff --git a/test/cmd/base_tests.sh b/test/cases/base_tests.sh similarity index 96% rename from test/cmd/base_tests.sh rename to test/cases/base_tests.sh index c3c373674..a5d9f4cc8 100755 --- a/test/cmd/base_tests.sh +++ b/test/cases/base_tests.sh @@ -2,7 +2,7 @@ set -euo pipefail WORKING_DIRECTORY=/usr/libexec/osbuild-composer -TESTS_PATH=/usr/libexec/tests/osbuild-composer +TESTS_PATH=/usr/libexec/osbuild-composer-test PASSED_TESTS=() FAILED_TESTS=() diff --git a/test/cmd/image_tests.sh b/test/cases/image_tests.sh similarity index 95% rename from test/cmd/image_tests.sh rename to test/cases/image_tests.sh index ca6bdcc3d..715c96cd7 100755 --- a/test/cmd/image_tests.sh +++ b/test/cases/image_tests.sh @@ -6,8 +6,8 @@ source /etc/os-release ARCH=$(uname -m) WORKING_DIRECTORY=/usr/libexec/osbuild-composer -IMAGE_TEST_CASE_RUNNER=/usr/libexec/tests/osbuild-composer/osbuild-image-tests -IMAGE_TEST_CASES_PATH=/usr/share/tests/osbuild-composer/cases +IMAGE_TEST_CASE_RUNNER=/usr/libexec/osbuild-composer-test/osbuild-image-tests +IMAGE_TEST_CASES_PATH=/usr/share/tests/osbuild-composer/manifests PASSED_TESTS=() FAILED_TESTS=() diff --git a/test/cmd/koji.sh b/test/cases/koji.sh similarity index 91% rename from test/cmd/koji.sh rename to test/cases/koji.sh index e7c93d1b2..59b8abe48 100755 --- a/test/cmd/koji.sh +++ b/test/cases/koji.sh @@ -25,7 +25,7 @@ if [[ $ID == rhel ]]; then fi greenprint "Starting containers" -sudo /usr/libexec/osbuild-composer/run-koji-container.sh start +sudo /usr/libexec/osbuild-composer-test/run-koji-container.sh start greenprint "Copying custom worker config" sudo mkdir -p /etc/osbuild-worker @@ -60,14 +60,14 @@ greenprint "Creating Koji task" koji --server=http://localhost:8080/kojihub --user kojiadmin --password kojipass --authtype=password make-task image greenprint "Pushing compose to Koji" -sudo /usr/libexec/osbuild-composer/koji-compose.py "${ID}-${VERSION_ID%.*}" +sudo /usr/libexec/osbuild-composer-test/koji-compose.py "${ID}-${VERSION_ID%.*}" greenprint "Show Koji task" koji --server=http://localhost:8080/kojihub taskinfo 1 koji --server=http://localhost:8080/kojihub buildinfo 1 greenprint "Stopping containers" -sudo /usr/libexec/osbuild-composer/run-koji-container.sh stop +sudo /usr/libexec/osbuild-composer-test/run-koji-container.sh stop greenprint "Removing generated CA cert" sudo rm \ diff --git a/test/cmd/ostree.sh b/test/cases/ostree.sh similarity index 100% rename from test/cmd/ostree.sh rename to test/cases/ostree.sh diff --git a/test/cmd/qemu.sh b/test/cases/qemu.sh similarity index 100% rename from test/cmd/qemu.sh rename to test/cases/qemu.sh diff --git a/test/data/cases/fedora_32-aarch64-ami-boot.json b/test/data/manifests/fedora_32-aarch64-ami-boot.json similarity index 100% rename from test/data/cases/fedora_32-aarch64-ami-boot.json rename to test/data/manifests/fedora_32-aarch64-ami-boot.json diff --git a/test/data/cases/fedora_32-aarch64-openstack-boot.json b/test/data/manifests/fedora_32-aarch64-openstack-boot.json similarity index 100% rename from test/data/cases/fedora_32-aarch64-openstack-boot.json rename to test/data/manifests/fedora_32-aarch64-openstack-boot.json diff --git a/test/data/cases/fedora_32-aarch64-qcow2-boot.json b/test/data/manifests/fedora_32-aarch64-qcow2-boot.json similarity index 100% rename from test/data/cases/fedora_32-aarch64-qcow2-boot.json rename to test/data/manifests/fedora_32-aarch64-qcow2-boot.json diff --git a/test/data/cases/fedora_32-x86_64-ami-boot.json b/test/data/manifests/fedora_32-x86_64-ami-boot.json similarity index 100% rename from test/data/cases/fedora_32-x86_64-ami-boot.json rename to test/data/manifests/fedora_32-x86_64-ami-boot.json diff --git a/test/data/cases/fedora_32-x86_64-fedora_iot_commit-boot.json b/test/data/manifests/fedora_32-x86_64-fedora_iot_commit-boot.json similarity index 100% rename from test/data/cases/fedora_32-x86_64-fedora_iot_commit-boot.json rename to test/data/manifests/fedora_32-x86_64-fedora_iot_commit-boot.json diff --git a/test/data/cases/fedora_32-x86_64-openstack-boot.json b/test/data/manifests/fedora_32-x86_64-openstack-boot.json similarity index 100% rename from test/data/cases/fedora_32-x86_64-openstack-boot.json rename to test/data/manifests/fedora_32-x86_64-openstack-boot.json diff --git a/test/data/cases/fedora_32-x86_64-qcow2-boot.json b/test/data/manifests/fedora_32-x86_64-qcow2-boot.json similarity index 100% rename from test/data/cases/fedora_32-x86_64-qcow2-boot.json rename to test/data/manifests/fedora_32-x86_64-qcow2-boot.json diff --git a/test/data/cases/fedora_32-x86_64-qcow2-customize.json b/test/data/manifests/fedora_32-x86_64-qcow2-customize.json similarity index 100% rename from test/data/cases/fedora_32-x86_64-qcow2-customize.json rename to test/data/manifests/fedora_32-x86_64-qcow2-customize.json diff --git a/test/data/cases/fedora_32-x86_64-vhd-boot.json b/test/data/manifests/fedora_32-x86_64-vhd-boot.json similarity index 100% rename from test/data/cases/fedora_32-x86_64-vhd-boot.json rename to test/data/manifests/fedora_32-x86_64-vhd-boot.json diff --git a/test/data/cases/fedora_32-x86_64-vmdk-boot.json b/test/data/manifests/fedora_32-x86_64-vmdk-boot.json similarity index 100% rename from test/data/cases/fedora_32-x86_64-vmdk-boot.json rename to test/data/manifests/fedora_32-x86_64-vmdk-boot.json diff --git a/test/data/cases/fedora_33-x86_64-ami-boot.json b/test/data/manifests/fedora_33-x86_64-ami-boot.json similarity index 100% rename from test/data/cases/fedora_33-x86_64-ami-boot.json rename to test/data/manifests/fedora_33-x86_64-ami-boot.json diff --git a/test/data/cases/fedora_33-x86_64-openstack-boot.json b/test/data/manifests/fedora_33-x86_64-openstack-boot.json similarity index 100% rename from test/data/cases/fedora_33-x86_64-openstack-boot.json rename to test/data/manifests/fedora_33-x86_64-openstack-boot.json diff --git a/test/data/cases/fedora_33-x86_64-qcow2-boot.json b/test/data/manifests/fedora_33-x86_64-qcow2-boot.json similarity index 100% rename from test/data/cases/fedora_33-x86_64-qcow2-boot.json rename to test/data/manifests/fedora_33-x86_64-qcow2-boot.json diff --git a/test/data/cases/fedora_33-x86_64-qcow2-customize.json b/test/data/manifests/fedora_33-x86_64-qcow2-customize.json similarity index 100% rename from test/data/cases/fedora_33-x86_64-qcow2-customize.json rename to test/data/manifests/fedora_33-x86_64-qcow2-customize.json diff --git a/test/data/cases/fedora_33-x86_64-vhd-boot.json b/test/data/manifests/fedora_33-x86_64-vhd-boot.json similarity index 100% rename from test/data/cases/fedora_33-x86_64-vhd-boot.json rename to test/data/manifests/fedora_33-x86_64-vhd-boot.json diff --git a/test/data/cases/fedora_33-x86_64-vmdk-boot.json b/test/data/manifests/fedora_33-x86_64-vmdk-boot.json similarity index 100% rename from test/data/cases/fedora_33-x86_64-vmdk-boot.json rename to test/data/manifests/fedora_33-x86_64-vmdk-boot.json diff --git a/test/data/cases/rhel_8-aarch64-ami-boot.json b/test/data/manifests/rhel_8-aarch64-ami-boot.json similarity index 100% rename from test/data/cases/rhel_8-aarch64-ami-boot.json rename to test/data/manifests/rhel_8-aarch64-ami-boot.json diff --git a/test/data/cases/rhel_8-aarch64-openstack-boot.json b/test/data/manifests/rhel_8-aarch64-openstack-boot.json similarity index 100% rename from test/data/cases/rhel_8-aarch64-openstack-boot.json rename to test/data/manifests/rhel_8-aarch64-openstack-boot.json diff --git a/test/data/cases/rhel_8-aarch64-qcow2-boot.json b/test/data/manifests/rhel_8-aarch64-qcow2-boot.json similarity index 100% rename from test/data/cases/rhel_8-aarch64-qcow2-boot.json rename to test/data/manifests/rhel_8-aarch64-qcow2-boot.json diff --git a/test/data/cases/rhel_8-aarch64-rhel_edge_commit-boot.json b/test/data/manifests/rhel_8-aarch64-rhel_edge_commit-boot.json similarity index 100% rename from test/data/cases/rhel_8-aarch64-rhel_edge_commit-boot.json rename to test/data/manifests/rhel_8-aarch64-rhel_edge_commit-boot.json diff --git a/test/data/cases/rhel_8-aarch64-tar-boot.json b/test/data/manifests/rhel_8-aarch64-tar-boot.json similarity index 100% rename from test/data/cases/rhel_8-aarch64-tar-boot.json rename to test/data/manifests/rhel_8-aarch64-tar-boot.json diff --git a/test/data/cases/rhel_8-ppc64le-qcow2-boot.json b/test/data/manifests/rhel_8-ppc64le-qcow2-boot.json similarity index 100% rename from test/data/cases/rhel_8-ppc64le-qcow2-boot.json rename to test/data/manifests/rhel_8-ppc64le-qcow2-boot.json diff --git a/test/data/cases/rhel_8-ppc64le-tar-boot.json b/test/data/manifests/rhel_8-ppc64le-tar-boot.json similarity index 100% rename from test/data/cases/rhel_8-ppc64le-tar-boot.json rename to test/data/manifests/rhel_8-ppc64le-tar-boot.json diff --git a/test/data/cases/rhel_8-s390x-qcow2-boot.json b/test/data/manifests/rhel_8-s390x-qcow2-boot.json similarity index 100% rename from test/data/cases/rhel_8-s390x-qcow2-boot.json rename to test/data/manifests/rhel_8-s390x-qcow2-boot.json diff --git a/test/data/cases/rhel_8-s390x-tar-boot.json b/test/data/manifests/rhel_8-s390x-tar-boot.json similarity index 100% rename from test/data/cases/rhel_8-s390x-tar-boot.json rename to test/data/manifests/rhel_8-s390x-tar-boot.json diff --git a/test/data/cases/rhel_8-x86_64-ami-boot.json b/test/data/manifests/rhel_8-x86_64-ami-boot.json similarity index 100% rename from test/data/cases/rhel_8-x86_64-ami-boot.json rename to test/data/manifests/rhel_8-x86_64-ami-boot.json diff --git a/test/data/cases/rhel_8-x86_64-openstack-boot.json b/test/data/manifests/rhel_8-x86_64-openstack-boot.json similarity index 100% rename from test/data/cases/rhel_8-x86_64-openstack-boot.json rename to test/data/manifests/rhel_8-x86_64-openstack-boot.json diff --git a/test/data/cases/rhel_8-x86_64-qcow2-boot.json b/test/data/manifests/rhel_8-x86_64-qcow2-boot.json similarity index 100% rename from test/data/cases/rhel_8-x86_64-qcow2-boot.json rename to test/data/manifests/rhel_8-x86_64-qcow2-boot.json diff --git a/test/data/cases/rhel_8-x86_64-qcow2-customize.json b/test/data/manifests/rhel_8-x86_64-qcow2-customize.json similarity index 100% rename from test/data/cases/rhel_8-x86_64-qcow2-customize.json rename to test/data/manifests/rhel_8-x86_64-qcow2-customize.json diff --git a/test/data/cases/rhel_8-x86_64-rhel_edge_commit-boot.json b/test/data/manifests/rhel_8-x86_64-rhel_edge_commit-boot.json similarity index 100% rename from test/data/cases/rhel_8-x86_64-rhel_edge_commit-boot.json rename to test/data/manifests/rhel_8-x86_64-rhel_edge_commit-boot.json diff --git a/test/data/cases/rhel_8-x86_64-tar-boot.json b/test/data/manifests/rhel_8-x86_64-tar-boot.json similarity index 100% rename from test/data/cases/rhel_8-x86_64-tar-boot.json rename to test/data/manifests/rhel_8-x86_64-tar-boot.json diff --git a/test/data/cases/rhel_8-x86_64-vhd-boot.json b/test/data/manifests/rhel_8-x86_64-vhd-boot.json similarity index 100% rename from test/data/cases/rhel_8-x86_64-vhd-boot.json rename to test/data/manifests/rhel_8-x86_64-vhd-boot.json diff --git a/test/data/cases/rhel_8-x86_64-vmdk-boot.json b/test/data/manifests/rhel_8-x86_64-vmdk-boot.json similarity index 100% rename from test/data/cases/rhel_8-x86_64-vmdk-boot.json rename to test/data/manifests/rhel_8-x86_64-vmdk-boot.json