@@ -291,6 +291,65 @@ func TestIDMS_ITMSGenerator(t *testing.T) {
291291 }
292292}
293293
294+ // verifyNoStatusField checks that a YAML file (if it exists) does not contain a 'status' field.
295+ func verifyNoStatusField (t * testing.T , filePath string ) {
296+ t .Helper ()
297+ if _ , err := os .Stat (filePath ); err != nil {
298+ return
299+ }
300+
301+ yamlData , err := parser.ParseYamlFile [map [string ]any ](filePath )
302+ assert .NoError (t , err )
303+
304+ assert .NotContains (t , yamlData , "status" )
305+ }
306+
307+ func TestIDMS_ITMS_NoStatusField (t * testing.T ) {
308+ log := clog .New ("trace" )
309+
310+ type testCase struct {
311+ caseName string
312+ imgList []v2alpha1.CopyImageSchema
313+ }
314+ testCases := []testCase {
315+ {
316+ caseName : "Testing ITMS file does not contain status field - release use case" ,
317+ imgList : imageListRelease ,
318+ },
319+ {
320+ caseName : "Testing IDMS and ITMS files do not contain status field - mixed images" ,
321+ imgList : imageListMixed ,
322+ },
323+ {
324+ caseName : "Testing IDMS file does not contain status field - digests only" ,
325+ imgList : imageListDigestsOnly ,
326+ },
327+ }
328+
329+ for _ , testCase := range testCases {
330+ t .Run (testCase .caseName , func (t * testing.T ) {
331+ tmpDir := t .TempDir ()
332+ workingDir := tmpDir + "/working-dir"
333+
334+ cr := & ClusterResourcesGenerator {
335+ Log : log ,
336+ WorkingDir : workingDir ,
337+ LocalStorageFQDN : "localhost:55000" ,
338+ }
339+
340+ err := cr .IDMS_ITMSGenerator (testCase .imgList , false )
341+ assert .NoError (t , err )
342+
343+ // Check IDMS and ITMS files
344+ idmsPath := filepath .Join (workingDir , clusterResourcesDir , "idms-oc-mirror.yaml" )
345+ itmsPath := filepath .Join (workingDir , clusterResourcesDir , "itms-oc-mirror.yaml" )
346+
347+ verifyNoStatusField (t , idmsPath )
348+ verifyNoStatusField (t , itmsPath )
349+ })
350+ }
351+ }
352+
294353func TestGenerateIDMS (t * testing.T ) {
295354 log := clog .New ("trace" )
296355
0 commit comments