Test all manifests with depsolved package sets
Generated image test case manifests for all supported distros, arches and image-types are being tested as part of distro unit tests. However due to time constrains, the unit test does not depsolve the image's default package sets and thus does not check if they changed in the internal osbuild-composer's representation, compared to the generated image test case. Extend the `TestDistro_Manifest()` function used by the unit test to allow depsolving image's package sets. Introduce a new test case binary `osbuild-composer-manifest-tests` allowing to check the manifests generated by composer for all supported combinations of images against generated manifests, including depsolving image's default package sets. Introduce a new CI test case `manifest_tests.sh` executing the `osbuild-composer-manifest-tests` binary and testing all existing image test cases. Run it in CI on RHEL-9 runner. Modify SPEC file to ship the newly added test case. Signed-off-by: Tomas Hozza <thozza@redhat.com>
This commit is contained in:
parent
0712ed9700
commit
c5a4946135
7 changed files with 142 additions and 5 deletions
39
cmd/osbuild-composer-manifest-tests/main_test.go
Normal file
39
cmd/osbuild-composer-manifest-tests/main_test.go
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
// +build integration
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
"github.com/osbuild/osbuild-composer/internal/distro/distro_test_common"
|
||||
"github.com/osbuild/osbuild-composer/internal/distroregistry"
|
||||
"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,
|
||||
)
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue