Commit Graph
736 Commits
Author SHA1 Message Date
jetstack-botandGitHub e7333df106 Merge pull request #3838 from wallrj/3289-stable-api-versions
Update cainjector to use stable API versions
2021-04-06 15:19:57 +01:00
Richard Wall 3d7f370b21 Re-enable the cainjector E2E tests for apiregistration
Signed-off-by: Richard Wall <richard.wall@jetstack.io>
2021-04-06 14:04:26 +01:00
Richard Wall 20510e45f0 Update cainjector to use stable API versions
Signed-off-by: Richard Wall <richard.wall@jetstack.io>
2021-04-01 17:23:28 +01:00
Richard Wall 39ebccd0ba Skip the Venafi Cloud conformance tests by default
Signed-off-by: Richard Wall <richard.wall@jetstack.io>
2021-04-01 09:13:36 +01:00
Richard Wall a372e1afb6 Delete empty Venafi Cloud issuer tests
Signed-off-by: Richard Wall <richard.wall@jetstack.io>
2021-04-01 09:13:36 +01:00
jetstack-botandGitHub e29a3df86d Merge pull request #3785 from JoshVanL/approval-subject-access-review
Approval subject access review
2021-04-01 08:00:39 +01:00
irbekrm 81a8588b91 Bumps versions of Gazelle, go_rules, Kazel, protobuf
Signed-off-by: irbekrm <irbekrm@gmail.com>

Bumps versions of Gazelle, go_rules, Kazel and protobuf

Signed-off-by: irbekrm <irbekrm@gmail.com>
2021-03-29 08:25:12 +01:00
joshvanl 820b8556a3 Fix go linting
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-03-26 17:41:42 +00:00
joshvanl b75655fbb6 Updates approval e2e tests to include custom resource definitions
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-03-26 17:26:28 +00:00
joshvanl 109b3e0b28 Rename Wehook's API server host flag from --master to --api-server-host
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-03-26 17:26:28 +00:00
joshvanl a97be01bd8 Adds test comment to approval e2e test
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-03-26 17:26:28 +00:00
joshvanl 8048034b0e Adds permissions to approve "issuer.cert-manager.io/*", "clusterissuer.cert-manager.io/*" signers to the cert-manager-controller ServiceAccount
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-03-26 17:26:28 +00:00
joshvanl 157b577056 Adds Approval SubjectAccessReview checks to e2e UserInfo suite
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-03-26 17:26:28 +00:00
joshvanl f640f64fcb Update integration test framework to restart the API to share the
address with the webhook

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-03-26 17:26:28 +00:00
jetstack-botandGitHub a8c75fab1a Merge pull request #3773 from JoshVanL/certificate-revision-history-limit
Certificate revision history limit
2021-03-26 11:13:58 +00:00
jetstack-botandGitHub 7946df1da7 Merge pull request #3788 from maelvls/refactor-trigger-unit-tests
Refactor trigger-controller unit tests
2021-03-25 11:41:36 +00:00
joshvanl d5ccbdb277 Fix test controller name of revision manager in integration test
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-03-23 15:58:35 +00:00
Maël Valais 71e707387a trigger-controller: refactor test, inject gatherer and policychain
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>
2021-03-23 13:55:11 +01:00
Lars Lehtonen b98e39bfbf test/e2e/suite/conformance/certificates: fix dropped error
Signed-off-by: Lars Lehtonen <lars.lehtonen@gmail.com>
2021-03-21 17:44:35 -07:00
joshvanl 1235ff3bef Adds tests to ensure Approve is present, and Denied is not
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-03-17 13:10:39 +00:00
joshvanl e6c74d94b4 Adds check for approval condition in e2e CertificateRequest helper
func

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-03-17 13:10:39 +00:00
jetstack-botandGitHub 0b4abcc77a Merge pull request #3770 from jonathansp/master
tests: allow setting DNSName and ChallengeKey for webhook integration tests
2021-03-15 16:30:16 +00:00
joshvanl 2a08d8a8df Adds integration tests for revision manager
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-03-15 14:54:34 +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
Jonathan Prates 466ffe336d tests: allow setting dnsname and acme challenge key for webhook integration tests
Signed-off-by: Jonathan Simon Prates <jonathan.simonprates@gmail.com>
2021-03-15 13:18:27 +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 8d5059b13e Updates Trigger controller integration tests
Signed-off-by: irbekrm <irbekrm@gmail.com>
2021-03-15 08:47:42 +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
joshvanl 1232ff799d Reorder ready condition if statement to make more clear
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-03-04 17:04:11 +00:00
joshvanl c07106ed6b Adds ExpectConditionReadyObservedGeneration as a framework validation
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-03-04 17:04:11 +00:00
joshvanl b3cab7e265 Updates the CRDs with the Certificate Condition observedGeneration field
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-03-04 17:04:11 +00:00
joshvanl d02f043354 Adds a check of the observedGeneration in e2e tests for ready
certificates

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-03-04 17:04:11 +00: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
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 ValaisandJoshVanL 10e5583991 PR comment: remove now unused listers/util.go
Signed-off-by: Maël Valais <mael@vls.dev>
Co-authored-by: JoshVanL <vleeuwenjoshua@gmail.com>
Signed-off-by: Maël Valais <mael@vls.dev>
2021-03-04 17:19:02 +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 077f4ee66e Mock lister: move utils to uti.go, rm useless mocks
Signed-off-by: Maël Valais <mael@vls.dev>
2021-03-04 17:16:16 +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 ca72582897 Mock lister: explain why checking mock call makes sense
Signed-off-by: Maël Valais <mael@vls.dev>
2021-03-04 17:16:16 +01:00
Maël Valais 7a8003f5d2 Mock lister: refactor into assertCanBeCalled
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 d7e3a87eae DataForCertificate: tests: fix certificaterequest lister
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 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
Richard Wall bc16ec8941 Mark Venafi E2E tests as separate Feature: group
Signed-off-by: Richard Wall <richard.wall@jetstack.io>
2021-02-18 18:15:36 +00:00
Richard Wall f7b80ea2b2 Skip tests containing the labels [Flaky] or [Feature:xyz]
This will allow us to skip certain known Flaky tests without having to modify
the testing infra.
And it will allow us to target these tests from a separate test job,
when we DO want to run them.

Signed-off-by: Richard Wall <richard.wall@jetstack.io>
2021-02-18 15:59:03 +00:00
joshvanl 16ff3ff7bb Adds e2e tests for identity. Ensures the CertificateRequest identity
properties are held

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-02-08 19:26:59 +00:00
joshvanl 4300da5fa2 Adds a sanity check to the CertificateRequest validation integration
tests to ensure that no error happens when applying a CertificateRequest
with identities set (they get modified during admission).

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-02-08 19:24:32 +00:00
irbekrm 1abc7107ca Passes a single context with cancel func to all the kubectl plugin commands
Signed-off-by: irbekrm <irbekrm@gmail.com>

Don't duplicate the existing ContextWithStopCh function

Signed-off-by: irbekrm <irbekrm@gmail.com>
2021-01-27 13:06:34 +00:00
Richard Wall 290fa4e446 E2E tests
Signed-off-by: Richard Wall <richard.wall@jetstack.io>
2021-01-22 12:12:14 +00:00