@@ -223,10 +223,32 @@ var _ = Describe("OLM deployment", Ordered, Label("olm"), func() {
223223 _ = testutil .UninstallCRDs (ctx )
224224 })
225225
226+ DeferCleanup (func (ctx context.Context ) {
227+ if ! CurrentSpecReport ().Failed () {
228+ return
229+ }
230+
231+ By ("dumping OLM state for debugging" )
232+
233+ for _ , resource := range []string {"catalogsources" , "subscriptions" , "installplans" , "clusterserviceversions" } {
234+ out , _ := testutil .Run (exec .CommandContext (ctx , "kubectl" , "get" , resource ,
235+ "-n" , namespace , "-o" , "wide" ))
236+ AddReportEntry ("=== OLM " + resource , string (out ))
237+ }
238+ })
239+
226240 By ("waiting for catalog server to be ready" )
227241 runCmd (ctx , "kubectl" , "wait" , "-n" , namespace , "--timeout=120s" ,
228242 "--for=condition=Ready" , "pod/test-catalog-server" )
229243
244+ By ("waiting for ClusterServiceVersion to succeed" )
245+ Eventually (func (g Gomega ) {
246+ out , err := testutil .Run (exec .CommandContext (ctx , "kubectl" , "get" , "csv" ,
247+ "-n" , namespace , "--no-headers" , "-o" , "custom-columns=PHASE:.status.phase" ))
248+ g .Expect (err ).ToNot (HaveOccurred (), string (out ))
249+ g .Expect (strings .TrimSpace (string (out ))).To (Equal ("Succeeded" ), "CSV phase: %s" , strings .TrimSpace (string (out )))
250+ }, "5m" , "5s" ).Should (Succeed ())
251+
230252 By ("Waiting controller to be ready" )
231253 Eventually (func (g Gomega ) {
232254 out , err := testutil .Run (exec .CommandContext (ctx , "kubectl" , "wait" , "-n" , namespace ,
0 commit comments