Remove test that depends on removed code from images

Manifest tests can no longer run and also aren't needed.
All image type manifests are generated and built in the obsuild/images
CI tests and the test function in images
(distro_test_common.TestDistro_Manifest()) has been removed.
This commit is contained in:
Achilleas Koutsou 2023-07-18 14:43:29 +02:00 committed by Ondřej Budai
parent 5c292c61c6
commit 3bbcc8a7cc
5 changed files with 0 additions and 128 deletions

View file

@ -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

View file

@ -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:

View file

@ -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)
}
}
}

View file

@ -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/

View file

@ -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