Skip to content

Commit 1024dc4

Browse files
author
Mateus Oliveira
authored
📖 improve description for the scaffolded tests (#4443)
fix: tutorial test docs Signed-off-by: Mateus Oliveira <[email protected]>
1 parent 944a9de commit 1024dc4

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

docs/book/src/cronjob-tutorial/testdata/project/internal/controller/suite_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ var _ = BeforeSuite(func() {
7575
ctx, cancel = context.WithCancel(context.TODO())
7676

7777
/*
78-
First, the envtest cluster is configured to read CRDs from the CRD directory Kubebuilder scaffolds for you.
78+
The envtest environment is configured to load Custom Resource Definitions (CRDs) from the specified directory.
79+
This setup enables the test environment to recognize and interact with the custom resources defined by these CRDs.
7980
*/
8081
By("bootstrapping test environment")
8182
testEnv = &envtest.Environment{
@@ -98,8 +99,8 @@ var _ = BeforeSuite(func() {
9899
Expect(cfg).NotTo(BeNil())
99100

100101
/*
101-
The autogenerated test code will add the CronJob Kind schema to the default client-go k8s scheme.
102-
This ensures that the CronJob API/Kind will be used in our test controller.
102+
The CronJob Kind is added to the runtime scheme used by the test environment.
103+
This ensures that the CronJob API is registered with the scheme, allowing the test controller to recognize and interact with CronJob resources.
103104
*/
104105
err = batchv1.AddToScheme(scheme.Scheme)
105106
Expect(err).NotTo(HaveOccurred())

docs/book/src/multiversion-tutorial/testdata/project/internal/controller/suite_test.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,8 @@ var _ = BeforeSuite(func() {
7575
ctx, cancel = context.WithCancel(context.TODO())
7676

7777
/*
78-
First, the envtest cluster is configured to read CRDs from the CRD directory Kubebuilder scaffolds for you.
78+
The envtest environment is configured to load Custom Resource Definitions (CRDs) from the specified directory.
79+
This setup enables the test environment to recognize and interact with the custom resources defined by these CRDs.
7980
*/
8081
By("bootstrapping test environment")
8182
testEnv = &envtest.Environment{
@@ -98,8 +99,8 @@ var _ = BeforeSuite(func() {
9899
Expect(cfg).NotTo(BeNil())
99100

100101
/*
101-
The autogenerated test code will add the CronJob Kind schema to the default client-go k8s scheme.
102-
This ensures that the CronJob API/Kind will be used in our test controller.
102+
The CronJob Kind is added to the runtime scheme used by the test environment.
103+
This ensures that the CronJob API is registered with the scheme, allowing the test controller to recognize and interact with CronJob resources.
103104
*/
104105
err = batchv1.AddToScheme(scheme.Scheme)
105106
Expect(err).NotTo(HaveOccurred())

hack/docs/internal/cronjob-tutorial/writing_tests_env.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,14 @@ var (
4343

4444
const SuiteTestReadCRD = `
4545
/*
46-
First, the envtest cluster is configured to read CRDs from the CRD directory Kubebuilder scaffolds for you.
46+
The envtest environment is configured to load Custom Resource Definitions (CRDs) from the specified directory.
47+
This setup enables the test environment to recognize and interact with the custom resources defined by these CRDs.
4748
*/`
4849

4950
const SuiteTestAddSchema = `
5051
/*
51-
The autogenerated test code will add the CronJob Kind schema to the default client-go k8s scheme.
52-
This ensures that the CronJob API/Kind will be used in our test controller.
52+
The CronJob Kind is added to the runtime scheme used by the test environment.
53+
This ensures that the CronJob API is registered with the scheme, allowing the test controller to recognize and interact with CronJob resources.
5354
*/
5455
err = batchv1.AddToScheme(scheme.Scheme)
5556
Expect(err).NotTo(HaveOccurred())

0 commit comments

Comments
 (0)