Commit Graph
2146 Commits
Author SHA1 Message Date
joshvanl f905f6a2aa Adds ObservedGeneration to issuer condition status
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-03-15 15:04:00 +00:00
jetstack-botandGitHub 70c66e02a0 Merge pull request #3641 from JoshVanL/certificate-request-identity
CertificateRequest UserInfo fields
2021-03-15 14:26:15 +00:00
irbekrm 0047174891 Update PR after rebase
Signed-off-by: irbekrm <irbekrm@gmail.com>
2021-03-15 09:00:07 +00:00
irbekrmandMaël Valais a89133b637 Better wording and wrap long comment lines.
Co-authored-by: Maël Valais <mael@vls.dev>
Signed-off-by: irbekrm <irbekrm@gmail.com>
2021-03-15 08:48:23 +00:00
irbekrm 245d0f5c27 Pass DefaultRenewBefore into trigger controller
Signed-off-by: irbekrm <irbekrm@gmail.com>
2021-03-15 08:48:02 +00:00
irbekrm 8d5059b13e Updates Trigger controller integration tests
Signed-off-by: irbekrm <irbekrm@gmail.com>
2021-03-15 08:47:42 +00:00
irbekrm 9e7cd99ea8 CurrentCertificateNearingExpiry looks at x509 cert to determine renewal time
Signed-off-by: irbekrm <irbekrm@gmail.com>
2021-03-15 08:44:14 +00:00
joshvanl 4dd6d19011 Adds review comment suggestions/cleanup
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-03-11 19:12:02 +00:00
joshvanl 1b82802159 Changes Vault error messages with auth has been misconfigured for each
method

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-03-11 11:19:00 +00:00
jetstack-botandGitHub 9f343ec581 Merge pull request #3475 from maelvls/unit-test-dataforcertificate
DataForCertificate: add unit tests
2021-03-09 18:13:51 +00:00
Ashley Davis ef2006d7b6 skip clouddns test when gcloud isn't initialized
If gcloud hasn't been installed, or if it has but the default application credential file
at .config/gcloud/application_default_credentials.json hasn't been configured, this test
would segfault since the assertion at the start fails but doesn't stop the test

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-03-09 14:54:12 +00:00
jetstack-botandGitHub c2634d3538 Merge pull request #3613 from JoshVanL/certificate-condition-observed-generation
Certificate condition observed generation
2021-03-08 09:47:45 +00:00
Maël Valais f6cb6b8787 ocspServers test: give a link to the TODO issue
Signed-off-by: Maël Valais <mael@vls.dev>
2021-03-05 16:57:38 +01:00
Maël ValaisandJosh Soref 97893e1c69 PR comment: fix misspelling
Signed-off-by: Maël Valais <mael@vls.dev>
Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2021-03-05 16:42:48 +01:00
jetstack-botandGitHub 75a46ff90b Merge pull request #3731 from jsoref/spelling
Spelling
2021-03-05 13:58:40 +00:00
Josh Soref e9fe56594c spelling: wrapped
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2021-03-04 13:04:38 -05:00
Josh Soref 3b957488c3 spelling: will
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2021-03-04 13:04:38 -05:00
Josh Soref edda3b39e3 spelling: violations
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2021-03-04 13:04:38 -05:00
Josh Soref cb22798289 spelling: validate
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2021-03-04 13:04:38 -05:00
Josh Soref 1cd3ab0db8 spelling: tenant
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2021-03-04 13:04:38 -05:00
Josh Soref ae06c26202 spelling: secret
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2021-03-04 13:04:38 -05:00
Josh Soref d848dfe105 spelling: prometheus
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2021-03-04 13:04:38 -05:00
Josh Soref 4d84a7fbb1 spelling: preferred
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2021-03-04 13:04:38 -05:00
Josh Soref a11c7873f1 spelling: object
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2021-03-04 13:04:38 -05:00
Josh Soref d5eca4e4e3 spelling: normalize
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2021-03-04 13:04:38 -05:00
Josh Soref 895cb51ed9 spelling: nonexistent
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2021-03-04 13:04:38 -05:00
Josh Soref 6b3cf75fdf spelling: instrumented
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2021-03-04 13:04:38 -05:00
joshvanl 39a50a1903 Updates unit certificate controller tests to include ObservedGeneration
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-03-04 17:04:09 +00:00
joshvanl ca60357df3 Adds ObservedGeneration to SetCertificateCondition func
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-03-04 17:03:26 +00:00
joshvanl 6b551b2add Updates generated conversion for OverservedGeneration
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-03-04 17:03:26 +00:00
joshvanl efdb73b446 Adds ObservedGeneration int64 field to Certificate Conditions
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-03-04 17:03:26 +00:00
Maël Valais 0facd3bdd4 ocspServers field: fix flaky unit test
Truncating the time to the second did not seem to be enough. Some CI
builds would fail due to the truncation yielding different times.

Instead of truncating, I propose to use a delta of 1 second.

Signed-off-by: Maël Valais <mael@vls.dev>
2021-03-04 17:20:51 +01:00
Maël Valais 34c07a71ce DataForCertificate: force core/v1 informer to create the indexer
Signed-off-by: Maël Valais <mael@vls.dev>
2021-03-04 17:20:50 +01:00
Maël Valais ac325bf4e0 PR comment: spelling
Signed-off-by: Maël Valais <mael@vls.dev>
2021-03-04 17:20:50 +01:00
Maël Valais 680c7b75f6 DataForCertificate: use fake clientset instead of fake lister
Signed-off-by: Maël Valais <mael@vls.dev>
2021-03-04 17:20:45 +01:00
Maël Valais 46e9cb6c5b DataForCertificates: remove unused "name" field
Signed-off-by: Maël Valais <mael@vls.dev>
2021-03-04 17:19:02 +01:00
Maël Valais 3af2cb6650 DataForCertificate: expand comments around expectCalled
Signed-off-by: Maël Valais <mael@vls.dev>
2021-03-04 17:19:02 +01:00
Maël Valais e0ca10ef2d DataForCertificate: detail why "whereAmI" is used
Signed-off-by: Maël Valais <mael@vls.dev>
2021-03-04 17:19:02 +01:00
Maël Valais 65701e04ab DataForCertificate: check fake is called with correct input
Signed-off-by: Maël Valais <mael@vls.dev>
2021-03-04 17:19:01 +01:00
Maël ValaisandJoshVanL 8b3bec3c9c DataForCertificate: implement Josh's fake idea
Co-Authored-By: JoshVanL <vleeuwenjoshua@gmail.com>
Signed-off-by: Maël Valais <mael@vls.dev>
2021-03-04 17:18:56 +01:00
Maël Valais 38919b7eb2 DataForCertificate: move certRef to test/unit/gen
Signed-off-by: Maël Valais <mael@vls.dev>
2021-03-04 17:16:16 +01:00
Maël Valais 92bf3c59a0 DataForCertificate: fix tests
Signed-off-by: Maël Valais <mael@vls.dev>
2021-03-04 17:16:16 +01:00
Maël Valais 5c1fba52a5 Mock lister: fix the wrong stack frames for certificaterequests
The stack frames displayed using assert.Fail was not very informative.
That is due to t.Cleanup being called "outside" of the test case
context. There was no mention of the test file itself, gatherer_test.go
in the following example:

 certificaterequest.go:205:
         Error Trace:    certificaterequest.go:205
                                                 testing.go:872
                                                 testing.go:866
                                                 testing.go:873
                                                 testing.go:949
                                                 testing.go:1121
         Error:          lister.CertificateRequests was expected to be called but was not called
         Test:           TestDataForCertificate/should_return_error_when_the_list_func_returns_an_error

With this patch that vendors a simple version of assert.Fail, we get the
correct stack frames that the user needs in order to locate where this
failure happened:

 certificaterequest.go:254:
         Error Trace:    gatherer_test.go:230
                         gatherer_test.go:240
         Error:          lister.CertificateRequests was expected to be called but was not called
         Test:           TestDataForCertificate/should_return_error_when_the_list_func_returns_an_error

Signed-off-by: Maël Valais <mael@vls.dev>
2021-03-04 17:16:16 +01:00
Maël Valais 9eb43bbb96 DataForCertificate: document the behavior and explain "current"
Signed-off-by: Maël Valais <mael@vls.dev>
2021-03-04 17:16:15 +01:00
Maël Valais 754035de7d DataForCertificate: tests: chained funcs pattern for CR mock
Signed-off-by: Maël Valais <mael@vls.dev>
2021-03-04 17:16:15 +01:00
Maël Valais 20ec95e91e DataForCertificate test: v1 -> corev1
Signed-off-by: Maël Valais <mael@vls.dev>
2021-03-04 17:16:15 +01:00
Maël Valais acc3a19b62 DataForCertificate tests: use generators in test/unit/gen
Signed-off-by: Maël Valais <mael@vls.dev>
2021-03-04 17:16:09 +01:00
Maël Valais 20ee363366 DataForCertificate: add mock listers for certificaterequests
At first, I tried to follow the "generator" pattern that had already
been implemented for the order and secret objects. These generators look
like:

  import (
      "github.com/jetstack/cert-manager/test/unit/listers"
  )

  fake := listers.FakeSecretListerFrom(listers.NewFakeSecretLister(),
      listers.SetFakeSecretNamespaceListerGet(nil, errors.New("not found")),
  )

The major issue I was finding with this approach is that you cannot
enforce any behavior with these fakes: no way to check (or prevent)
unwanted called, no way to check that the correct namespace was used for
the call:

  fake.Secrets("default").Get("secret-1")

which is annoying; I want to be able to check every input, output and
call numbers made to the mocked function.

So I propose a gomock-like approach. I could not use mockgen due to the
fact that (again) client-go is overly nested, which means I would have
to use quite a lot of glue code in order to use mockgen-generated mocks.

Signed-off-by: Maël Valais <mael@vls.dev>
2021-03-04 17:15:32 +01:00
Maël Valais b937eefbd7 DataForCertificate: unit test it
I initially thought about using the fake clientset like anywhere else,
but this time I thought: what about trying out the hard way, i.e.,
writing all the mocking code myself?

Result: not that hard, but requires more time than just using the fake
clientset.

Signed-off-by: Maël Valais <mael@vls.dev>
2021-03-04 17:13:19 +01:00
jetstack-botandGitHub 28fc97699e Merge pull request #3692 from irbekrm/3666_tests_for_readiness_controller
unit tests for readiness controller
2021-03-04 10:41:17 +00:00