Commit Graph

209 Commits

Author SHA1 Message Date
joshvanl
d1ffb0ad0d Adds roundtrip tests for issuer and cluster issuer serialize
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-02-11 16:26:56 +00:00
joshvanl
5f1249efe9 Adds issuer and cluster issuer integration tests to ensure mapped
conditions

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-02-11 16:26:56 +00:00
Ashley Davis
fc4f130755
Change handling of time in ctl integration tests
Two main changes:

1. Timezones

Because the tests were run in bazel or in CI environments, they always
ran in UTC, but the behaviour of ctl is based on local time, not UTC. We
show "not after" in the local timezone.

Now, we parse the "not after" time from the output so that its timezone
is respected and should pass on any developer laptop even outside of
bazel.

2. Created At

There was previously a pretty big regex for checking that "Created at"
was a valid timestamp. Now, we simply parse the timestamp using the Go
standard library to confirm that it's a valid RFC3339 timestamp.

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2022-02-10 15:29:51 +00:00
joshvanl
ab45d640ea Adds integration tests for additional output formats
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-02-07 14:42:04 +00:00
Ashley Davis
3a055cc2f5
rename all uses of github.com/jetstack/cert-manager
This was done by running the following command twice:

 ```bash
 grep -Ri "github.com/jetstack/cert-manager" . | \
 cut -d":" -f1 | \
 sort | \
 uniq | \
 xargs sed -i
 "s/github.com\/jetstack\/cert-manager/github.com\/cert-manager\/cert-manager/"
 ```

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2022-02-02 09:08:31 +00:00
joshvanl
fb6e0b9f00 Pass FieldManager down to issuing controller->secrets manager
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-27 13:56:29 +00:00
jetstack-bot
b12d78d364
Merge pull request #4746 from JoshVanL/controller-readiness-certificates-spec-match
Certificates controller policies refactor
2022-01-27 12:45:40 +00:00
James Munnelly
d03d98967d Fix webhook kubernetes config in integration tests
Signed-off-by: James Munnelly <jmunnelly@apple.com>
2022-01-20 10:56:50 +00:00
James Munnelly
708de3c580 webhook: use new admission-plugin backed validation and mutation handlers
Signed-off-by: James Munnelly <jmunnelly@apple.com>
2022-01-20 10:56:46 +00:00
joshvanl
38b7b930c8 Add tests from rebase and more policies under
/internal/controller/certificates

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-19 14:31:05 +00:00
joshvanl
3b148347ad Move temporary certificate policy init into policy package
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-19 14:30:00 +00:00
joshvanl
f1cafae95f Refactor trigger policies to be more generic and be used by multiple
controllers

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-19 14:30:00 +00:00
jetstack-bot
051a763ee5
Merge pull request #4638 from JoshVanL/controllers-certificates-secret-template
SecretTemplate reconciliation. SecretManager Apply
2022-01-18 13:28:57 +00:00
jetstack-bot
37411c8c3d
Merge pull request #4736 from SgtCoDFish/movefuzz
Move integration tests to test/integration
2022-01-18 12:53:04 +00:00
Ashley Davis
6429b65235
fix manual invocation of versionchecker testdata fetch
Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2022-01-17 17:41:43 +00:00
joshvanl
196d0011ca Remove SecretTemplate controller and move logic into issuing controller
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-17 11:24:45 +00:00
joshvanl
735e72205e Adds integration test for SecretTemplate controller
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-17 11:24:45 +00:00
joshvanl
50b6fd09f1 Updates integration issuing_controller_test for new SecretManager New
func signature

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2022-01-17 11:24:45 +00:00
Ashley Davis
1605f9794f
move fuzzing tests to test/integration/fuzz/%
These tests have external dependencies (rendered CRDs) which mean they
can't pass on a clean checkout without further setup. We define such
tests as integration tests, and so these are moved to test/integration.

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2022-01-14 15:36:00 +00:00
jetstack-bot
f1813d0368
Merge pull request #4730 from SgtCoDFish/movednstest
move RFC2136 DNS01 tests to test/integration
2022-01-13 11:10:04 +00:00
Ashley Davis
92f78e8f8d
move RFC2136 DNS01 tests to test/integration
Since this test requires setup before it can successfully run,
we define it as an integration test and move it here so that on a
fresh checkout a user can always run `go test ./pkg/...` and expect that
it would succeed.

Also:

- tweaks some comments
- adds methods for getting nameserver / tsig algorithm from DNSProvider

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2022-01-12 16:00:10 +00:00
Ashley Davis
93f868b3bc
move versionchecker tests to test/integration
Since this test requires setup before it can successfully run,
we define it as an integration test and move it here so that on a
fresh checkout a user can always run `go test ./pkg/...` and expect that
it would succeed.

Also involves:

- Exporting the VersionChecker and adding NewWithConfig to enable
  testing
- Some comment changes
- A change to the type returned by New(); see
  https://github.com/golang/go/wiki/CodeReviewComments#interfaces

Ideally I'd not add `NewFromClient` but I think it's the most minimal
change and is preferable to publicly exporting `VersionChecker.client`.

Signed-off-by: Ashley Davis <ashley.davis@jetstack.io>
2022-01-12 14:21:53 +00:00
jetstack-bot
2ebfdd29ec
Merge pull request #4716 from munnerz/allow-integration-with-delve
Re-organise and extend path loading logic to make it easier to run integration tests using Delve/GoLand
2022-01-06 19:25:23 +00:00
James Munnelly
8ff84e8b70 Re-organise and extend path loading logic to make it easier to run integration tests using Delve/GoLand
Signed-off-by: James Munnelly <jmunnelly@apple.com>
2022-01-06 15:22:39 +00:00
James Munnelly
35a96362a7 Rename command to 'migrate-api-version'
Signed-off-by: James Munnelly <jmunnelly@apple.com>
2022-01-06 15:21:47 +00:00
James Munnelly
1ae8fedc2d Add additional test cases
Signed-off-by: James Munnelly <jmunnelly@apple.com>
2022-01-06 15:08:15 +00:00
James Munnelly
b7b1baf565 Fix call to NewTestLogger after logr upgrade
Signed-off-by: James Munnelly <jmunnelly@apple.com>
2022-01-06 13:18:57 +00:00
James Munnelly
eaa95ebf9e Add integration test for 'upgrade migrate' command
Signed-off-by: James Munnelly <jmunnelly@apple.com>
2022-01-06 13:18:31 +00:00
James Munnelly
81f22fd49c Upgrade k8s.io dependencies to v0.23.1
Signed-off-by: James Munnelly <jmunnelly@apple.com>
2021-12-17 16:27:47 +00:00
Richard Wall
4eedf4fcfd Test conversion code using sample CRDs and remove conversion configuration from cert-manager CRDs
* Generate CRDs for the sample API types
* Allow alternative CRDs to be loaded into the envtest API server
* Override the conversion configuration of the CRDs
* Show webhook server logs in tests
* Simplify the loading of the test API CRDs
* Allow the ConversionHandler to be overridden in tests

Signed-off-by: Richard Wall <richard.wall@jetstack.io>
2021-12-14 17:33:22 +00:00
joshvanl
4d40bdcd96 Fix tests after metrics comment changes.
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-12-07 07:42:27 +00:00
joshvanl
b4f2d4982b Ensure clockTimeSecondsGauge is registered. Updates metrics integration
tests to include gauge clock metric

Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-12-02 12:11:20 +00:00
jetstack-bot
5eabeb0020
Merge pull request #4520 from mcaci/lint
Remove t.Fatal from goroutine
2021-10-26 13:02:40 +01:00
irbekrm
7b6eeff457 Profiler address for controller can now be configured
Ensures that pprof is configured for controller in the same way as for cainjector

Signed-off-by: irbekrm <irbekrm@gmail.com>
2021-10-26 12:20:42 +03:00
Michele Caci
ac4bf927c2 Remove t.Fatal from goroutine
Signed-off-by: Michele Caci <michele.caci@amadeus.com>
2021-10-19 12:53:46 +02:00
irbekrm
81bdabf67a Code review feedback
Signed-off-by: irbekrm <irbekrm@gmail.com>
2021-09-30 17:23:42 +01:00
irbekrm
5ff6e2d789 Changes required to use envtest from controller-runtime v0.10
Environment.CRDs is now a slice of apiextensionsv1.CustomResourceDefinitions instead of client.Object https://github.com/kubernetes-sigs/controller-runtime/pull/1626#discussion_r684454763

Signed-off-by: irbekrm <irbekrm@gmail.com>
2021-09-30 10:13:29 +01:00
Richard Wall
481fc5e43a Force the "served: true" in the CRDs when used in integration tests
These tests still need to create legacy API versions.

Signed-off-by: Richard Wall <richard.wall@jetstack.io>
2021-09-29 14:32:35 +01:00
jetstack-bot
898dc0e254
Merge pull request #4419 from artificial-aidan/master
Add Certificate RenewBefore prometheus metrics
2021-09-27 17:51:46 +01:00
Aidan Jensen
3bd35642a7
Use status.renewalTime instead of renewBefore
Signed-off-by: Aidan Jensen <aidan@artificial.com>
2021-09-01 10:07:21 -07:00
Aidan Jensen
c6bc180f58
Add Certificate RenewBefore prometheus metrics
Signed-off-by: Aidan Jensen <aidan@artificial.com>
2021-08-30 10:52:21 -07:00
joshvanl
4cdbb64003 Update ctl integration tests to use new local factory package
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-08-24 16:37:01 +01:00
Eng Zer Jun
54e70d2cc4
refactor: move from io/ioutil to io and os package
The io/ioutil package has been deprecated in Go 1.16. This commit
replaces the existing io/ioutil functions with their new definitions in
io and os packages.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
2021-08-23 19:50:42 +08:00
Inteon
91ec4c773a
use correct contexts everywhere & don't restart apiserver to add crds
Signed-off-by: Inteon <42113979+inteon@users.noreply.github.com>
2021-08-12 20:05:01 +02:00
Inteon
e5df60d47e
don't wait for hooks in kubectl cert-manager x install test & use local chart for tests
Signed-off-by: Inteon <42113979+inteon@users.noreply.github.com>
2021-08-11 23:18:33 +02:00
Inteon
abc39053b2
resolve .Stop() failures
Signed-off-by: Inteon <42113979+inteon@users.noreply.github.com>
2021-08-07 10:19:07 +02:00
Inteon
8ec405e823
fail if stop was not successful
Signed-off-by: Inteon <42113979+inteon@users.noreply.github.com>
2021-08-07 00:17:02 +02:00
Inteon
a569e79776
cleanup test contexts
Signed-off-by: Inteon <42113979+inteon@users.noreply.github.com>
2021-08-06 17:31:19 +02:00
jetstack-bot
25320ceaa8
Merge pull request #4252 from JoshVanL/admissionregistration-v1beta1-v1
Change admissionregistration.k8s.io v1beta1 to v1 in integration tests
2021-07-29 20:44:41 +01:00
joshvanl
1d926e8e50 Adds UserInfo fields to conversion webhook tests
Signed-off-by: joshvanl <vleeuwenjoshua@gmail.com>
2021-07-29 17:35:13 +01:00