-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate from kuttl to chainsaw #181
Merged
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
0e35d4d
chore: migrate from kuttl to chainsaw
eddycharly efc0e7d
Merge branch 'main' into chainsaw-4
eddycharly 1eb410f
Merge branch 'main' into chainsaw-4
eddycharly 0f59073
set bucket name based on namespace
eljohnson92 cbabe4d
fix object store bucket listing logic
eljohnson92 d923729
migrate vpc test from kuttl to chainsaw and remove all kuttl related …
eljohnson92 2b5e183
Merge branch 'main' into chainsaw-4
eljohnson92 45a146b
add Testing doc
eljohnson92 9a9c6dc
remove unneeded env variables from tests
eljohnson92 da0f7b6
Merge branch 'main' into chainsaw-4
eljohnson92 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of computing this multiple times i would create a test level binding with the computed name
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is
$namespace
available at the top binding level? I am seeing this errorwith this binding def
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, it's a bug. Fixing it, it will be in the next release.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
kyverno/chainsaw#1097