Skip to content

Commit 364ec1c

Browse files
Address self feedback
1 parent 220a116 commit 364ec1c

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

e2e.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
This article outlines steps to run e2e tests on remote clusters for controllers created using `kubebuilder`. For example, after developing a database controller, the developer may want to run some e2e tests on a GKE cluster to verify the controller is working as expected. Currently, `kubebuilder` does not provide a template for running the e2e tests. This article serves to address this deficit.
44

55
The steps are as follow:
6-
1. Create a test file named `<some-file-name>_test.go` populated with template below (refer [this](https://github.com/foxish/application/blob/master/e2e/main_test.go)):
6+
1. Create a test file named `<some-file-name>_test.go` populated with template below (referring [this](https://github.com/foxish/application/blob/master/e2e/main_test.go)):
77
```
88
import (
99
"k8s.io/client-go/tools/clientcmd"
@@ -36,24 +36,22 @@ var _ = Describe("<some-controller-name> should work", func() {
3636
}
3737
3838
BeforeEach(func() {
39-
// Create controller image StatefulSet using kubernetes client
40-
// Note: Refer `install.yaml` created via `kubebuilder create config`
41-
// to have an idea on what the StatefulSet's fields should look like
42-
......
43-
44-
// Create other necessary resources before starting each test
39+
// Create environment-specific resources such as controller image StatefulSet,
40+
// CRDs etc. Note: refer "install.yaml" created via "kubebuilder create config"
41+
// command to have an idea of what resources to be created.
4542
......
4643
})
4744
4845
AfterEach(func() {
49-
// Delete all created resources for testing purpose
46+
// Delete all test-specific resources
5047
......
5148
52-
// Delete controller image StatefulSet
49+
// Delete all environment-specific resources
5350
......
5451
})
5552
56-
// Declare a list of testing specifications and corresponding test functions
53+
// Declare a list of testing specifications with corresponding test functions
54+
// Note: test-specific resources are normally created within the test functions
5755
It("should do something", func() {
5856
testDoSomething(k8sClient, roClient)
5957
})
@@ -62,4 +60,4 @@ var _ = Describe("<some-controller-name> should work", func() {
6260
```
6361
2. Write some controller-specific e2e tests
6462
3. Build controller image and upload it to an image storage website such as [gcr.io](https://cloud.google.com/container-registry/)
65-
4. `go test .` to run the e2e tests
63+
4. `go test <path-to-test-file>`

0 commit comments

Comments
 (0)