distro: test filesystem errors
This commit is contained in:
parent
f4ee0bfabf
commit
c671a0dab1
5 changed files with 275 additions and 0 deletions
|
|
@ -379,3 +379,55 @@ func TestFedora33_ModulePlatformID(t *testing.T) {
|
|||
func TestFedora33_KernelOption(t *testing.T) {
|
||||
distro_test_common.TestDistro_KernelOption(t, fedora33.New())
|
||||
}
|
||||
|
||||
func TestDistro_CustomFileSystemManifestError(t *testing.T) {
|
||||
f33distro := fedora33.New()
|
||||
bp := blueprint.Blueprint{
|
||||
Customizations: &blueprint.Customizations{
|
||||
Filesystem: []blueprint.FilesystemCustomization{
|
||||
{
|
||||
MinSize: 1024,
|
||||
Mountpoint: "/boot",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, archName := range f33distro.ListArches() {
|
||||
arch, _ := f33distro.GetArch(archName)
|
||||
for _, imgTypeName := range arch.ListImageTypes() {
|
||||
imgType, _ := arch.GetImageType(imgTypeName)
|
||||
_, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, nil, 0)
|
||||
if imgTypeName == "fedora-iot-commit" {
|
||||
assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types")
|
||||
} else {
|
||||
assert.EqualError(t, err, "The following custom mountpoints are not supported [\"/boot\"]")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestDistro_TestRootMountPoint(t *testing.T) {
|
||||
f33distro := fedora33.New()
|
||||
bp := blueprint.Blueprint{
|
||||
Customizations: &blueprint.Customizations{
|
||||
Filesystem: []blueprint.FilesystemCustomization{
|
||||
{
|
||||
MinSize: 1024,
|
||||
Mountpoint: "/",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, archName := range f33distro.ListArches() {
|
||||
arch, _ := f33distro.GetArch(archName)
|
||||
for _, imgTypeName := range arch.ListImageTypes() {
|
||||
imgType, _ := arch.GetImageType(imgTypeName)
|
||||
_, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, nil, 0)
|
||||
if imgTypeName == "fedora-iot-commit" {
|
||||
assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types")
|
||||
} else {
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -381,6 +381,57 @@ func TestDistro_ManifestError(t *testing.T) {
|
|||
}
|
||||
}
|
||||
}
|
||||
func TestDistro_CustomFileSystemManifestError(t *testing.T) {
|
||||
r8distro := rhel8.New()
|
||||
bp := blueprint.Blueprint{
|
||||
Customizations: &blueprint.Customizations{
|
||||
Filesystem: []blueprint.FilesystemCustomization{
|
||||
{
|
||||
MinSize: 1024,
|
||||
Mountpoint: "/boot",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, archName := range r8distro.ListArches() {
|
||||
arch, _ := r8distro.GetArch(archName)
|
||||
for _, imgTypeName := range arch.ListImageTypes() {
|
||||
imgType, _ := arch.GetImageType(imgTypeName)
|
||||
_, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, nil, 0)
|
||||
if imgTypeName == "rhel-edge-commit" {
|
||||
assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types")
|
||||
} else {
|
||||
assert.EqualError(t, err, "The following custom mountpoints are not supported [\"/var\"]")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestDistro_TestRootMountPoint(t *testing.T) {
|
||||
r8distro := rhel8.New()
|
||||
bp := blueprint.Blueprint{
|
||||
Customizations: &blueprint.Customizations{
|
||||
Filesystem: []blueprint.FilesystemCustomization{
|
||||
{
|
||||
MinSize: 1024,
|
||||
Mountpoint: "/",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, archName := range r8distro.ListArches() {
|
||||
arch, _ := r8distro.GetArch(archName)
|
||||
for _, imgTypeName := range arch.ListImageTypes() {
|
||||
imgType, _ := arch.GetImageType(imgTypeName)
|
||||
_, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, nil, 0)
|
||||
if imgTypeName == "rhel-edge-commit" {
|
||||
assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types")
|
||||
} else {
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestRhel8_ListArches(t *testing.T) {
|
||||
distro := rhel8.New()
|
||||
|
|
|
|||
|
|
@ -590,3 +590,75 @@ func TestRhel84_ModulePlatformID(t *testing.T) {
|
|||
func TestRhel84_KernelOption(t *testing.T) {
|
||||
distro_test_common.TestDistro_KernelOption(t, rhel84.New())
|
||||
}
|
||||
|
||||
func TestDistro_CustomFileSystemManifestError(t *testing.T) {
|
||||
bp := blueprint.Blueprint{
|
||||
Customizations: &blueprint.Customizations{
|
||||
Filesystem: []blueprint.FilesystemCustomization{
|
||||
{
|
||||
MinSize: 1024,
|
||||
Mountpoint: "/boot",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, dist := range rhelFamilyDistros {
|
||||
t.Run(dist.name, func(t *testing.T) {
|
||||
d := dist.distro
|
||||
for _, archName := range d.ListArches() {
|
||||
arch, _ := d.GetArch(archName)
|
||||
for _, imgTypeName := range arch.ListImageTypes() {
|
||||
if (archName == "s390x" && imgTypeName == "tar") || imgTypeName == "rhel-edge-installer" {
|
||||
continue
|
||||
}
|
||||
imgType, _ := arch.GetImageType(imgTypeName)
|
||||
imgOpts := distro.ImageOptions{
|
||||
Size: imgType.Size(0),
|
||||
}
|
||||
_, err := imgType.Manifest(bp.Customizations, imgOpts, nil, nil, 0)
|
||||
if imgTypeName == "rhel-edge-commit" || imgTypeName == "rhel-edge-container" {
|
||||
assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types")
|
||||
} else {
|
||||
assert.EqualError(t, err, "The following custom mountpoints are not supported [\"/boot\"]")
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestDistro_TestRootMountPoint(t *testing.T) {
|
||||
bp := blueprint.Blueprint{
|
||||
Customizations: &blueprint.Customizations{
|
||||
Filesystem: []blueprint.FilesystemCustomization{
|
||||
{
|
||||
MinSize: 1024,
|
||||
Mountpoint: "/",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, dist := range rhelFamilyDistros {
|
||||
t.Run(dist.name, func(t *testing.T) {
|
||||
d := dist.distro
|
||||
for _, archName := range d.ListArches() {
|
||||
arch, _ := d.GetArch(archName)
|
||||
for _, imgTypeName := range arch.ListImageTypes() {
|
||||
if (archName == "s390x" && imgTypeName == "tar") || imgTypeName == "rhel-edge-installer" {
|
||||
continue
|
||||
}
|
||||
imgType, _ := arch.GetImageType(imgTypeName)
|
||||
imgOpts := distro.ImageOptions{
|
||||
Size: imgType.Size(0),
|
||||
}
|
||||
_, err := imgType.Manifest(bp.Customizations, imgOpts, nil, nil, 0)
|
||||
if imgTypeName == "rhel-edge-commit" || imgTypeName == "rhel-edge-container" {
|
||||
assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types")
|
||||
} else {
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -524,3 +524,59 @@ func TestRhel85_ModulePlatformID(t *testing.T) {
|
|||
func TestRhel85_KernelOption(t *testing.T) {
|
||||
distro_test_common.TestDistro_KernelOption(t, rhel85.New())
|
||||
}
|
||||
|
||||
func TestDistro_CustomFileSystemManifestError(t *testing.T) {
|
||||
r8distro := rhel85.New()
|
||||
bp := blueprint.Blueprint{
|
||||
Customizations: &blueprint.Customizations{
|
||||
Filesystem: []blueprint.FilesystemCustomization{
|
||||
{
|
||||
MinSize: 1024,
|
||||
Mountpoint: "/boot",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, archName := range r8distro.ListArches() {
|
||||
arch, _ := r8distro.GetArch(archName)
|
||||
for _, imgTypeName := range arch.ListImageTypes() {
|
||||
imgType, _ := arch.GetImageType(imgTypeName)
|
||||
_, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, nil, 0)
|
||||
if imgTypeName == "edge-commit" || imgTypeName == "edge-container" {
|
||||
assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types")
|
||||
} else if imgTypeName == "edge-installer" {
|
||||
continue
|
||||
} else {
|
||||
assert.EqualError(t, err, "The following custom mountpoints are not supported [\"/boot\"]")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestDistro_TestRootMountPoint(t *testing.T) {
|
||||
r8distro := rhel85.New()
|
||||
bp := blueprint.Blueprint{
|
||||
Customizations: &blueprint.Customizations{
|
||||
Filesystem: []blueprint.FilesystemCustomization{
|
||||
{
|
||||
MinSize: 1024,
|
||||
Mountpoint: "/",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, archName := range r8distro.ListArches() {
|
||||
arch, _ := r8distro.GetArch(archName)
|
||||
for _, imgTypeName := range arch.ListImageTypes() {
|
||||
imgType, _ := arch.GetImageType(imgTypeName)
|
||||
_, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, nil, 0)
|
||||
if imgTypeName == "edge-commit" || imgTypeName == "edge-container" {
|
||||
assert.EqualError(t, err, "Custom mountpoints are not supported for ostree types")
|
||||
} else if imgTypeName == "edge-installer" {
|
||||
continue
|
||||
} else {
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -378,3 +378,47 @@ func TestRhel84_ModulePlatformID(t *testing.T) {
|
|||
func TestRhel90_KernelOption(t *testing.T) {
|
||||
distro_test_common.TestDistro_KernelOption(t, rhel90.New())
|
||||
}
|
||||
|
||||
func TestDistro_CustomFileSystemManifestError(t *testing.T) {
|
||||
r9distro := rhel90.New()
|
||||
bp := blueprint.Blueprint{
|
||||
Customizations: &blueprint.Customizations{
|
||||
Filesystem: []blueprint.FilesystemCustomization{
|
||||
{
|
||||
MinSize: 1024,
|
||||
Mountpoint: "/boot",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, archName := range r9distro.ListArches() {
|
||||
arch, _ := r9distro.GetArch(archName)
|
||||
for _, imgTypeName := range arch.ListImageTypes() {
|
||||
imgType, _ := arch.GetImageType(imgTypeName)
|
||||
_, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, nil, 0)
|
||||
assert.EqualError(t, err, "The following custom mountpoints are not supported [\"/boot\"]")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestDistro_TestRootMountPoint(t *testing.T) {
|
||||
r9distro := rhel90.New()
|
||||
bp := blueprint.Blueprint{
|
||||
Customizations: &blueprint.Customizations{
|
||||
Filesystem: []blueprint.FilesystemCustomization{
|
||||
{
|
||||
MinSize: 1024,
|
||||
Mountpoint: "/",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
for _, archName := range r9distro.ListArches() {
|
||||
arch, _ := r9distro.GetArch(archName)
|
||||
for _, imgTypeName := range arch.ListImageTypes() {
|
||||
imgType, _ := arch.GetImageType(imgTypeName)
|
||||
_, err := imgType.Manifest(bp.Customizations, distro.ImageOptions{}, nil, nil, 0)
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue