@@ -37,14 +37,23 @@ import (
3737)
3838
3939var _ = Describe ("[sig-olmv1][OCPFeatureGate:NewOLM][Skipped:Disconnected] OLMv1 operator installation" , func () {
40+ var unique , nsName , ccName , rbName , opName string
4041 BeforeEach (func () {
4142 helpers .RequireOLMv1CapabilityOnOpenshift ()
43+ unique = rand .String (8 )
44+ nsName = "install-test-ns-" + unique
45+ ccName = "install-test-cc-" + unique
46+ rbName = "install-test-rb-" + unique
47+ opName = "install-test-op-" + unique
48+ })
49+
50+ AfterEach (func (ctx SpecContext ) {
51+ if CurrentSpecReport ().Failed () {
52+ By ("dumping for debugging" )
53+ helpers .DescribeAllClusterCatalogs (context .Background ())
54+ helpers .DescribeAllClusterExtensions (context .Background (), nsName )
55+ }
4256 })
43- unique := rand .String (8 )
44- nsName := "install-test-ns-" + unique
45- ccName := "install-test-cc-" + unique
46- rbName := "install-test-rb-" + unique
47- opName := "install-test-op-" + unique
4857 It ("should block cluster upgrades if an incompatible operator is installed" , func (ctx SpecContext ) {
4958 if ! env .Get ().IsOpenShift {
5059 Skip ("Requires OCP APIs: not OpenShift" )
@@ -316,6 +325,15 @@ func waitForBuildToFinish(ctx SpecContext, name, namespace string) {
316325 g .Expect (cond ).ToNot (BeNil ())
317326 g .Expect (cond .Status ).To (Equal (corev1 .ConditionTrue ))
318327 }).WithTimeout (5 * time .Minute ).WithPolling (1 * time .Second ).Should (Succeed ())
328+
329+ DeferCleanup (func () {
330+ if CurrentSpecReport ().Failed () {
331+ if CurrentSpecReport ().Failed () {
332+ helpers .RunAndPrint (context .Background (), "get" , "build" , name , "-n" , namespace , "-oyaml" )
333+ helpers .RunAndPrint (context .Background (), "logs" , fmt .Sprintf ("build/%s" , name ), "-n" , namespace , "--tail=200" )
334+ }
335+ }
336+ })
319337}
320338
321339func waitForClusterCatalogServing (ctx context.Context , name string ) {
0 commit comments