-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add some very rudimentary testing tips
Adds basic pointers to an example in the reference section.
- Loading branch information
1 parent
1d9f3cb
commit f9e2ae1
Showing
2 changed files
with
17 additions
and
0 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Writing controller tests | ||
|
||
Testing Kubernetes controller is a big subject, and the boilerplate testing | ||
files generated for you by kubebuilder are fairly minimal. Until more | ||
documentation has been written, your best bet to get started is to look at some | ||
existing examples, such as: | ||
|
||
* Azure Databricks Operator: see their fully fleshed-out | ||
[`suite_test.go`](https://github.com/microsoft/azure-databricks-operator/blob/0f722a710fea06b86ecdccd9455336ca712bf775/controllers/suite_test.go) | ||
as well as any `*_test.go` file in that directory [like this | ||
one](https://github.com/microsoft/azure-databricks-operator/blob/0f722a710fea06b86ecdccd9455336ca712bf775/controllers/secretscope_controller_test.go). | ||
|
||
The basic approach is that, in your generated `suite_test.go` file, you will | ||
create a local Kubernetes API server, instantiate and run your controllers, and | ||
then write additional `*_test.go` files to test it using | ||
[Ginko](http://onsi.github.io/ginkgo). |