@@ -4321,6 +4321,7 @@ var _ = Describe("Testing OperatorPolicy", Label("supports-hosted"), func() {
43214321 Describe ("Test changes to subscription config and operator group selector" , Ordered , func () {
43224322 const (
43234323 policyYAML = "../resources/case38_operator_install/operator-policy-with-group-and-config.yaml"
4324+ subName = "example-operator"
43244325 )
43254326
43264327 var (
@@ -4338,6 +4339,39 @@ var _ = Describe("Testing OperatorPolicy", Label("supports-hosted"), func() {
43384339 setupPolicy (policyYAML , policyName , parentPolicyName )
43394340 })
43404341
4342+ AfterAll (func () {
4343+ By ("Getting the subscription details for debugging" )
4344+ Eventually (func (g Gomega ) {
4345+ sub , err := targetK8sDynamic .Resource (gvrSubscription ).Namespace (opPolTestNS ).
4346+ Get (context .TODO (), subName , metav1.GetOptions {})
4347+ g .Expect (err ).NotTo (HaveOccurred (), "Failed to get subscription" )
4348+
4349+ subJSON , err := json .MarshalIndent (sub .Object , "" , " " )
4350+ g .Expect (err ).NotTo (HaveOccurred ())
4351+
4352+ GinkgoWriter .Println ("=== Subscription Details ===" )
4353+ GinkgoWriter .Printf ("Name: %s\n " , sub .GetName ())
4354+ GinkgoWriter .Printf ("Namespace: %s\n " , sub .GetNamespace ())
4355+
4356+ // Print spec details
4357+ if spec , found , _ := unstructured .NestedMap (sub .Object , "spec" ); found {
4358+ specJSON , _ := json .MarshalIndent (spec , "" , " " )
4359+ GinkgoWriter .Printf ("Spec:\n %s\n " , string (specJSON ))
4360+ }
4361+
4362+ // Print status details
4363+ if status , found , _ := unstructured .NestedMap (sub .Object , "status" ); found {
4364+ statusJSON , _ := json .MarshalIndent (status , "" , " " )
4365+ GinkgoWriter .Printf ("Status:\n %s\n " , string (statusJSON ))
4366+ } else {
4367+ GinkgoWriter .Println ("Status: (no status found)" )
4368+ }
4369+
4370+ GinkgoWriter .Printf ("\n Full Subscription JSON:\n %s\n " , string (subJSON ))
4371+ GinkgoWriter .Println ("===========================" )
4372+ }, eventuallyTimeout , 1 ).Should (Succeed ())
4373+ })
4374+
43414375 It ("Should be able to update the subscription when the policy changes" , func (ctx SpecContext ) {
43424376 By ("Verifying the initial state of the policy" )
43434377 check (
0 commit comments