Skip to content

Commit ce96f9b

Browse files
committed
DROP ME: install plan debug info
Signed-off-by: Janelle Law <[email protected]>
1 parent 43a1ae6 commit ce96f9b

File tree

1 file changed

+70
-0
lines changed

1 file changed

+70
-0
lines changed

test/e2e/case38_install_operator_test.go

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1670,6 +1670,76 @@ var _ = Describe("Testing OperatorPolicy", Label("supports-hosted"), func() {
16701670
"the InstallPlan.*36.*was approved",
16711671
)
16721672
})
1673+
1674+
AfterAll(func(ctx SpecContext) {
1675+
By("Fetching and printing Subscription details")
1676+
sub, err := targetK8sDynamic.Resource(gvrSubscription).Namespace(opPolTestNS).
1677+
Get(ctx, subName, metav1.GetOptions{})
1678+
1679+
if err != nil {
1680+
GinkgoWriter.Printf("Error fetching Subscription: %v\n", err)
1681+
} else if sub != nil {
1682+
subJSON, _ := json.MarshalIndent(sub.Object, "", " ")
1683+
1684+
GinkgoWriter.Println("=== Subscription Details ===")
1685+
GinkgoWriter.Printf("Name: %s\n", sub.GetName())
1686+
GinkgoWriter.Printf("Namespace: %s\n", sub.GetNamespace())
1687+
1688+
// Print spec details
1689+
if spec, found, _ := unstructured.NestedMap(sub.Object, "spec"); found {
1690+
specJSON, _ := json.MarshalIndent(spec, "", " ")
1691+
GinkgoWriter.Printf("Spec:\n%s\n", string(specJSON))
1692+
}
1693+
1694+
// Print status details
1695+
if status, found, _ := unstructured.NestedMap(sub.Object, "status"); found {
1696+
statusJSON, _ := json.MarshalIndent(status, "", " ")
1697+
GinkgoWriter.Printf("Status:\n%s\n", string(statusJSON))
1698+
} else {
1699+
GinkgoWriter.Println("Status: (no status found)")
1700+
}
1701+
1702+
GinkgoWriter.Printf("\nFull Subscription JSON:\n%s\n", string(subJSON))
1703+
GinkgoWriter.Println("===========================")
1704+
} else {
1705+
GinkgoWriter.Println("Subscription not found")
1706+
}
1707+
1708+
By("Fetching and printing InstallPlan details")
1709+
ipList, err := targetK8sDynamic.Resource(gvrInstallPlan).Namespace(opPolTestNS).
1710+
List(ctx, metav1.ListOptions{})
1711+
1712+
if err != nil {
1713+
GinkgoWriter.Printf("Error fetching InstallPlans: %v\n", err)
1714+
} else {
1715+
GinkgoWriter.Printf("\n=== InstallPlans (Count: %d) ===\n", len(ipList.Items))
1716+
for i, ip := range ipList.Items {
1717+
ipJSON, _ := json.MarshalIndent(ip.Object, "", " ")
1718+
1719+
GinkgoWriter.Printf("\n--- InstallPlan %d ---\n", i+1)
1720+
GinkgoWriter.Printf("Name: %s\n", ip.GetName())
1721+
GinkgoWriter.Printf("Namespace: %s\n", ip.GetNamespace())
1722+
1723+
// Print spec details
1724+
if spec, found, _ := unstructured.NestedMap(ip.Object, "spec"); found {
1725+
specJSON, _ := json.MarshalIndent(spec, "", " ")
1726+
GinkgoWriter.Printf("Spec:\n%s\n", string(specJSON))
1727+
}
1728+
1729+
// Print status details
1730+
if status, found, _ := unstructured.NestedMap(ip.Object, "status"); found {
1731+
statusJSON, _ := json.MarshalIndent(status, "", " ")
1732+
GinkgoWriter.Printf("Status:\n%s\n", string(statusJSON))
1733+
} else {
1734+
GinkgoWriter.Println("Status: (no status found)")
1735+
}
1736+
1737+
GinkgoWriter.Printf("\nFull InstallPlan JSON:\n%s\n", string(ipJSON))
1738+
GinkgoWriter.Printf("--- End InstallPlan %d ---\n", i+1)
1739+
}
1740+
GinkgoWriter.Println("===========================")
1741+
}
1742+
})
16731743
})
16741744

16751745
Describe("Testing OperatorPolicy validation messages", Ordered, func() {

0 commit comments

Comments
 (0)