Skip to content

Commit

Permalink
Add debugging for missing ResolutionFailed cond
Browse files Browse the repository at this point in the history
Suddenly this test is frequently failing in our CI, but I haven't had it
happen locally, and I don't see any obvious recent changes that might
affect this.

Signed-off-by: Justin Kulikauskas <jkulikau@redhat.com>
  • Loading branch information
JustinKuli committed Apr 30, 2024
1 parent cb0cf48 commit 21f066d
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion test/e2e/case38_install_operator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1073,8 +1073,10 @@ var _ = Describe("Testing OperatorPolicy", Ordered, func() {
})

It("Should initially report the ConstraintsNotSatisfiable Subscription", func(ctx SpecContext) {
var sub *unstructured.Unstructured

Eventually(func(ctx SpecContext) interface{} {
sub, _ := clientManagedDynamic.Resource(gvrSubscription).Namespace(opPolTestNS).
sub, _ = clientManagedDynamic.Resource(gvrSubscription).Namespace(opPolTestNS).
Get(ctx, subName, metav1.GetOptions{})

if sub == nil {
Expand All @@ -1096,6 +1098,21 @@ var _ = Describe("Testing OperatorPolicy", Ordered, func() {

return nil
}, olmWaitTimeout, 5, ctx).Should(Equal("True"))

// Sometimes the subscription does not seem to have the expected "ConstraintsNotSatisfiable" condition
var debugMessage string

DeferCleanup(func() {
if CurrentSpecReport().Failed() {
GinkgoWriter.Println(debugMessage)
}
})

unstructured.RemoveNestedField(sub.Object, "metadata", "managedFields")
subJSON, err := json.MarshalIndent(sub.Object, "", " ")
Expect(err).NotTo(HaveOccurred())
debugMessage = fmt.Sprintf("Debug JSON of subscription: %s\n", subJSON)

check(
opPolName,
true,
Expand Down

0 comments on commit 21f066d

Please sign in to comment.