File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change 68
68
69
69
- [ controller-gen CLI] ( ./reference/controller-gen.md )
70
70
- [ Artifacts] ( ./reference/artifacts.md )
71
+ - [ Writing controller tests] ( ./reference/writing-tests.md )
71
72
72
73
---
73
74
Original file line number Diff line number Diff line change
1
+ # Writing controller tests
2
+
3
+ Testing Kubernetes controller is a big subject, and the boilerplate testing
4
+ files generated for you by kubebuilder are fairly minimal. Until more
5
+ documentation has been written, your best bet to get started is to look at some
6
+ existing examples, such as:
7
+
8
+ * Azure Databricks Operator: see their fully fleshed-out
9
+ [ ` suite_test.go ` ] ( https://github.com/microsoft/azure-databricks-operator/blob/0f722a710fea06b86ecdccd9455336ca712bf775/controllers/suite_test.go )
10
+ as well as any ` *_test.go ` file in that directory [ like this
11
+ one] ( https://github.com/microsoft/azure-databricks-operator/blob/0f722a710fea06b86ecdccd9455336ca712bf775/controllers/secretscope_controller_test.go ) .
12
+
13
+ The basic approach is that, in your generated ` suite_test.go ` file, you will
14
+ create a local Kubernetes API server, instantiate and run your controllers, and
15
+ then write additional ` *_test.go ` files to test it using
16
+ [ Ginko] ( http://onsi.github.io/ginkgo ) .
You can’t perform that action at this time.
0 commit comments