Skip to content

Commit

Permalink
fedora: update image type lists in tests
Browse files Browse the repository at this point in the history
Add bootc-container to all the test lists for Fedora 39 and 40.
Also use the full distro name in each call to t.Run() instead of just
the name "fedora" to make each iteration easier to distinguish.
  • Loading branch information
achilleas-k committed Jan 13, 2024
1 parent d606edf commit 249b938
Showing 1 changed file with 53 additions and 13 deletions.
66 changes: 53 additions & 13 deletions pkg/distro/fedora/distro_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,14 @@ func TestFilenameFromType(t *testing.T) {
},
},
"39": {
{
name: "bootc-container",
args: args{"bootc-container"},
want: wantResult{
filename: "bootc-container.tar",
mimeType: "application/x-tar",
},
},
{
name: "iot-simplified-installer",
args: args{"iot-simplified-installer"},
Expand All @@ -225,6 +233,14 @@ func TestFilenameFromType(t *testing.T) {
},
},
"40": {
{
name: "bootc-container",
args: args{"bootc-container"},
want: wantResult{
filename: "bootc-container.tar",
mimeType: "application/x-tar",
},
},
{
name: "iot-simplified-installer",
args: args{"iot-simplified-installer"},
Expand All @@ -236,7 +252,7 @@ func TestFilenameFromType(t *testing.T) {
},
}
for _, dist := range fedoraFamilyDistros {
t.Run(dist.name, func(t *testing.T) {
t.Run(dist.distro.Name(), func(t *testing.T) {
allTests := append(tests, verTypes[dist.distro.Releasever()]...)
for _, tt := range allTests {
t.Run(tt.name, func(t *testing.T) {
Expand Down Expand Up @@ -292,7 +308,7 @@ func TestImageType_BuildPackages(t *testing.T) {
"aarch64": aarch64BuildPackages,
}
for _, dist := range fedoraFamilyDistros {
t.Run(dist.name, func(t *testing.T) {
t.Run(dist.distro.Name(), func(t *testing.T) {
d := dist.distro
for _, archLabel := range d.ListArches() {
archStruct, err := d.GetArch(archLabel)
Expand Down Expand Up @@ -344,8 +360,14 @@ func TestImageType_Name(t *testing.T) {
},
verTypes: map[string][]string{
"38": {"iot-simplified-installer"},
"39": {"iot-simplified-installer"},
"40": {"iot-simplified-installer"},
"39": {
"bootc-container",
"iot-simplified-installer",
},
"40": {
"bootc-container",
"iot-simplified-installer",
},
},
},
{
Expand All @@ -365,14 +387,20 @@ func TestImageType_Name(t *testing.T) {
},
verTypes: map[string][]string{
"38": {"iot-simplified-installer"},
"39": {"iot-simplified-installer"},
"40": {"iot-simplified-installer"},
"39": {
"bootc-container",
"iot-simplified-installer",
},
"40": {
"bootc-container",
"iot-simplified-installer",
},
},
},
}

for _, dist := range fedoraFamilyDistros {
t.Run(dist.name, func(t *testing.T) {
t.Run(dist.distro.Name(), func(t *testing.T) {
for _, mapping := range imgMap {
arch, err := dist.distro.GetArch(mapping.arch)
if assert.NoError(t, err) {
Expand Down Expand Up @@ -534,8 +562,14 @@ func TestArchitecture_ListImageTypes(t *testing.T) {
},
verTypes: map[string][]string{
"38": {"iot-simplified-installer"},
"39": {"iot-simplified-installer"},
"40": {"iot-simplified-installer"},
"39": {
"bootc-container",
"iot-simplified-installer",
},
"40": {
"bootc-container",
"iot-simplified-installer",
},
},
},
{
Expand All @@ -557,8 +591,14 @@ func TestArchitecture_ListImageTypes(t *testing.T) {
},
verTypes: map[string][]string{
"38": {"iot-simplified-installer"},
"39": {"iot-simplified-installer"},
"40": {"iot-simplified-installer"},
"39": {
"bootc-container",
"iot-simplified-installer",
},
"40": {
"bootc-container",
"iot-simplified-installer",
},
},
},
{
Expand All @@ -578,7 +618,7 @@ func TestArchitecture_ListImageTypes(t *testing.T) {
}

for _, dist := range fedoraFamilyDistros {
t.Run(dist.name, func(t *testing.T) {
t.Run(dist.distro.Name(), func(t *testing.T) {
for _, mapping := range imgMap {
arch, err := dist.distro.GetArch(mapping.arch)
require.NoError(t, err)
Expand Down Expand Up @@ -624,7 +664,7 @@ func TestFedora37_GetArch(t *testing.T) {
}

for _, dist := range fedoraFamilyDistros {
t.Run(dist.name, func(t *testing.T) {
t.Run(dist.distro.Name(), func(t *testing.T) {
for _, a := range arches {
actualArch, err := dist.distro.GetArch(a.name)
if a.errorExpected {
Expand Down

0 comments on commit 249b938

Please sign in to comment.