distro/rhel8: assert error instead of skipping

We sometimes skip testing customizations for image types that don't
support them, other times, we check for a specific error.  If we don't
care about the specific error message that's received, running the test
and checking for error is better than skipping, because it ensures that
we're skipping the test for the right reasons and not accidentally
skipping a test for an image type that should support the
customizations.
This commit is contained in:
Achilleas Koutsou 2023-03-23 17:29:10 +00:00 committed by Tomáš Hozza
parent 203dd5275e
commit 90cc2b18a8

View file

@ -650,7 +650,7 @@ func TestDistro_CustomFileSystemManifestError(t *testing.T) {
if imgTypeName == "edge-commit" || imgTypeName == "edge-container" {
assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types")
} else if unsupported[imgTypeName] {
continue
assert.Error(t, err)
} else {
assert.EqualError(t, err, "The following custom mountpoints are not supported [\"/etc\"]")
}
@ -685,7 +685,7 @@ func TestDistro_TestRootMountPoint(t *testing.T) {
if imgTypeName == "edge-commit" || imgTypeName == "edge-container" {
assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types")
} else if unsupported[imgTypeName] {
continue
assert.Error(t, err)
} else {
assert.NoError(t, err)
}
@ -724,7 +724,7 @@ func TestDistro_CustomFileSystemSubDirectories(t *testing.T) {
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
_, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
if unsupported[imgTypeName] {
continue
assert.Error(t, err)
} else {
assert.NoError(t, err)
}
@ -771,7 +771,7 @@ func TestDistro_MountpointsWithArbitraryDepthAllowed(t *testing.T) {
testPackageSpecSets := distro_test_common.GetTestingImagePackageSpecSets("kernel", imgType)
_, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, testPackageSpecSets, nil, 0)
if unsupported[imgTypeName] {
continue
assert.Error(t, err)
} else {
assert.NoError(t, err)
}
@ -813,7 +813,7 @@ func TestDistro_DirtyMountpointsNotAllowed(t *testing.T) {
imgType, _ := arch.GetImageType(imgTypeName)
_, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, nil, nil, 0)
if unsupported[imgTypeName] {
continue
assert.Error(t, err)
} else {
assert.EqualError(t, err, "The following custom mountpoints are not supported [\"//\" \"/var//\" \"/var//log/audit/\"]")
}
@ -851,7 +851,7 @@ func TestDistro_CustomFileSystemPatternMatching(t *testing.T) {
if imgTypeName == "edge-commit" || imgTypeName == "edge-container" {
assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types")
} else if unsupported[imgTypeName] {
continue
assert.Error(t, err)
} else {
assert.EqualError(t, err, "The following custom mountpoints are not supported [\"/variable\" \"/variable/log/audit\"]")
}
@ -886,7 +886,7 @@ func TestDistro_CustomUsrPartitionNotLargeEnough(t *testing.T) {
if imgTypeName == "edge-commit" || imgTypeName == "edge-container" {
assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types")
} else if unsupported[imgTypeName] {
continue
assert.Error(t, err)
} else {
assert.NoError(t, err)
}