@@ -787,9 +787,15 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
787787 o .Expect (err ).NotTo (o .HaveOccurred ())
788788
789789 g .By ("create role for ns watch" )
790- defer func () { _ = oc .AsAdmin ().WithoutNamespace ().Run ("delete" ).Args ("-f" , roleNsWatchFile ).Execute () }()
791- err = oc .AsAdmin ().WithoutNamespace ().Run ("apply" ).Args ("-f" , roleNsWatchFile ).Execute ()
792- o .Expect (err ).NotTo (o .HaveOccurred ())
790+ // Check if the watch namespace role file exists before trying to apply it
791+ // The file may not exist if no permissions are needed for the watch namespace
792+ if _ , err := os .Stat (roleNsWatchFile ); err == nil {
793+ defer func () { _ = oc .AsAdmin ().WithoutNamespace ().Run ("delete" ).Args ("-f" , roleNsWatchFile ).Execute () }()
794+ err = oc .AsAdmin ().WithoutNamespace ().Run ("apply" ).Args ("-f" , roleNsWatchFile ).Execute ()
795+ o .Expect (err ).NotTo (o .HaveOccurred ())
796+ } else {
797+ e2e .Logf ("Watch namespace role file %s does not exist, skipping creation" , roleNsWatchFile )
798+ }
793799
794800 g .By ("create binding" )
795801 paremeters = []string {"-n" , "default" , "--ignore-unknown-parameters=true" , "-f" , bindingTemplate , "-p" ,
@@ -918,7 +924,7 @@ var _ = g.Describe("[sig-olmv1][Jira:OLM] clusterextension", g.Label("NonHyperSh
918924 g .By ("check non all ns mode fails to be installed." )
919925 defer ceNAN .Delete (oc )
920926 _ = ceNAN .CreateWithoutCheck (oc )
921- ceNAN .CheckClusterExtensionCondition (oc , "Progressing" , "message" , "do not support targeting all namespaces " , 10 , 180 , 0 )
927+ ceNAN .CheckClusterExtensionCondition (oc , "Progressing" , "message" , "bundle does not support AllNamespaces install mode " , 10 , 180 , 0 )
922928 ceNAN .CheckClusterExtensionCondition (oc , "Installed" , "reason" , "Failed" , 10 , 180 , 0 )
923929 ceNAN .Delete (oc )
924930 }
0 commit comments