distro: remove usage of ImageType.PackageSets() from tests
Use the new manifest generation procedure in the distro tests. Use assert instead of require in TestImageTypePipelineNames to continue running the rest of the subtests after a failure. Some initialisations (image options and blueprint customizations) had to be adjusted to work with the ImageType.Manifest() function. Some helper functions in distro_test_common are no longer necessary and have been removed. The TestPipelineRepositories and TestImageTypePipelineNames tests must be (partially) skipped for image types which specify a workload (currently only azure-eap7-rhui), because they ignore payload repositories.
This commit is contained in:
parent
d0ba17cfe1
commit
b24a8cdcf5
6 changed files with 95 additions and 115 deletions
|
|
@ -44,13 +44,25 @@ func TestImageType_PackageSetsChains(t *testing.T) {
|
||||||
imageType, err := arch.GetImageType(imageTypeName)
|
imageType, err := arch.GetImageType(imageTypeName)
|
||||||
require.Nil(t, err)
|
require.Nil(t, err)
|
||||||
|
|
||||||
imagePkgSets := imageType.PackageSets(blueprint.Blueprint{}, distro.ImageOptions{
|
// set up bare minimum args for image type
|
||||||
|
var customizations *blueprint.Customizations
|
||||||
|
if imageType.Name() == "edge-simplified-installer" {
|
||||||
|
customizations = &blueprint.Customizations{
|
||||||
|
InstallationDevice: "/dev/null",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
bp := blueprint.Blueprint{
|
||||||
|
Customizations: customizations,
|
||||||
|
}
|
||||||
|
manifest, _, err := imageType.Manifest(&bp, distro.ImageOptions{
|
||||||
OSTree: &ostree.ImageOptions{
|
OSTree: &ostree.ImageOptions{
|
||||||
URL: "foo",
|
URL: "foo",
|
||||||
ImageRef: "bar",
|
ImageRef: "bar",
|
||||||
FetchChecksum: "baz",
|
FetchChecksum: "baz",
|
||||||
},
|
},
|
||||||
}, nil)
|
}, nil, nil, nil, 0)
|
||||||
|
require.NoError(t, err)
|
||||||
|
imagePkgSets := manifest.Content.PackageSets
|
||||||
for packageSetName := range imageType.PackageSetsChains() {
|
for packageSetName := range imageType.PackageSetsChains() {
|
||||||
_, ok := imagePkgSets[packageSetName]
|
_, ok := imagePkgSets[packageSetName]
|
||||||
if !ok {
|
if !ok {
|
||||||
|
|
@ -96,17 +108,17 @@ func TestImageTypePipelineNames(t *testing.T) {
|
||||||
Pipelines []pipeline `json:"pipelines"`
|
Pipelines []pipeline `json:"pipelines"`
|
||||||
}
|
}
|
||||||
|
|
||||||
require := require.New(t)
|
assert := assert.New(t)
|
||||||
distros := distroregistry.NewDefault()
|
distros := distroregistry.NewDefault()
|
||||||
for _, distroName := range distros.List() {
|
for _, distroName := range distros.List() {
|
||||||
d := distros.GetDistro(distroName)
|
d := distros.GetDistro(distroName)
|
||||||
for _, archName := range d.ListArches() {
|
for _, archName := range d.ListArches() {
|
||||||
arch, err := d.GetArch(archName)
|
arch, err := d.GetArch(archName)
|
||||||
require.Nil(err)
|
assert.Nil(err)
|
||||||
for _, imageTypeName := range arch.ListImageTypes() {
|
for _, imageTypeName := range arch.ListImageTypes() {
|
||||||
t.Run(fmt.Sprintf("%s/%s/%s", distroName, archName, imageTypeName), func(t *testing.T) {
|
t.Run(fmt.Sprintf("%s/%s/%s", distroName, archName, imageTypeName), func(t *testing.T) {
|
||||||
imageType, err := arch.GetImageType(imageTypeName)
|
imageType, err := arch.GetImageType(imageTypeName)
|
||||||
require.Nil(err)
|
assert.Nil(err)
|
||||||
|
|
||||||
// set up bare minimum args for image type
|
// set up bare minimum args for image type
|
||||||
var customizations *blueprint.Customizations
|
var customizations *blueprint.Customizations
|
||||||
|
|
@ -155,37 +167,46 @@ func TestImageTypePipelineNames(t *testing.T) {
|
||||||
packageSets[plName] = minimalPackageSet
|
packageSets[plName] = minimalPackageSet
|
||||||
}
|
}
|
||||||
|
|
||||||
m, _, err := imageType.Manifest(&bp, options, repos, packageSets, containers, seed)
|
m, _, err := imageType.Manifest(&bp, options, repos, nil, containers, seed)
|
||||||
require.NoError(err)
|
assert.NoError(err)
|
||||||
mf, err := m.Serialize(packageSets)
|
mf, err := m.Serialize(packageSets)
|
||||||
require.NoError(err)
|
assert.NoError(err)
|
||||||
pm := new(manifest)
|
pm := new(manifest)
|
||||||
err = json.Unmarshal(mf, pm)
|
err = json.Unmarshal(mf, pm)
|
||||||
require.NoError(err)
|
assert.NoError(err)
|
||||||
|
|
||||||
require.Equal(len(allPipelines), len(pm.Pipelines))
|
assert.Equal(len(allPipelines), len(pm.Pipelines))
|
||||||
for idx := range pm.Pipelines {
|
for idx := range pm.Pipelines {
|
||||||
// manifest pipeline names should be identical to the ones
|
// manifest pipeline names should be identical to the ones
|
||||||
// defined in the image type and in the same order
|
// defined in the image type and in the same order
|
||||||
require.Equal(allPipelines[idx], pm.Pipelines[idx].Name)
|
assert.Equal(allPipelines[idx], pm.Pipelines[idx].Name)
|
||||||
|
|
||||||
if pm.Pipelines[idx].Name == "os" {
|
if pm.Pipelines[idx].Name == "os" {
|
||||||
rpmStagePresent := false
|
rpmStagePresent := false
|
||||||
for _, s := range pm.Pipelines[idx].Stages {
|
for _, s := range pm.Pipelines[idx].Stages {
|
||||||
if s.Type == "org.osbuild.rpm" {
|
if s.Type == "org.osbuild.rpm" {
|
||||||
rpmStagePresent = true
|
rpmStagePresent = true
|
||||||
require.Equal(repos[0].GPGKeys, s.Options.GPGKeys)
|
if imageTypeName != "azure-eap7-rhui" {
|
||||||
|
// NOTE (akoutsou): Ideally, at some point we will
|
||||||
|
// have a good way of reading what's supported by
|
||||||
|
// each image type and we can skip or adapt tests
|
||||||
|
// based on this information. For image types with
|
||||||
|
// a preset workload, payload packages are ignored
|
||||||
|
// and dropped and so are the payload
|
||||||
|
// repo gpg keys.
|
||||||
|
assert.Equal(repos[0].GPGKeys, s.Options.GPGKeys)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// make sure the gpg keys check was reached
|
// make sure the gpg keys check was reached
|
||||||
require.True(rpmStagePresent)
|
assert.True(rpmStagePresent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// The last pipeline should match the export pipeline.
|
// The last pipeline should match the export pipeline.
|
||||||
// This might change in the future, but for now, let's make
|
// This might change in the future, but for now, let's make
|
||||||
// sure they match.
|
// sure they match.
|
||||||
require.Equal(imageType.Exports()[0], pm.Pipelines[len(pm.Pipelines)-1].Name)
|
assert.Equal(imageType.Exports()[0], pm.Pipelines[len(pm.Pipelines)-1].Name)
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
@ -395,12 +416,21 @@ func TestPipelineRepositories(t *testing.T) {
|
||||||
arch, err := d.GetArch(archName)
|
arch, err := d.GetArch(archName)
|
||||||
require.Nil(err)
|
require.Nil(err)
|
||||||
for _, imageTypeName := range arch.ListImageTypes() {
|
for _, imageTypeName := range arch.ListImageTypes() {
|
||||||
|
if imageTypeName == "azure-eap7-rhui" {
|
||||||
|
// NOTE (akoutsou): Ideally, at some point we will
|
||||||
|
// have a good way of reading what's supported by
|
||||||
|
// each image type and we can skip or adapt tests
|
||||||
|
// based on this information. For image types with
|
||||||
|
// a preset workload, payload packages are ignored
|
||||||
|
// and dropped.
|
||||||
|
continue
|
||||||
|
}
|
||||||
t.Run(fmt.Sprintf("%s/%s/%s", distroName, archName, imageTypeName), func(t *testing.T) {
|
t.Run(fmt.Sprintf("%s/%s/%s", distroName, archName, imageTypeName), func(t *testing.T) {
|
||||||
imageType, err := arch.GetImageType(imageTypeName)
|
imageType, err := arch.GetImageType(imageTypeName)
|
||||||
require.Nil(err)
|
require.Nil(err)
|
||||||
|
|
||||||
// set up bare minimum args for image type
|
// set up bare minimum args for image type
|
||||||
customizations := &blueprint.Customizations{}
|
var customizations *blueprint.Customizations
|
||||||
if imageType.Name() == "edge-simplified-installer" {
|
if imageType.Name() == "edge-simplified-installer" {
|
||||||
customizations = &blueprint.Customizations{
|
customizations = &blueprint.Customizations{
|
||||||
InstallationDevice: "/dev/null",
|
InstallationDevice: "/dev/null",
|
||||||
|
|
@ -422,7 +452,9 @@ func TestPipelineRepositories(t *testing.T) {
|
||||||
}
|
}
|
||||||
|
|
||||||
repos := tCase.repos
|
repos := tCase.repos
|
||||||
packageSets := imageType.PackageSets(bp, options, repos)
|
manifest, _, err := imageType.Manifest(&bp, options, repos, nil, nil, 0)
|
||||||
|
require.NoError(err)
|
||||||
|
packageSets := manifest.Content.PackageSets
|
||||||
|
|
||||||
var globals stringSet
|
var globals stringSet
|
||||||
if len(tCase.result["*"]) > 0 {
|
if len(tCase.result["*"]) > 0 {
|
||||||
|
|
@ -455,7 +487,6 @@ func TestPipelineRepositories(t *testing.T) {
|
||||||
|
|
||||||
// expected set for current package set should be merged with globals
|
// expected set for current package set should be merged with globals
|
||||||
expected := expChain[setIdx]
|
expected := expChain[setIdx]
|
||||||
|
|
||||||
if !repoNamesSet.Equals(expected) {
|
if !repoNamesSet.Equals(expected) {
|
||||||
t.Errorf("repos for package set %q [idx: %d] %s (distro %q image type %q) do not match expected %s", psName, setIdx, repoNamesSet, d.Name(), imageType.Name(), expected)
|
t.Errorf("repos for package set %q [idx: %d] %s (distro %q image type %q) do not match expected %s", psName, setIdx, repoNamesSet, d.Name(), imageType.Name(), expected)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,11 @@ func TestDistro_Manifest(t *testing.T, pipelinePath string, prefix string, regis
|
||||||
}
|
}
|
||||||
|
|
||||||
func getImageTypePkgSpecSets(imageType distro.ImageType, bp blueprint.Blueprint, options distro.ImageOptions, repos []rpmmd.RepoConfig, cacheDir, dnfJsonPath string) map[string][]rpmmd.PackageSpec {
|
func getImageTypePkgSpecSets(imageType distro.ImageType, bp blueprint.Blueprint, options distro.ImageOptions, repos []rpmmd.RepoConfig, cacheDir, dnfJsonPath string) map[string][]rpmmd.PackageSpec {
|
||||||
imgPackageSets := imageType.PackageSets(bp, options, repos)
|
manifest, _, err := imageType.Manifest(&bp, options, repos, nil, nil, 0)
|
||||||
|
if err != nil {
|
||||||
|
panic("Could not generate manifest for package sets: " + err.Error())
|
||||||
|
}
|
||||||
|
imgPackageSets := manifest.Content.PackageSets
|
||||||
|
|
||||||
solver := dnfjson.NewSolver(imageType.Arch().Distro().ModulePlatformID(),
|
solver := dnfjson.NewSolver(imageType.Arch().Distro().ModulePlatformID(),
|
||||||
imageType.Arch().Distro().Releasever(),
|
imageType.Arch().Distro().Releasever(),
|
||||||
|
|
@ -203,7 +207,16 @@ var knownKernels = []string{"kernel", "kernel-debug", "kernel-rt"}
|
||||||
|
|
||||||
// Returns the number of known kernels in the package list
|
// Returns the number of known kernels in the package list
|
||||||
func kernelCount(imgType distro.ImageType, bp blueprint.Blueprint) int {
|
func kernelCount(imgType distro.ImageType, bp blueprint.Blueprint) int {
|
||||||
sets := imgType.PackageSets(bp, distro.ImageOptions{}, nil)
|
ostreeOptions := &ostree.ImageOptions{
|
||||||
|
URL: "foo",
|
||||||
|
ImageRef: "bar",
|
||||||
|
FetchChecksum: "baz",
|
||||||
|
}
|
||||||
|
manifest, _, err := imgType.Manifest(&bp, distro.ImageOptions{OSTree: ostreeOptions}, nil, nil, nil, 0)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
sets := manifest.Content.PackageSets
|
||||||
|
|
||||||
// Use a map to count unique kernels in a package set. If the same kernel
|
// Use a map to count unique kernels in a package set. If the same kernel
|
||||||
// name appears twice, it will only be installed once, so we only count it
|
// name appears twice, it will only be installed once, so we only count it
|
||||||
|
|
@ -316,55 +329,3 @@ func TestDistro_KernelOption(t *testing.T, d distro.Distro) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetTestingPackageSpecSets returns PackageSpecSets useful for unit testing.
|
|
||||||
//
|
|
||||||
// A dummy PackageSpec for the provided packageName is added
|
|
||||||
// to all PackageSpecSets provided in pkgSetNames.
|
|
||||||
//
|
|
||||||
// E.g. `kernel` package is a hard requirement of some payload pipelines
|
|
||||||
// and they panic if it is not found in the packageSpecSets passed to
|
|
||||||
// Manifest().
|
|
||||||
func GetTestingPackageSpecSets(packageName, arch string, pkgSetNames []string) map[string][]rpmmd.PackageSpec {
|
|
||||||
pkgTestingSpec := []rpmmd.PackageSpec{
|
|
||||||
{
|
|
||||||
Name: packageName,
|
|
||||||
Epoch: 0,
|
|
||||||
Version: "1.2.3",
|
|
||||||
Release: "2.el123",
|
|
||||||
Arch: arch,
|
|
||||||
RemoteLocation: "http://example.org",
|
|
||||||
Checksum: "lorenipsum",
|
|
||||||
Secrets: "lorenipsum",
|
|
||||||
CheckGPG: false,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
testPackageSpecSets := map[string][]rpmmd.PackageSpec{}
|
|
||||||
for _, pkgSetName := range pkgSetNames {
|
|
||||||
testPackageSpecSets[pkgSetName] = pkgTestingSpec
|
|
||||||
}
|
|
||||||
return testPackageSpecSets
|
|
||||||
}
|
|
||||||
|
|
||||||
// GetTestingImagePackageSpecSets returns PackageSpecSets for all package sets
|
|
||||||
// defined by the provided ImageType, which is useful for unit testing.
|
|
||||||
func GetTestingImagePackageSpecSets(packageName string, i distro.ImageType) map[string][]rpmmd.PackageSpec {
|
|
||||||
arch := i.Arch().Name()
|
|
||||||
imagePackageSets := make([]string, 0, len(i.PackageSets(blueprint.Blueprint{}, distro.ImageOptions{
|
|
||||||
OSTree: &ostree.ImageOptions{
|
|
||||||
URL: "foo",
|
|
||||||
ImageRef: "bar",
|
|
||||||
FetchChecksum: "baz",
|
|
||||||
},
|
|
||||||
}, nil)))
|
|
||||||
for pkgSetName := range i.PackageSets(blueprint.Blueprint{}, distro.ImageOptions{
|
|
||||||
OSTree: &ostree.ImageOptions{
|
|
||||||
URL: "foo",
|
|
||||||
ImageRef: "bar",
|
|
||||||
FetchChecksum: "baz",
|
|
||||||
},
|
|
||||||
}, nil) {
|
|
||||||
imagePackageSets = append(imagePackageSets, pkgSetName)
|
|
||||||
}
|
|
||||||
return GetTestingPackageSpecSets(packageName, arch, imagePackageSets)
|
|
||||||
}
|
|
||||||
|
|
|
||||||
|
|
@ -254,7 +254,9 @@ func TestImageType_BuildPackages(t *testing.T) {
|
||||||
if assert.NoErrorf(t, err, "d.GetArch(%v) returned err = %v; expected nil", archLabel, err) {
|
if assert.NoErrorf(t, err, "d.GetArch(%v) returned err = %v; expected nil", archLabel, err) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
buildPkgs := itStruct.PackageSets(blueprint.Blueprint{}, distro.ImageOptions{}, nil)["build"]
|
manifest, _, err := itStruct.Manifest(&blueprint.Blueprint{}, distro.ImageOptions{}, nil, nil, nil, 0)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
buildPkgs := manifest.Content.PackageSets["build"]
|
||||||
assert.NotNil(t, buildPkgs)
|
assert.NotNil(t, buildPkgs)
|
||||||
assert.Len(t, buildPkgs, 1)
|
assert.Len(t, buildPkgs, 1)
|
||||||
assert.ElementsMatch(t, buildPackages[archLabel], buildPkgs[0].Include)
|
assert.ElementsMatch(t, buildPackages[archLabel], buildPkgs[0].Include)
|
||||||
|
|
@ -425,8 +427,7 @@ func TestDistro_ManifestError(t *testing.T) {
|
||||||
imgOpts := distro.ImageOptions{
|
imgOpts := distro.ImageOptions{
|
||||||
Size: imgType.Size(0),
|
Size: imgType.Size(0),
|
||||||
}
|
}
|
||||||
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
|
_, _, err := imgType.Manifest(&bp, imgOpts, nil, nil, nil, 0)
|
||||||
_, _, err := imgType.Manifest(&bp, imgOpts, nil, testPackageSpecSets, nil, 0)
|
|
||||||
if imgTypeName == "iot-commit" || imgTypeName == "iot-container" {
|
if imgTypeName == "iot-commit" || imgTypeName == "iot-container" {
|
||||||
assert.EqualError(t, err, "kernel boot parameter customizations are not supported for ostree types")
|
assert.EqualError(t, err, "kernel boot parameter customizations are not supported for ostree types")
|
||||||
} else if imgTypeName == "iot-installer" {
|
} else if imgTypeName == "iot-installer" {
|
||||||
|
|
@ -606,8 +607,7 @@ func TestDistro_TestRootMountPoint(t *testing.T) {
|
||||||
arch, _ := fedoraDistro.GetArch(archName)
|
arch, _ := fedoraDistro.GetArch(archName)
|
||||||
for _, imgTypeName := range arch.ListImageTypes() {
|
for _, imgTypeName := range arch.ListImageTypes() {
|
||||||
imgType, _ := arch.GetImageType(imgTypeName)
|
imgType, _ := arch.GetImageType(imgTypeName)
|
||||||
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
|
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, nil, nil, 0)
|
||||||
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
|
|
||||||
if imgTypeName == "iot-commit" || imgTypeName == "iot-container" {
|
if imgTypeName == "iot-commit" || imgTypeName == "iot-container" {
|
||||||
assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types")
|
assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types")
|
||||||
} else if imgTypeName == "iot-raw-image" {
|
} else if imgTypeName == "iot-raw-image" {
|
||||||
|
|
@ -641,8 +641,7 @@ func TestDistro_CustomFileSystemSubDirectories(t *testing.T) {
|
||||||
arch, _ := fedoraDistro.GetArch(archName)
|
arch, _ := fedoraDistro.GetArch(archName)
|
||||||
for _, imgTypeName := range arch.ListImageTypes() {
|
for _, imgTypeName := range arch.ListImageTypes() {
|
||||||
imgType, _ := arch.GetImageType(imgTypeName)
|
imgType, _ := arch.GetImageType(imgTypeName)
|
||||||
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
|
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, nil, nil, 0)
|
||||||
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
|
|
||||||
if strings.HasPrefix(imgTypeName, "iot-") || strings.HasPrefix(imgTypeName, "image-") {
|
if strings.HasPrefix(imgTypeName, "iot-") || strings.HasPrefix(imgTypeName, "image-") {
|
||||||
continue
|
continue
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -680,8 +679,7 @@ func TestDistro_MountpointsWithArbitraryDepthAllowed(t *testing.T) {
|
||||||
arch, _ := fedoraDistro.GetArch(archName)
|
arch, _ := fedoraDistro.GetArch(archName)
|
||||||
for _, imgTypeName := range arch.ListImageTypes() {
|
for _, imgTypeName := range arch.ListImageTypes() {
|
||||||
imgType, _ := arch.GetImageType(imgTypeName)
|
imgType, _ := arch.GetImageType(imgTypeName)
|
||||||
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
|
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, nil, nil, 0)
|
||||||
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
|
|
||||||
if strings.HasPrefix(imgTypeName, "iot-") || strings.HasPrefix(imgTypeName, "image-") {
|
if strings.HasPrefix(imgTypeName, "iot-") || strings.HasPrefix(imgTypeName, "image-") {
|
||||||
continue
|
continue
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -775,8 +773,7 @@ func TestDistro_CustomUsrPartitionNotLargeEnough(t *testing.T) {
|
||||||
arch, _ := fedoraDistro.GetArch(archName)
|
arch, _ := fedoraDistro.GetArch(archName)
|
||||||
for _, imgTypeName := range arch.ListImageTypes() {
|
for _, imgTypeName := range arch.ListImageTypes() {
|
||||||
imgType, _ := arch.GetImageType(imgTypeName)
|
imgType, _ := arch.GetImageType(imgTypeName)
|
||||||
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
|
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, nil, nil, 0)
|
||||||
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
|
|
||||||
if imgTypeName == "iot-commit" || imgTypeName == "iot-container" {
|
if imgTypeName == "iot-commit" || imgTypeName == "iot-container" {
|
||||||
assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types")
|
assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types")
|
||||||
} else if imgTypeName == "iot-raw-image" {
|
} else if imgTypeName == "iot-raw-image" {
|
||||||
|
|
|
||||||
|
|
@ -117,7 +117,9 @@ func TestImageType_BuildPackages(t *testing.T) {
|
||||||
if assert.NoErrorf(t, err, "d.GetArch(%v) returned err = %v; expected nil", archLabel, err) {
|
if assert.NoErrorf(t, err, "d.GetArch(%v) returned err = %v; expected nil", archLabel, err) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
buildPkgs := itStruct.PackageSets(blueprint.Blueprint{}, distro.ImageOptions{}, nil)["build"]
|
manifest, _, err := itStruct.Manifest(&blueprint.Blueprint{}, distro.ImageOptions{}, nil, nil, nil, 0)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
buildPkgs := manifest.Content.PackageSets["build"]
|
||||||
assert.NotNil(t, buildPkgs)
|
assert.NotNil(t, buildPkgs)
|
||||||
assert.Len(t, buildPkgs, 1)
|
assert.Len(t, buildPkgs, 1)
|
||||||
assert.ElementsMatch(t, buildPackages[archLabel], buildPkgs[0].Include)
|
assert.ElementsMatch(t, buildPackages[archLabel], buildPkgs[0].Include)
|
||||||
|
|
@ -177,8 +179,7 @@ func TestDistro_ManifestError(t *testing.T) {
|
||||||
imgOpts := distro.ImageOptions{
|
imgOpts := distro.ImageOptions{
|
||||||
Size: imgType.Size(0),
|
Size: imgType.Size(0),
|
||||||
}
|
}
|
||||||
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
|
_, _, err := imgType.Manifest(&bp, imgOpts, nil, nil, nil, 0)
|
||||||
_, _, err := imgType.Manifest(&bp, imgOpts, nil, testPackageSpecSets, nil, 0)
|
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -306,8 +307,7 @@ func TestDistro_TestRootMountPoint(t *testing.T) {
|
||||||
arch, _ := r7distro.GetArch(archName)
|
arch, _ := r7distro.GetArch(archName)
|
||||||
for _, imgTypeName := range arch.ListImageTypes() {
|
for _, imgTypeName := range arch.ListImageTypes() {
|
||||||
imgType, _ := arch.GetImageType(imgTypeName)
|
imgType, _ := arch.GetImageType(imgTypeName)
|
||||||
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
|
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, nil, nil, 0)
|
||||||
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
|
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -333,8 +333,7 @@ func TestDistro_CustomFileSystemSubDirectories(t *testing.T) {
|
||||||
arch, _ := r7distro.GetArch(archName)
|
arch, _ := r7distro.GetArch(archName)
|
||||||
for _, imgTypeName := range arch.ListImageTypes() {
|
for _, imgTypeName := range arch.ListImageTypes() {
|
||||||
imgType, _ := arch.GetImageType(imgTypeName)
|
imgType, _ := arch.GetImageType(imgTypeName)
|
||||||
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
|
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, nil, nil, 0)
|
||||||
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
|
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -368,8 +367,7 @@ func TestDistro_MountpointsWithArbitraryDepthAllowed(t *testing.T) {
|
||||||
arch, _ := r7distro.GetArch(archName)
|
arch, _ := r7distro.GetArch(archName)
|
||||||
for _, imgTypeName := range arch.ListImageTypes() {
|
for _, imgTypeName := range arch.ListImageTypes() {
|
||||||
imgType, _ := arch.GetImageType(imgTypeName)
|
imgType, _ := arch.GetImageType(imgTypeName)
|
||||||
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
|
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, nil, nil, 0)
|
||||||
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
|
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -447,8 +445,7 @@ func TestDistro_CustomUsrPartitionNotLargeEnough(t *testing.T) {
|
||||||
arch, _ := r7distro.GetArch(archName)
|
arch, _ := r7distro.GetArch(archName)
|
||||||
for _, imgTypeName := range arch.ListImageTypes() {
|
for _, imgTypeName := range arch.ListImageTypes() {
|
||||||
imgType, _ := arch.GetImageType(imgTypeName)
|
imgType, _ := arch.GetImageType(imgTypeName)
|
||||||
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
|
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, nil, nil, 0)
|
||||||
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
|
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -285,7 +285,9 @@ func TestImageType_BuildPackages(t *testing.T) {
|
||||||
if assert.NoErrorf(t, err, "d.GetArch(%v) returned err = %v; expected nil", archLabel, err) {
|
if assert.NoErrorf(t, err, "d.GetArch(%v) returned err = %v; expected nil", archLabel, err) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
buildPkgs := itStruct.PackageSets(blueprint.Blueprint{}, distro.ImageOptions{}, nil)["build"]
|
manifest, _, err := itStruct.Manifest(&blueprint.Blueprint{}, distro.ImageOptions{}, nil, nil, nil, 0)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
buildPkgs := manifest.Content.PackageSets["build"]
|
||||||
assert.NotNil(t, buildPkgs)
|
assert.NotNil(t, buildPkgs)
|
||||||
assert.Len(t, buildPkgs, 1)
|
assert.Len(t, buildPkgs, 1)
|
||||||
assert.ElementsMatch(t, buildPackages[archLabel], buildPkgs[0].Include)
|
assert.ElementsMatch(t, buildPackages[archLabel], buildPkgs[0].Include)
|
||||||
|
|
@ -473,8 +475,7 @@ func TestDistro_ManifestError(t *testing.T) {
|
||||||
imgOpts := distro.ImageOptions{
|
imgOpts := distro.ImageOptions{
|
||||||
Size: imgType.Size(0),
|
Size: imgType.Size(0),
|
||||||
}
|
}
|
||||||
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
|
_, _, err := imgType.Manifest(&bp, imgOpts, nil, nil, nil, 0)
|
||||||
_, _, err := imgType.Manifest(&bp, imgOpts, nil, testPackageSpecSets, nil, 0)
|
|
||||||
if imgTypeName == "edge-commit" || imgTypeName == "edge-container" {
|
if imgTypeName == "edge-commit" || imgTypeName == "edge-container" {
|
||||||
assert.EqualError(t, err, "kernel boot parameter customizations are not supported for ostree types")
|
assert.EqualError(t, err, "kernel boot parameter customizations are not supported for ostree types")
|
||||||
} else if imgTypeName == "edge-raw-image" {
|
} else if imgTypeName == "edge-raw-image" {
|
||||||
|
|
@ -691,8 +692,7 @@ func TestDistro_TestRootMountPoint(t *testing.T) {
|
||||||
arch, _ := r8distro.GetArch(archName)
|
arch, _ := r8distro.GetArch(archName)
|
||||||
for _, imgTypeName := range arch.ListImageTypes() {
|
for _, imgTypeName := range arch.ListImageTypes() {
|
||||||
imgType, _ := arch.GetImageType(imgTypeName)
|
imgType, _ := arch.GetImageType(imgTypeName)
|
||||||
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
|
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, nil, nil, 0)
|
||||||
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
|
|
||||||
if imgTypeName == "edge-commit" || imgTypeName == "edge-container" {
|
if imgTypeName == "edge-commit" || imgTypeName == "edge-container" {
|
||||||
assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types")
|
assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types")
|
||||||
} else if unsupported[imgTypeName] {
|
} else if unsupported[imgTypeName] {
|
||||||
|
|
@ -732,8 +732,7 @@ func TestDistro_CustomFileSystemSubDirectories(t *testing.T) {
|
||||||
arch, _ := r8distro.GetArch(archName)
|
arch, _ := r8distro.GetArch(archName)
|
||||||
for _, imgTypeName := range arch.ListImageTypes() {
|
for _, imgTypeName := range arch.ListImageTypes() {
|
||||||
imgType, _ := arch.GetImageType(imgTypeName)
|
imgType, _ := arch.GetImageType(imgTypeName)
|
||||||
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
|
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, nil, nil, 0)
|
||||||
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
|
|
||||||
if unsupported[imgTypeName] {
|
if unsupported[imgTypeName] {
|
||||||
assert.Error(t, err)
|
assert.Error(t, err)
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -779,8 +778,7 @@ func TestDistro_MountpointsWithArbitraryDepthAllowed(t *testing.T) {
|
||||||
arch, _ := r8distro.GetArch(archName)
|
arch, _ := r8distro.GetArch(archName)
|
||||||
for _, imgTypeName := range arch.ListImageTypes() {
|
for _, imgTypeName := range arch.ListImageTypes() {
|
||||||
imgType, _ := arch.GetImageType(imgTypeName)
|
imgType, _ := arch.GetImageType(imgTypeName)
|
||||||
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
|
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, nil, nil, 0)
|
||||||
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
|
|
||||||
if unsupported[imgTypeName] {
|
if unsupported[imgTypeName] {
|
||||||
assert.Error(t, err)
|
assert.Error(t, err)
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -892,8 +890,7 @@ func TestDistro_CustomUsrPartitionNotLargeEnough(t *testing.T) {
|
||||||
arch, _ := r8distro.GetArch(archName)
|
arch, _ := r8distro.GetArch(archName)
|
||||||
for _, imgTypeName := range arch.ListImageTypes() {
|
for _, imgTypeName := range arch.ListImageTypes() {
|
||||||
imgType, _ := arch.GetImageType(imgTypeName)
|
imgType, _ := arch.GetImageType(imgTypeName)
|
||||||
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
|
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, nil, nil, 0)
|
||||||
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
|
|
||||||
if imgTypeName == "edge-commit" || imgTypeName == "edge-container" {
|
if imgTypeName == "edge-commit" || imgTypeName == "edge-container" {
|
||||||
assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types")
|
assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types")
|
||||||
} else if unsupported[imgTypeName] {
|
} else if unsupported[imgTypeName] {
|
||||||
|
|
|
||||||
|
|
@ -270,7 +270,9 @@ func TestImageType_BuildPackages(t *testing.T) {
|
||||||
if assert.NoErrorf(t, err, "d.GetArch(%v) returned err = %v; expected nil", archLabel, err) {
|
if assert.NoErrorf(t, err, "d.GetArch(%v) returned err = %v; expected nil", archLabel, err) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
buildPkgs := itStruct.PackageSets(blueprint.Blueprint{}, distro.ImageOptions{}, nil)["build"]
|
manifest, _, err := itStruct.Manifest(&blueprint.Blueprint{}, distro.ImageOptions{}, nil, nil, nil, 0)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
buildPkgs := manifest.Content.PackageSets["build"]
|
||||||
assert.NotNil(t, buildPkgs)
|
assert.NotNil(t, buildPkgs)
|
||||||
assert.Len(t, buildPkgs, 1)
|
assert.Len(t, buildPkgs, 1)
|
||||||
assert.ElementsMatch(t, buildPackages[archLabel], buildPkgs[0].Include)
|
assert.ElementsMatch(t, buildPackages[archLabel], buildPkgs[0].Include)
|
||||||
|
|
@ -456,8 +458,7 @@ func TestDistro_ManifestError(t *testing.T) {
|
||||||
imgOpts := distro.ImageOptions{
|
imgOpts := distro.ImageOptions{
|
||||||
Size: imgType.Size(0),
|
Size: imgType.Size(0),
|
||||||
}
|
}
|
||||||
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
|
_, _, err := imgType.Manifest(&bp, imgOpts, nil, nil, nil, 0)
|
||||||
_, _, err := imgType.Manifest(&bp, imgOpts, nil, testPackageSpecSets, nil, 0)
|
|
||||||
if imgTypeName == "edge-commit" || imgTypeName == "edge-container" {
|
if imgTypeName == "edge-commit" || imgTypeName == "edge-container" {
|
||||||
assert.EqualError(t, err, "kernel boot parameter customizations are not supported for ostree types")
|
assert.EqualError(t, err, "kernel boot parameter customizations are not supported for ostree types")
|
||||||
} else if imgTypeName == "edge-raw-image" {
|
} else if imgTypeName == "edge-raw-image" {
|
||||||
|
|
@ -658,8 +659,7 @@ func TestDistro_TestRootMountPoint(t *testing.T) {
|
||||||
arch, _ := r9distro.GetArch(archName)
|
arch, _ := r9distro.GetArch(archName)
|
||||||
for _, imgTypeName := range arch.ListImageTypes() {
|
for _, imgTypeName := range arch.ListImageTypes() {
|
||||||
imgType, _ := arch.GetImageType(imgTypeName)
|
imgType, _ := arch.GetImageType(imgTypeName)
|
||||||
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
|
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, nil, nil, 0)
|
||||||
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
|
|
||||||
if imgTypeName == "edge-commit" || imgTypeName == "edge-container" {
|
if imgTypeName == "edge-commit" || imgTypeName == "edge-container" {
|
||||||
assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types")
|
assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types")
|
||||||
} else if imgTypeName == "edge-installer" || imgTypeName == "edge-simplified-installer" || imgTypeName == "edge-raw-image" {
|
} else if imgTypeName == "edge-installer" || imgTypeName == "edge-simplified-installer" || imgTypeName == "edge-raw-image" {
|
||||||
|
|
@ -691,8 +691,7 @@ func TestDistro_CustomFileSystemSubDirectories(t *testing.T) {
|
||||||
arch, _ := r9distro.GetArch(archName)
|
arch, _ := r9distro.GetArch(archName)
|
||||||
for _, imgTypeName := range arch.ListImageTypes() {
|
for _, imgTypeName := range arch.ListImageTypes() {
|
||||||
imgType, _ := arch.GetImageType(imgTypeName)
|
imgType, _ := arch.GetImageType(imgTypeName)
|
||||||
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
|
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, nil, nil, 0)
|
||||||
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
|
|
||||||
if strings.HasPrefix(imgTypeName, "edge-") {
|
if strings.HasPrefix(imgTypeName, "edge-") {
|
||||||
continue
|
continue
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -730,8 +729,7 @@ func TestDistro_MountpointsWithArbitraryDepthAllowed(t *testing.T) {
|
||||||
arch, _ := r9distro.GetArch(archName)
|
arch, _ := r9distro.GetArch(archName)
|
||||||
for _, imgTypeName := range arch.ListImageTypes() {
|
for _, imgTypeName := range arch.ListImageTypes() {
|
||||||
imgType, _ := arch.GetImageType(imgTypeName)
|
imgType, _ := arch.GetImageType(imgTypeName)
|
||||||
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
|
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, nil, nil, 0)
|
||||||
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
|
|
||||||
if strings.HasPrefix(imgTypeName, "edge-") {
|
if strings.HasPrefix(imgTypeName, "edge-") {
|
||||||
continue
|
continue
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -823,8 +821,7 @@ func TestDistro_CustomUsrPartitionNotLargeEnough(t *testing.T) {
|
||||||
arch, _ := r9distro.GetArch(archName)
|
arch, _ := r9distro.GetArch(archName)
|
||||||
for _, imgTypeName := range arch.ListImageTypes() {
|
for _, imgTypeName := range arch.ListImageTypes() {
|
||||||
imgType, _ := arch.GetImageType(imgTypeName)
|
imgType, _ := arch.GetImageType(imgTypeName)
|
||||||
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
|
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, nil, nil, 0)
|
||||||
_, _, err := imgType.Manifest(&bp, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
|
|
||||||
if imgTypeName == "edge-commit" || imgTypeName == "edge-container" {
|
if imgTypeName == "edge-commit" || imgTypeName == "edge-container" {
|
||||||
assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types")
|
assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types")
|
||||||
} else if imgTypeName == "edge-installer" || imgTypeName == "edge-simplified-installer" || imgTypeName == "edge-raw-image" {
|
} else if imgTypeName == "edge-installer" || imgTypeName == "edge-simplified-installer" || imgTypeName == "edge-raw-image" {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue