Skip to content

Commit 746316d

Browse files
authored
Merge pull request #1142 from DirectXMan12/docs/envtest-syntax-highlighting
📖 Fix syntax highlighting & append in envtest ref
2 parents 90850ad + edcb053 commit 746316d

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

docs/book/src/reference/testing/envtest.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
Using `envtest` in integration tests follows the general flow of:
55

6-
```
6+
```go
77
import sigs.k8s.io/controller-runtime/pkg/envtest
88

99
//specify testEnv configuration
@@ -41,13 +41,14 @@ You can use environment variables and/or flags to specify the `api-server` and `
4141
#### Flags
4242
Here's an example of modifying the flags with which to start the API server in your integration tests, compared to the default values in `envtest.DefaultKubeAPIServerFlags`:
4343

44-
```
44+
```go
4545
customApiServerFlags := []string{
4646
"--secure-port=6884",
4747
"--admission-control=MutatingAdmissionWebhook",
4848
}
4949

50-
apiServerFlags := append(envtest.DefaultKubeAPIServerFlags, customApiServerFlags)
50+
apiServerFlags := append([]string(nil), envtest.DefaultKubeAPIServerFlags...)
51+
apiServerFlags = append(apiServerFlags, customApiServerFlags...)
5152

5253
testEnv = &envtest.Environment{
5354
CRDDirectoryPaths: []string{filepath.Join("..", "config", "crd", "bases")},

0 commit comments

Comments
 (0)