@@ -21,7 +21,7 @@ import (
2121func TestCustomizeImagePackagesAddOfflineDir (t * testing.T ) {
2222 testTmpDir := filepath .Join (tmpDir , "TestCustomizeImagePackagesAddOfflineDir" )
2323
24- baseImage := checkSkipForCustomizeImage ( t , baseImageTypeCoreEfi , baseImageVersionDefault )
24+ baseImage , _ := checkSkipForCustomizeDefaultImage ( t )
2525 downloadedRpmsDir := getDownloadedRpmsDir (t , "2.0" )
2626
2727 buildDir := filepath .Join (testTmpDir , "build" )
@@ -146,7 +146,7 @@ func TestCustomizeImagePackagesAddOfflineLocalRepoNoGpgKey(t *testing.T) {
146146func testCustomizeImagePackagesAddOfflineLocalRepoHelper (t * testing.T , testName string , withGpgKey bool ) {
147147 testTmpDir := filepath .Join (tmpDir , testName )
148148
149- baseImage := checkSkipForCustomizeImage ( t , baseImageTypeCoreEfi , baseImageVersionDefault )
149+ baseImage , _ := checkSkipForCustomizeDefaultImage ( t )
150150
151151 downloadedRpmsRepoFile := getDownloadedRpmsRepoFile (t , "2.0" , withGpgKey )
152152 rpmSources := []string {downloadedRpmsRepoFile }
@@ -176,7 +176,7 @@ func testCustomizeImagePackagesAddOfflineLocalRepoHelper(t *testing.T, testName
176176}
177177
178178func TestCustomizeImagePackagesUpdate (t * testing.T ) {
179- baseImage := checkSkipForCustomizeImage ( t , baseImageTypeCoreEfi , baseImageVersionDefault )
179+ baseImage , baseImageInfo := checkSkipForCustomizeDefaultImage ( t )
180180
181181 testTmpDir := filepath .Join (tmpDir , "TestCustomizeImagePackagesUpdate" )
182182 buildDir := filepath .Join (testTmpDir , "build" )
@@ -198,7 +198,7 @@ func TestCustomizeImagePackagesUpdate(t *testing.T) {
198198 defer imageConnection .Close ()
199199
200200 // Ensure tdnf cache was cleaned.
201- ensureTdnfCacheCleanup (t , imageConnection , "/var/cache/tdnf" )
201+ ensureTdnfCacheCleanup (t , imageConnection , "/var/cache/tdnf" , baseImageInfo )
202202
203203 // Ensure packages were installed.
204204 ensureFilesExist (t , imageConnection ,
@@ -212,7 +212,7 @@ func TestCustomizeImagePackagesUpdate(t *testing.T) {
212212}
213213
214214func TestCustomizeImagePackagesDiskSpace (t * testing.T ) {
215- baseImage := checkSkipForCustomizeImage ( t , baseImageTypeCoreEfi , baseImageVersionDefault )
215+ baseImage , _ := checkSkipForCustomizeDefaultImage ( t )
216216
217217 testTmpDir := filepath .Join (tmpDir , "TestCustomizeImagePackagesDiskSpace" )
218218 buildDir := filepath .Join (testTmpDir , "build" )
@@ -228,7 +228,8 @@ func TestCustomizeImagePackagesDiskSpace(t *testing.T) {
228228}
229229
230230func TestCustomizeImagePackagesUrlSource (t * testing.T ) {
231- baseImage := checkSkipForCustomizeImage (t , baseImageTypeCoreEfi , baseImageVersionAzl3 )
231+ baseImageInfo := testBaseImageAzl3CoreEfi
232+ baseImage := checkSkipForCustomizeImage (t , baseImageInfo )
232233
233234 testTmpDir := filepath .Join (tmpDir , "TestCustomizeImagePackagesUrlSource" )
234235 buildDir := filepath .Join (testTmpDir , "build" )
@@ -258,7 +259,8 @@ func TestCustomizeImagePackagesUrlSource(t *testing.T) {
258259}
259260
260261func TestCustomizeImagePackagesBadRepo (t * testing.T ) {
261- baseImage := checkSkipForCustomizeImage (t , baseImageTypeCoreEfi , baseImageVersionAzl3 )
262+ baseImageInfo := testBaseImageAzl3CoreEfi
263+ baseImage := checkSkipForCustomizeImage (t , baseImageInfo )
262264
263265 testTmpDir := filepath .Join (tmpDir , "TestCustomizeImagePackagesBadRepo" )
264266 buildDir := filepath .Join (testTmpDir , "build" )
@@ -274,7 +276,9 @@ func TestCustomizeImagePackagesBadRepo(t *testing.T) {
274276 assert .ErrorContains (t , err , "failed to refresh tdnf repo metadata" )
275277}
276278
277- func ensureTdnfCacheCleanup (t * testing.T , imageConnection * ImageConnection , dirPath string ) {
279+ func ensureTdnfCacheCleanup (t * testing.T , imageConnection * ImageConnection , dirPath string ,
280+ baseImageInfo testBaseImageInfo ,
281+ ) {
278282 // Array to capture all the files of the provided root directory
279283 var existingFiles []string
280284
@@ -285,7 +289,7 @@ func ensureTdnfCacheCleanup(t *testing.T, imageConnection *ImageConnection, dirP
285289 return fmt .Errorf ("Failed to access path (%s): %w" , path , err )
286290 }
287291 // Ignore files in the local-repo folder if the base image version is 2.0
288- if ! (strings .Contains (path , "local-repo" ) && baseImageVersionDefault == "2.0" ) {
292+ if ! (strings .Contains (path , "local-repo" ) && baseImageInfo . Version == baseImageVersionAzl2 ) {
289293 fileInfo , err := os .Stat (path )
290294 if err != nil {
291295 return fmt .Errorf ("failed to get file info for %s: %w" , path , err )
@@ -307,7 +311,8 @@ func ensureTdnfCacheCleanup(t *testing.T, imageConnection *ImageConnection, dirP
307311func TestCustomizeImagePackagesSnapshotTime (t * testing.T ) {
308312 testTmpDir := filepath .Join (tmpDir , "TestCustomizeImagePackagesSnapshotTime" )
309313
310- baseImage := checkSkipForCustomizeImage (t , baseImageTypeCoreEfi , baseImageVersionAzl3 )
314+ baseImageInfo := testBaseImageAzl3CoreEfi
315+ baseImage := checkSkipForCustomizeImage (t , baseImageInfo )
311316 buildDir := filepath .Join (testTmpDir , "build" )
312317 outImageFilePath := filepath .Join (testTmpDir , "image.raw" )
313318
@@ -355,7 +360,8 @@ func TestCustomizeImagePackagesSnapshotTime(t *testing.T) {
355360func TestCustomizeImagePackagesCliSnapshotTimeOverridesConfigFile (t * testing.T ) {
356361 testTmpDir := filepath .Join (tmpDir , "TestCustomizeImagePackagesSnapshotTime" )
357362
358- baseImage := checkSkipForCustomizeImage (t , baseImageTypeCoreEfi , baseImageVersionAzl3 )
363+ baseImageInfo := testBaseImageAzl3CoreEfi
364+ baseImage := checkSkipForCustomizeImage (t , baseImageInfo )
359365 buildDir := filepath .Join (testTmpDir , "build" )
360366 outImageFilePath := filepath .Join (testTmpDir , "image.raw" )
361367 snapshotTimeConfig := "2025-03-19"
@@ -403,7 +409,8 @@ func TestCustomizeImagePackagesCliSnapshotTimeOverridesConfigFile(t *testing.T)
403409func TestCustomizeImagePackagesSnapshotTimeWithoutPreviewFlagFails (t * testing.T ) {
404410 testTmpDir := filepath .Join (tmpDir , "TestCustomizeImagePackagesSnapshotTimeWithoutPreviewFlagFails" )
405411
406- baseImage := checkSkipForCustomizeImage (t , baseImageTypeCoreEfi , baseImageVersionAzl3 )
412+ baseImageInfo := testBaseImageAzl3CoreEfi
413+ baseImage := checkSkipForCustomizeImage (t , baseImageInfo )
407414
408415 buildDir := filepath .Join (testTmpDir , "build" )
409416 outImageFilePath := filepath .Join (testTmpDir , "image.raw" )
0 commit comments