Skip to content

Commit

Permalink
Address self feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
crimsonfaith91 authored May 31, 2018
1 parent 220a116 commit 364ec1c
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions e2e.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
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.

The steps are as follow:
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)):
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)):
```
import (
"k8s.io/client-go/tools/clientcmd"
Expand Down Expand Up @@ -36,24 +36,22 @@ var _ = Describe("<some-controller-name> should work", func() {
}
BeforeEach(func() {
// Create controller image StatefulSet using kubernetes client
// Note: Refer `install.yaml` created via `kubebuilder create config`
// to have an idea on what the StatefulSet's fields should look like
......
// Create other necessary resources before starting each test
// Create environment-specific resources such as controller image StatefulSet,
// CRDs etc. Note: refer "install.yaml" created via "kubebuilder create config"
// command to have an idea of what resources to be created.
......
})
AfterEach(func() {
// Delete all created resources for testing purpose
// Delete all test-specific resources
......
// Delete controller image StatefulSet
// Delete all environment-specific resources
......
})
// Declare a list of testing specifications and corresponding test functions
// Declare a list of testing specifications with corresponding test functions
// Note: test-specific resources are normally created within the test functions
It("should do something", func() {
testDoSomething(k8sClient, roClient)
})
Expand All @@ -62,4 +60,4 @@ var _ = Describe("<some-controller-name> should work", func() {
```
2. Write some controller-specific e2e tests
3. Build controller image and upload it to an image storage website such as [gcr.io](https://cloud.google.com/container-registry/)
4. `go test .` to run the e2e tests
4. `go test <path-to-test-file>`

0 comments on commit 364ec1c

Please sign in to comment.