pkg/controller/certificates/trigger/trigger_controller_test.go:257:12: if block ends with a return statement, so drop this else and outdent its block
Signed-off-by: Richard Wall <richard.wall@jetstack.io>
Note that I had initially made createCryptoBundle public since I found
it inconvenient to have to pass a testing.T when we know that we should
never be failing inside this func (I mean, the failure zould not be due
to a wrong test case).
After a comment from Maartje, I realize that I could just use an anonymous
function for that purpose.
Signed-off-by: Maël Valais <mael@vls.dev>
Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
Injecting the whole Gatherer struct was not necessary for testing
since DataForCertificate is now fully unit-tested. With that, we
can mock the Gatherer.Evaluate function. Since there is no reason
to inject a full Gatherer object into the trigger controller, I chose
to inject a simple policies.Func. I named the function "shouldReissue"
since this is exactly what this function does.
I also refactored the test cases to use the same gen.Certificate
that we use in the rest of the codebase.
Signed-off-by: Maël Valais <mael@vls.dev>
As Maartje mentioned, it doesn't make sense to return backoff = true
while returning a delay of 0. Also, use time.UTC instead of time.Local.
Signed-off-by: Maël Valais <mael.valais@gmail.com>
The trigger_controller_test.go has many unrelated test cases and I
thought it would be good to have more tightly scoped functions that are
easy to review (and most importantly, the unit tests are easy to
review).
Signed-off-by: Maël Valais <mael.valais@gmail.com>