-
Notifications
You must be signed in to change notification settings - Fork 420
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Find root cause for why reconciler tests were not failing #1245
Comments
@wlynch @lbernick and I were looking into this. We found that the main cause was the ignore function we were using. We were using ObjectMeta.Finalizers has type []string which meant that the test was ignore all []string types in comparison (like the container args) field. To fix, we should move to @wlynch also found that we were using |
IgnoreTypes will ignore all values of the given type i.e. for apis.Condition{}.LastTransitionTime.Inner.Time, it will ignore all instances of time.Time. Using `cmpopts.IgnoreFields` will only ignore the specific field. This was the root cause behind tektoncd#1245 since we were ignoring all []string values while trying to ignore only objectMeta.Finalizer (which is of type []string) Signed-off-by: Dibyo Mukherjee <[email protected]> Fixes tektoncd#1245
IgnoreTypes will ignore all values of the given type i.e. for apis.Condition{}.LastTransitionTime.Inner.Time, it will ignore all instances of time.Time. Using `cmpopts.IgnoreFields` will only ignore the specific field. This was the root cause behind tektoncd#1245 since we were ignoring all []string values while trying to ignore only objectMeta.Finalizer (which is of type []string) Fixes tektoncd#1245 Signed-off-by: Dibyo Mukherjee <[email protected]>
IgnoreTypes will ignore all values of the given type i.e. for apis.Condition{}.LastTransitionTime.Inner.Time, it will ignore all instances of time.Time. Using `cmpopts.IgnoreFields` will only ignore the specific field. This was the root cause behind #1245 since we were ignoring all []string values while trying to ignore only objectMeta.Finalizer (which is of type []string) Fixes #1245 Signed-off-by: Dibyo Mukherjee <[email protected]>
Expected Behavior
Reconciler tests should fail when expected test output does not match actual output.
Actual Behavior
Our reconciler tests were passing when expected test output did not match actual output 😱 😱
While working on #1244 I noticed that our reconciler tests were ignoring
metav1.ObjectMeta.Finalizers
for test output comparison. I decided to remove that line since we are no longer using Finalizers since #1207On removing that line though, I noticed a bunch of our tests started failing. Specifically the expected container args field in the deployment did not match the actual container args in the deployment. I verified that the actual container args were correct and that the expected values in the test were wrong. We did not update the tests when we moved the args field from
-foo
,value
to the--foo=value
pattern.I fixed the tests but did not investigate the root cause.
We should find out why our unit tests were wrong i.e not comparing the values correctly.
The text was updated successfully, but these errors were encountered: