You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Docs for install: https://kuttl.dev/docs/cli.html#setup-the-kuttl-kubectl-plugin
5
6
6
7
Options:
7
8
- Download and install the binary
8
9
- Install the `kubectl krew`[plugin manager](https://github.com/kubernetes-sigs/krew)
9
10
and `kubectl krew install kuttl`
11
+
10
12
## Cheat sheet
11
13
12
14
### Suppressing Noisy Logs
@@ -20,26 +22,27 @@ KUTTL_TEST='kuttl test --suppress-log=events' make check-kuttl
20
22
21
23
To suppress the events permanently, you can add the following to the KUTTL config (kuttl-test.yaml)
22
24
```
23
-
suppress:
25
+
suppress:
24
26
- events
25
27
```
26
28
27
29
### Run test suite
28
30
29
-
Make sure that the operator is running in your kubernetes environment and that your `kubeconfig` is
30
-
set up. Then run the make target:
31
+
Make sure that the operator is running in your Kubernetes environment and that your `kubeconfig` is
32
+
set up. Then run the make targets:
31
33
32
34
```
33
-
make check-kuttl
35
+
make generate-kuttl check-kuttl
34
36
```
35
37
36
38
### Running a single test
37
-
A single test is considered to be one directory under `kuttl/e2e`, for example
38
-
`kuttl/e2e/restore` would run the `restore` test.
39
+
40
+
A single test is considered to be one directory under `kuttl/e2e-generated`, for example
41
+
`kuttl/e2e-generated/restore` is the `restore` test.
39
42
40
43
There are two ways to run a single test in isolation:
41
44
- using an env var with the make target: `KUTTL_TEST='kuttl test --test <test-name>' make check-kuttl`
42
-
- using `kubectl kuttl --test` flag: `kubectl kuttl test testing/kuttl/e2e --test <test-name>`
45
+
- using `kubectl kuttl --test` flag: `kubectl kuttl test testing/kuttl/e2e-generated --test <test-name>`
43
46
44
47
### Writing additional tests
45
48
@@ -50,7 +53,7 @@ step number and the object/step name.
50
53
For example, if the `00` test step wants to create a cluster and then assert that the cluster is ready,
51
54
the files would be named
52
55
53
-
```console
56
+
```yaml
54
57
00--cluster.yaml # note the extra `-` to ensure that it sorts above the following file
55
58
00-assert.yaml
56
59
```
@@ -62,28 +65,28 @@ change those K8s objects before applying them. That means that, if we wanted to
62
65
connection test for PG 13 and PG 14, we would end up writing two nearly identical tests.
63
66
64
67
Rather than write those multiple tests, we are using `envsubst` to replace some common variables
65
-
in `source` template YAML (the `e2e` and `e2e-other` folders) and writing those files to the
66
-
`testing/kuttl/e2e-generated` and `testing/kuttl/e2e-generated-other` folders.
68
+
and writing those files to the `testing/kuttl/e2e-generated*` directories.
67
69
68
70
These templated test files can be generated by setting some variables in the command line and
69
71
calling the `make generate-kuttl` target:
70
72
71
73
```console
72
-
KUTTL_PG_VERSION=13 KUTTL_POSTGIS_VERSION=3.0 KUTTL_PSQL_IMAGE=registry.developers.crunchydata.com/crunchydata/crunchy-postgres:centos8-13.5-0 make generate-kuttl
74
+
KUTTL_PG_VERSION=13 KUTTL_POSTGIS_VERSION=3.0 make generate-kuttl
73
75
```
74
76
75
-
This will loop through the `source` folders and create corresponding `e2e-generated` and
76
-
`e2e-generated-other` folders that can be checked for correctness before running the tests.
77
-
(The files in the `e2e-generated` and `e2e-generated-other` folders will not be checked into
78
-
github; our CI runner will generate and test the files from scratch.)
77
+
This will loop through the files under the `e2e` and `e2e-other` directories and create matching
78
+
files under the `e2e-generated` and `e2e-generated-other` directories that can be checked for
79
+
correctness before running the tests.
79
80
80
81
Please note, `make check-kuttl` does not run the `e2e-other` tests. To run the `postgis-cluster`
81
82
test, you can use:
82
83
83
-
`kubectl kuttl test testing/kuttl/e2e-generated-other/ --timeout=180 --test postgis-cluster`
84
+
```
85
+
kubectl kuttl test testing/kuttl/e2e-generated-other/ --timeout=180 --test postgis-cluster`
86
+
```
84
87
85
88
To run the `gssapi` test, please see testing/kuttl/e2e-other/gssapi/README.md.
86
89
87
-
To prevent errors, we want to set defaults for all the environment variables used in the `source`
90
+
To prevent errors, we want to set defaults for all the environment variables used in the source
88
91
YAML files; so if you add a new test with a new variable, please update the Makefile with a
0 commit comments