101 Commits
Author SHA1 Message Date
James Munnelly 642cfb1b46 Fix misconfigured test/unit/discovery visibility rule
Signed-off-by: James Munnelly <jmunnelly@apple.com>
2021-10-21 12:31:28 +01:00
Aidan Jensen 15d1ba96fe Fix spelling error. Fix tests
Signed-off-by: Aidan Jensen <aidan@artificial.com>
2021-09-01 10:47:46 -07:00
Jonathan Prates c5e81b13f6 fix: labels cannot be shown if no labels were changed
Signed-off-by: jonathansp <jonathansimonprates@gmail.com>
2021-08-03 01:19:11 +01:00
Jonathan Prates ababc24670 fix: add SetCertificateSecretTemplate function comment
Signed-off-by: jonathansp <jonathansimonprates@gmail.com>
2021-08-03 01:19:11 +01:00
Jonathan Prates 936ad33539 fix: ensure secret annotations and labels will be copied if updated in the cert
Signed-off-by: jonathansp <jonathansimonprates@gmail.com>
2021-08-03 01:19:11 +01:00
Jonathan Prates 47bc03e7c4 feat: add support to secretTemplates
Signed-off-by: jonathansp <jonathansimonprates@gmail.com>
2021-08-03 01:19:11 +01:00
Jake Sanders 67c6586161 Addressing code review comments in #4225
Signed-off-by: Jake Sanders <i@am.so-aweso.me>
2021-07-26 18:29:54 +01:00
joshvanl c9f5cbd0bc Adds more modifier funcs to Order in unit gen
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-07-23 16:00:09 +01:00
joshvanl 7e8bf731b2 Remove the experimental.cert-manager.io/ca annotation from the
CertificateSigningRequest

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-06-25 16:02:37 +01:00
joshvanl 849403723b Updates test unit gen modifiers for e2e
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-06-15 17:58:34 +01:00
Anner J. BonillaandAshley Davis 9546a357a5 Add support for certificates with ed25519 private keys
Note that using ed25519 on the public internet is not currently
recommended, since it's not widely supported. You'd likely not be able
to use an Ed25519 cert with an ACME issuer today.

Ed25519 certs might be useful for internal PKI, though - an ed25519 CA
issuer, say - or for testing ed25519 certs before they become more
widely available on the public internet. They're not currently
supported by Vault, Venafi or ACME (Letsencrypt) issuers.

Signed-off-by: Anner J. Bonilla <abonilla@hoyosintegrity.com>
Signed-off-by: Anner J. Bonilla <annerjb@gmail.com>
Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2021-06-14 11:17:35 +01:00
joshvanl 9e1b0342d0 Updates with review comments
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-05-27 18:48:50 +01:00
joshvanl c5c206cace Adds base CertificateSigningRequest cert-manager controller
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-05-27 00:23:50 +01:00
Tamal Saha 6bfe640533 Update fakeSecretClient
Signed-off-by: Tamal Saha <tamal@appscode.com>
2021-05-17 08:52:59 -07:00
irbekrm 284de092e9 Adds a few ACME-specific functions to issuer gen
Signed-off-by: irbekrm <irbekrm@gmail.com>
2021-05-10 09:53:39 +01:00
irbekrm 0c751f51e4 Adds functionality to generate issuer conditions to gen
So they can be generated in tests with less lines of code

Signed-off-by: irbekrm <irbekrm@gmail.com>
2021-05-10 09:53:20 +01:00
irbekrm 6318de527c Adds a fake Secrets client
A simpler implementation than https://github.com/kubernetes/client-go/blob/master/kubernetes/typed/core/v1/fake/fake_secret.go and more suited for unit tests that don't spin up a controller

Signed-off-by: irbekrm <irbekrm@gmail.com>
2021-05-10 09:52:58 +01:00
irbekrm 333f600661 Remove legacy e2e util functions for Issuer creation
Use test/util/gen instead

Signed-off-by: irbekrm <irbekrm@gmail.com>
2021-04-08 18:30:45 +01:00
Maël ValaisandJosh Soref 85128f26ce trigger-controller: PR comment: rephrase log about skipping issuance
The log message:

    multiple CertificateRequests found for the 'next' revision 2,
    skipping issuance until no more duplicate.

can be better phrased as:

    multiple CertificateRequests are found for the 'next' revision 2,
    issuance is skipped until there are no more duplicates.

Signed-off-by: Maël Valais <mael@vls.dev>
Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2021-04-06 18:09:28 +02:00
Maël ValaisandJosh Soref 89c3dc1afa gen: document why we do not pass an entire Certificate
Signed-off-by: Maël Valais <mael@vls.dev>
Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2021-04-06 18:09:27 +02: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
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 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
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 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
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
Maartje Eyskens ab0cd57dc5 Use The cert-manager Authors.
Signed-off-by: Maartje Eyskens <maartje@eyskens.me>
2020-12-11 19:04:13 +01:00
Maartje Eyskens 1788a9d758 Update copyright to cert-manager project
Signed-off-by: Maartje Eyskens <maartje@eyskens.me>
2020-12-08 19:04:49 +01:00
Maartje Eyskens 9452327d1b Add test in order sync
Signed-off-by: Maartje Eyskens <maartje@eyskens.me>
2020-10-08 15:24:56 +02:00
Richard Wall 3fb3db27ff Fix ACME challenge type in unit tests
Signed-off-by: Richard Wall <richard.wall@jetstack.io>
2020-08-20 14:28:06 +01:00
Richard Wall 01b5d0fa88 Fix tests in ./pkg/controller/certificates/...
Signed-off-by: Richard Wall <richard.wall@jetstack.io>
2020-08-20 14:28:06 +01:00
Richard Wall 81eb53f597 ./hack/update-all.sh
Signed-off-by: Richard Wall <richard.wall@jetstack.io>
2020-08-20 14:28:06 +01:00
Richard Wall a70298180a Run a script to update v1alpha2 usage to v1
Script is available at https://github.com/jetstack/cert-manager/pull/3201

Signed-off-by: Richard Wall <richard.wall@jetstack.io>
2020-08-20 14:26:51 +01:00
Haoxiang Zhou 6c26e0d821 Add Challenge output and update tests
Signed-off-by: Haoxiang Zhou <haoxiang.zhou@jetstack.io>
2020-08-17 16:15:28 +02:00
Haoxiang Zhou 62700fceef Add unit tests testing building CertificateStatus struct from gathered Data
Signed-off-by: Haoxiang Zhou <haoxiang.zhou@jetstack.io>
2020-08-14 09:35:09 +02:00
Haoxiang Zhou fc8b123593 Update tests and compare strings directly as well if regex matches
Signed-off-by: Haoxiang Zhou <haoxiang.zhou@jetstack.io>
2020-08-06 12:03:36 +01:00
Haoxiang Zhou 57770b1f58 User order as variable name in gen/order.go
Signed-off-by: Haoxiang Zhou <haoxiang.zhou@jetstack.io>
2020-08-05 13:59:12 +01:00
Haoxiang Zhou ef95d15642 Updated tests with output for secret
Signed-off-by: Haoxiang Zhou <haoxiang.zhou@jetstack.io>
2020-07-30 17:54:57 +01:00