distro_test: add test that covers BuildPackages
The main reason here is not to make sure we have the right set of build packages, but rather to make sure the pointer hierarchy (distro->arch-> image type) works as expected.
This commit is contained in:
parent
91f572e961
commit
db4b6e71ed
3 changed files with 135 additions and 0 deletions
|
|
@ -2,6 +2,7 @@ package fedora30_test
|
|||
|
||||
import (
|
||||
"github.com/osbuild/osbuild-composer/internal/distro/fedora30"
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
|
|
@ -92,3 +93,47 @@ func TestFilenameFromType(t *testing.T) {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestImageType_BuildPackages(t *testing.T) {
|
||||
x8664BuildPackages := []string{
|
||||
"dnf",
|
||||
"dosfstools",
|
||||
"e2fsprogs",
|
||||
"grub2-pc",
|
||||
"policycoreutils",
|
||||
"qemu-img",
|
||||
"systemd",
|
||||
"tar",
|
||||
"xz",
|
||||
}
|
||||
aarch64BuildPackages := []string{
|
||||
"dnf",
|
||||
"dosfstools",
|
||||
"e2fsprogs",
|
||||
"policycoreutils",
|
||||
"qemu-img",
|
||||
"systemd",
|
||||
"tar",
|
||||
"xz",
|
||||
}
|
||||
buildPackages := map[string][]string{
|
||||
"x86_64": x8664BuildPackages,
|
||||
"aarch64": aarch64BuildPackages,
|
||||
}
|
||||
d := fedora30.New()
|
||||
for _, archLabel := range d.ListArchs() {
|
||||
archStruct, err := d.GetArch(archLabel)
|
||||
if err != nil {
|
||||
t.Errorf("d.GetArch(%v) returned err = %v; expected nil", archLabel, err)
|
||||
continue
|
||||
}
|
||||
for _, itLabel := range archStruct.ListImageTypes() {
|
||||
itStruct, err := archStruct.GetImageType(itLabel)
|
||||
if err != nil {
|
||||
t.Errorf("d.GetArch(%v) returned err = %v; expected nil", archLabel, err)
|
||||
continue
|
||||
}
|
||||
reflect.DeepEqual(itStruct.BuildPackages(), buildPackages[archLabel])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package fedora31_test
|
|||
|
||||
import (
|
||||
"github.com/osbuild/osbuild-composer/internal/distro/fedora31"
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
|
|
@ -92,3 +93,47 @@ func TestFilenameFromType(t *testing.T) {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestImageType_BuildPackages(t *testing.T) {
|
||||
x8664BuildPackages := []string{
|
||||
"dnf",
|
||||
"dosfstools",
|
||||
"e2fsprogs",
|
||||
"grub2-pc",
|
||||
"policycoreutils",
|
||||
"qemu-img",
|
||||
"systemd",
|
||||
"tar",
|
||||
"xz",
|
||||
}
|
||||
aarch64BuildPackages := []string{
|
||||
"dnf",
|
||||
"dosfstools",
|
||||
"e2fsprogs",
|
||||
"policycoreutils",
|
||||
"qemu-img",
|
||||
"systemd",
|
||||
"tar",
|
||||
"xz",
|
||||
}
|
||||
buildPackages := map[string][]string{
|
||||
"x86_64": x8664BuildPackages,
|
||||
"aarch64": aarch64BuildPackages,
|
||||
}
|
||||
d := fedora31.New()
|
||||
for _, archLabel := range d.ListArchs() {
|
||||
archStruct, err := d.GetArch(archLabel)
|
||||
if err != nil {
|
||||
t.Errorf("d.GetArch(%v) returned err = %v; expected nil", archLabel, err)
|
||||
continue
|
||||
}
|
||||
for _, itLabel := range archStruct.ListImageTypes() {
|
||||
itStruct, err := archStruct.GetImageType(itLabel)
|
||||
if err != nil {
|
||||
t.Errorf("d.GetArch(%v) returned err = %v; expected nil", archLabel, err)
|
||||
continue
|
||||
}
|
||||
reflect.DeepEqual(itStruct.BuildPackages(), buildPackages[archLabel])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package fedora32_test
|
|||
|
||||
import (
|
||||
"github.com/osbuild/osbuild-composer/internal/distro/fedora32"
|
||||
"reflect"
|
||||
"testing"
|
||||
)
|
||||
|
||||
|
|
@ -92,3 +93,47 @@ func TestFilenameFromType(t *testing.T) {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
func TestImageType_BuildPackages(t *testing.T) {
|
||||
x8664BuildPackages := []string{
|
||||
"dnf",
|
||||
"dosfstools",
|
||||
"e2fsprogs",
|
||||
"grub2-pc",
|
||||
"policycoreutils",
|
||||
"qemu-img",
|
||||
"systemd",
|
||||
"tar",
|
||||
"xz",
|
||||
}
|
||||
aarch64BuildPackages := []string{
|
||||
"dnf",
|
||||
"dosfstools",
|
||||
"e2fsprogs",
|
||||
"policycoreutils",
|
||||
"qemu-img",
|
||||
"systemd",
|
||||
"tar",
|
||||
"xz",
|
||||
}
|
||||
buildPackages := map[string][]string{
|
||||
"x86_64": x8664BuildPackages,
|
||||
"aarch64": aarch64BuildPackages,
|
||||
}
|
||||
d := fedora32.New()
|
||||
for _, archLabel := range d.ListArchs() {
|
||||
archStruct, err := d.GetArch(archLabel)
|
||||
if err != nil {
|
||||
t.Errorf("d.GetArch(%v) returned err = %v; expected nil", archLabel, err)
|
||||
continue
|
||||
}
|
||||
for _, itLabel := range archStruct.ListImageTypes() {
|
||||
itStruct, err := archStruct.GetImageType(itLabel)
|
||||
if err != nil {
|
||||
t.Errorf("d.GetArch(%v) returned err = %v; expected nil", archLabel, err)
|
||||
continue
|
||||
}
|
||||
reflect.DeepEqual(itStruct.BuildPackages(), buildPackages[archLabel])
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue