objectTracker supports out-of-order expectations and observations.
However, if an unexpected observation is made and never subsequently expected, the tracker will never reach its "satisfied" state.
Is this expected behavior or a bug?
Consider the following test which currently fails:
// Verify that unexpected observations do not prevent the tracker from reaching its satisfied state.
func Test_ObjectTracker_Unexpected_Does_Not_Prevent_Satisfied(t *testing.T) {
g := gomega.NewWithT(t)
ot := newObjTracker(schema.GroupVersionKind{})
ct := makeCT("test-ct")
ot.Observe(ct)
g.Expect(ot.Satisfied()).NotTo(gomega.BeTrue(), "unpopulated tracker should not be satisfied")
// ** Do not expect the above observation **
ot.ExpectationsDone()
g.Expect(ot.Satisfied()).To(gomega.BeTrue(), "should have been satisfied")
}
This is currently due to how needMutate is calculated in objectTracker.Satisfied.
objectTracker
supports out-of-order expectations and observations. However, if an unexpected observation is made and never subsequently expected, the tracker will never reach its "satisfied" state.Is this expected behavior or a bug?
Consider the following test which currently fails:
This is currently due to how
needMutate
is calculated inobjectTracker.Satisfied
.