diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5e1de1dbb..5ef8e3452 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -200,21 +200,6 @@ Base: - aws/centos-stream-9-aarch64 INTERNAL_NETWORK: ["true"] -Manifests: - stage: test - extends: .terraform - rules: - - !reference [.upstream_rules_all, rules] - - !reference [.nightly_rules_all, rules] - script: - - schutzbot/deploy.sh - - /usr/libexec/tests/osbuild-composer/manifest_tests.sh - parallel: - matrix: - - RUNNER: - - aws/rhel-9.3-nightly-x86_64 - INTERNAL_NETWORK: ["true"] - .regression: stage: test extends: .terraform diff --git a/Makefile b/Makefile index f371da4cd..8fada5a72 100644 --- a/Makefile +++ b/Makefile @@ -127,7 +127,6 @@ build: go test -c -tags=integration -o bin/osbuild-koji-tests ./cmd/osbuild-koji-tests/ go test -c -tags=integration -o bin/osbuild-composer-dbjobqueue-tests ./cmd/osbuild-composer-dbjobqueue-tests/ go test -c -tags=integration -o bin/osbuild-composer-maintenance-tests ./cmd/osbuild-service-maintenance/ - go test -c -tags=integration -o bin/osbuild-composer-manifest-tests ./cmd/osbuild-composer-manifest-tests/ .PHONY: install install: diff --git a/cmd/osbuild-composer-manifest-tests/main_test.go b/cmd/osbuild-composer-manifest-tests/main_test.go deleted file mode 100644 index 8e88d0aa8..000000000 --- a/cmd/osbuild-composer-manifest-tests/main_test.go +++ /dev/null @@ -1,75 +0,0 @@ -//go:build integration - -package main - -import ( - "flag" - "fmt" - "os" - "path/filepath" - "strings" - "testing" - - "github.com/osbuild/images/pkg/distro/distro_test_common" - "github.com/osbuild/images/pkg/distroregistry" - "github.com/stretchr/testify/assert" - "github.com/stretchr/testify/require" -) - -var manifestsPath string -var dnfJsonPath string -var testCaseGlob string - -func init() { - flag.StringVar(&manifestsPath, "manifests-path", "/usr/share/tests/osbuild-composer/manifests", "path to a directory with *.json files containing image test cases") - flag.StringVar(&dnfJsonPath, "dnf-json-path", "/usr/libexec/osbuild-composer/dnf-json", "path to the 'dnf-json' executable") - flag.StringVar(&testCaseGlob, "test-case-glob", "*", "glob pattern to select image test cases to verify") -} - -func TestManifests(t *testing.T) { - cacheDirPath := "/var/tmp/osbuild-composer-manifest-tests/rpmmd" - err := os.MkdirAll(cacheDirPath, 0755) - require.Nilf(t, err, "failed to create RPMMD cache directory %q", cacheDirPath) - - distro_test_common.TestDistro_Manifest( - t, - manifestsPath, - testCaseGlob, - distroregistry.NewDefault(), - true, - cacheDirPath, - dnfJsonPath, - ) -} - -// TestImageTestCoverage ensures that each defined image type has -// at least one corresponding image test case. -func TestImageTestCoverage(t *testing.T) { - distroRegistry := distroregistry.NewDefault() - for _, distroName := range distroRegistry.List() { - distro := distroRegistry.GetDistro(distroName) - for _, archName := range distro.ListArches() { - missingImgTests := []string{} - arch, err := distro.GetArch(archName) - require.Nilf(t, err, "failed to get arch %q of distro %q, which was returned in the list of available arches", archName, distroName) - for _, imageTypeName := range arch.ListImageTypes() { - imageTypeGlob := fmt.Sprintf( - "%s/%s-%s-%s*.json", - manifestsPath, - strings.ReplaceAll(distroName, "-", "_"), - strings.ReplaceAll(archName, "-", "_"), - strings.ReplaceAll(imageTypeName, "-", "_"), - ) - - testCaseFiles, err := filepath.Glob(imageTypeGlob) - require.Nilf(t, err, "error while globing for image test cases: %v", err) - - if testCaseFiles == nil { - missingImgTests = append(missingImgTests, imageTypeName) - } - } - - assert.Emptyf(t, missingImgTests, "missing image test cases for %q/%q: %v", distroName, archName, missingImgTests) - } - } -} diff --git a/osbuild-composer.spec b/osbuild-composer.spec index 3fd6147a1..c1428df70 100644 --- a/osbuild-composer.spec +++ b/osbuild-composer.spec @@ -114,7 +114,6 @@ go test -c -tags=integration -ldflags="${TEST_LDFLAGS}" -o _bin/osbuild-image-te go test -c -tags=integration -ldflags="${TEST_LDFLAGS}" -o _bin/osbuild-auth-tests %{goipath}/cmd/osbuild-auth-tests go test -c -tags=integration -ldflags="${TEST_LDFLAGS}" -o _bin/osbuild-koji-tests %{goipath}/cmd/osbuild-koji-tests go test -c -tags=integration -ldflags="${TEST_LDFLAGS}" -o _bin/osbuild-composer-dbjobqueue-tests %{goipath}/cmd/osbuild-composer-dbjobqueue-tests -go test -c -tags=integration -ldflags="${TEST_LDFLAGS}" -o _bin/osbuild-composer-manifest-tests %{goipath}/cmd/osbuild-composer-manifest-tests go test -c -tags=integration -ldflags="${TEST_LDFLAGS}" -o _bin/osbuild-service-maintenance-tests %{goipath}/cmd/osbuild-service-maintenance go build -tags=integration -ldflags="${TEST_LDFLAGS}" -o _bin/osbuild-mock-openid-provider %{goipath}/cmd/osbuild-mock-openid-provider @@ -180,7 +179,6 @@ install -m 0755 -vp _bin/osbuild-image-tests %{buildroot}% install -m 0755 -vp _bin/osbuild-auth-tests %{buildroot}%{_libexecdir}/osbuild-composer-test/ install -m 0755 -vp _bin/osbuild-koji-tests %{buildroot}%{_libexecdir}/osbuild-composer-test/ install -m 0755 -vp _bin/osbuild-composer-dbjobqueue-tests %{buildroot}%{_libexecdir}/osbuild-composer-test/ -install -m 0755 -vp _bin/osbuild-composer-manifest-tests %{buildroot}%{_libexecdir}/osbuild-composer-test/ install -m 0755 -vp _bin/osbuild-service-maintenance-tests %{buildroot}%{_libexecdir}/osbuild-composer-test/ install -m 0755 -vp _bin/osbuild-mock-openid-provider %{buildroot}%{_libexecdir}/osbuild-composer-test/ install -m 0755 -vp tools/define-compose-url.sh %{buildroot}%{_libexecdir}/osbuild-composer-test/ diff --git a/test/cases/manifest_tests.sh b/test/cases/manifest_tests.sh deleted file mode 100755 index 91f6e8279..000000000 --- a/test/cases/manifest_tests.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -set -euo pipefail - -MANIFEST_TESTS_RUNNER="/usr/libexec/osbuild-composer-test/osbuild-composer-manifest-tests" -DNF_JSON_PATH="/usr/libexec/osbuild-composer/dnf-json" -IMAGE_TEST_CASES_PATH="/usr/share/tests/osbuild-composer/manifests" - -WORKING_DIRECTORY=/usr/libexec/osbuild-composer -ARTIFACTS="${ARTIFACTS:-/tmp/artifacts}" - -# Print out a nice test divider so we know when tests stop and start. -test_divider () { - printf "%0.s-" {1..78} && echo -} - -# Provision the software under test. -/usr/libexec/osbuild-composer-test/provision.sh none - -# Change to the working directory. -cd $WORKING_DIRECTORY - -# Run test case. -TEST_NAME=$(basename "$MANIFEST_TESTS_RUNNER") -echo -test_divider -echo "🏃🏻 Running test: ${TEST_NAME}" -test_divider - -if sudo "$MANIFEST_TESTS_RUNNER" -test.v -manifests-path "$IMAGE_TEST_CASES_PATH" -dnf-json-path "$DNF_JSON_PATH" | tee "${ARTIFACTS}"/"${TEST_NAME}".log; then - echo "🎉 Test passed." - exit 0 -else - echo "🔥 Test failed." - exit 1 -fi