@@ -40,6 +40,43 @@ func skipArch(oc *exutil.CLI, arches []string) bool {
4040 return true
4141}
4242
43+ // waitForImageStreamTag waits for a specific imagestream tag to be available in the registry
44+ // with a timeout of 5 minutes
45+ func waitForImageStreamTag (oc * exutil.CLI , imageName , tagName string ) error {
46+ e2e .Logf ("waiting for imagestream %s:%s to be available in openshift namespace" , imageName , tagName )
47+
48+ timeout := 5 * time .Minute
49+ err := wait .Poll (10 * time .Second , timeout , func () (bool , error ) {
50+ is , err := oc .AsAdmin ().ImageClient ().ImageV1 ().ImageStreams ("openshift" ).Get (context .Background (), imageName , metav1.GetOptions {})
51+ if err != nil {
52+ e2e .Logf ("failed to get imagestream %s: %v" , imageName , err )
53+ return false , nil
54+ }
55+
56+ // Check if the specific tag exists and has been imported
57+ for _ , tag := range is .Status .Tags {
58+ if tag .Tag == tagName && len (tag .Items ) > 0 {
59+ e2e .Logf ("imagestream %s:%s is available with %d items" , imageName , tagName , len (tag .Items ))
60+ return true , nil
61+ }
62+ }
63+
64+ e2e .Logf ("imagestream %s exists but tag %s is not ready yet" , imageName , tagName )
65+ return false , nil
66+ })
67+
68+ if err != nil {
69+ // Dump imagestream for debugging
70+ out , dumpErr := oc .AsAdmin ().Run ("get" ).Args ("is" , imageName , "-n" , "openshift" , "-o" , "yaml" ).Output ()
71+ if dumpErr == nil {
72+ e2e .Logf ("imagestream %s details:\n %s" , imageName , out )
73+ }
74+ return fmt .Errorf ("timed out waiting for imagestream %s:%s after %v: %v" , imageName , tagName , timeout , err )
75+ }
76+
77+ return nil
78+ }
79+
4380// defineTest will create the gingko test. This ensures the test
4481// is created with a local copy of all variables the test will need,
4582// since the test may not run immediately and may run in parallel with other
@@ -54,6 +91,14 @@ func defineTest(name string, t tc, oc *exutil.CLI) {
5491 return
5592 }
5693 e2e .Logf ("%s:%s passed architecture compatibility" , name , t .Tag )
94+
95+ // Wait for dotnet imagestream to be available in the registry
96+ if name == "dotnet" {
97+ g .By (fmt .Sprintf ("waiting for imagestream %s:%s to be available" , name , t .Tag ))
98+ err := waitForImageStreamTag (oc , name , t .Tag )
99+ o .Expect (err ).NotTo (o .HaveOccurred ())
100+ }
101+
57102 g .By (fmt .Sprintf ("creating a sample pod for %q" , t .DockerImageReference ))
58103 pod := exutil .GetPodForContainer (kapiv1.Container {
59104 Name : "test" ,
@@ -106,6 +151,14 @@ func defineTest(name string, t tc, oc *exutil.CLI) {
106151 return
107152 }
108153 e2e .Logf ("%s:%s passed architecture compatibility" , name , t .Tag )
154+
155+ // Wait for dotnet imagestream to be available in the registry
156+ if name == "dotnet" {
157+ g .By (fmt .Sprintf ("waiting for imagestream %s:%s to be available" , name , t .Tag ))
158+ err := waitForImageStreamTag (oc , name , t .Tag )
159+ o .Expect (err ).NotTo (o .HaveOccurred ())
160+ }
161+
109162 g .By (fmt .Sprintf ("creating a sample pod for %q with /bin/bash -c command" , t .DockerImageReference ))
110163 pod := exutil .GetPodForContainer (kapiv1.Container {
111164 Image : t .DockerImageReference ,
0 commit comments