-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate from kuttl to chainsaw (#181)
* chore: migrate from kuttl to chainsaw Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> * set bucket name based on namespace * migrate vpc test from kuttl to chainsaw and remove all kuttl related tooling --------- Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com> Co-authored-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
- Loading branch information
1 parent
0256f43
commit 01a0179
Showing
27 changed files
with
186 additions
and
224 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
# CAPL Testing | ||
|
||
## Unit Tests | ||
### Running Tests | ||
In order to run the unit tests run the following command | ||
```bash | ||
make test | ||
``` | ||
|
||
## E2E Tests | ||
For e2e tests CAPL uses the [Chainsaw project](https://kyverno.github.io/chainsaw) which leverages `kind` and `tilt` to | ||
spin up a cluster with the CAPL controllers installed and then uses `chainsaw-test.yaml` files to drive e2e testing. | ||
|
||
All test live in the e2e folder with a directory structure of `e2e/${CONTROLLER_NAME}/${TEST_NAME}` | ||
### Running tests | ||
In order to run e2e tests run the following command | ||
```bash | ||
make e2etest | ||
``` | ||
### Adding tests | ||
1. Create a new directory under the controller you are testing with the naming scheme of `e2e/${CONTROLLER_NAME}/${TEST_NAME}` | ||
2. Create a minimal `chainsaw-test.yaml` file in the new test dir | ||
```yaml | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json | ||
apiVersion: chainsaw.kyverno.io/v1alpha1 | ||
kind: Test | ||
metadata: | ||
name: $TEST_NAME | ||
spec: | ||
template: true # set to true if you are going to use any chainsaw templating | ||
steps: | ||
- name: step-01 | ||
try: | ||
- apply: | ||
file: ${resource_name}.yaml | ||
- assert: | ||
file: 01-assert.yaml | ||
``` | ||
3. Add any resources to create or assert on in the same directory |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
...objectstoragebucket-controller/minimal-linodeobjectstoragebucket/00-ensure-no-bucket.yaml
This file was deleted.
Oops, something went wrong.
10 changes: 8 additions & 2 deletions
10
e2e/linodeobjectstoragebucket-controller/minimal-linodeobjectstoragebucket/01-assert.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,17 @@ | ||
--- | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 | ||
kind: LinodeObjectStorageBucket | ||
metadata: | ||
name: linodeobjectstoragebucket-sample | ||
name: (join('-', [$namespace, 'backups'])) | ||
spec: | ||
cluster: us-sea-1 | ||
keyGeneration: 0 | ||
status: | ||
ready: true | ||
keySecretName: linodeobjectstoragebucket-sample-access-keys | ||
keySecretName: (join('-', [$namespace, 'backups-access-keys'])) | ||
lastKeyGeneration: 0 | ||
--- | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: (join('-', [$namespace, 'backups-access-keys'])) |
2 changes: 1 addition & 1 deletion
2
...ket-controller/minimal-linodeobjectstoragebucket/01-create-linodeobjectstoragebucket.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 | ||
kind: LinodeObjectStorageBucket | ||
metadata: | ||
name: linodeobjectstoragebucket-sample | ||
name: (join('-', [$namespace, 'backups'])) | ||
spec: | ||
cluster: us-sea-1 |
9 changes: 0 additions & 9 deletions
9
...oragebucket-controller/minimal-linodeobjectstoragebucket/02-verify-bucket-and-secret.yaml
This file was deleted.
Oops, something went wrong.
4 changes: 2 additions & 2 deletions
4
e2e/linodeobjectstoragebucket-controller/minimal-linodeobjectstoragebucket/03-assert.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 | ||
kind: LinodeObjectStorageBucket | ||
metadata: | ||
name: linodeobjectstoragebucket-sample | ||
name: (join('-', [$namespace, 'backups'])) | ||
spec: | ||
cluster: us-sea-1 | ||
keyGeneration: 1 | ||
status: | ||
ready: true | ||
keySecretName: linodeobjectstoragebucket-sample-access-keys | ||
keySecretName: (join('-', [$namespace, 'backups-access-keys'])) | ||
lastKeyGeneration: 1 |
2 changes: 1 addition & 1 deletion
2
...nodeobjectstoragebucket-controller/minimal-linodeobjectstoragebucket/03-patch-bucket.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
apiVersion: infrastructure.cluster.x-k8s.io/v1alpha1 | ||
kind: LinodeObjectStorageBucket | ||
metadata: | ||
name: linodeobjectstoragebucket-sample | ||
name: (join('-', [$namespace, 'backups'])) | ||
spec: | ||
cluster: us-sea-1 | ||
keyGeneration: 1 |
6 changes: 0 additions & 6 deletions
6
...ket-controller/minimal-linodeobjectstoragebucket/04-delete-linodeobjectstoragebucket.yaml
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.