Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

📖 improve tutorial test docs #4443

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ var _ = BeforeSuite(func() {
ctx, cancel = context.WithCancel(context.TODO())

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

/*
The autogenerated test code will add the CronJob Kind schema to the default client-go k8s scheme.
This ensures that the CronJob API/Kind will be used in our test controller.
The CronJob Kind is added to the runtime scheme used by the test environment.
This ensures that the CronJob API is registered with the scheme, allowing the test controller to recognize and interact with CronJob resources.
*/
err = batchv1.AddToScheme(scheme.Scheme)
Expect(err).NotTo(HaveOccurred())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ var _ = BeforeSuite(func() {
ctx, cancel = context.WithCancel(context.TODO())

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

/*
The autogenerated test code will add the CronJob Kind schema to the default client-go k8s scheme.
This ensures that the CronJob API/Kind will be used in our test controller.
The CronJob Kind is added to the runtime scheme used by the test environment.
This ensures that the CronJob API is registered with the scheme, allowing the test controller to recognize and interact with CronJob resources.
*/
err = batchv1.AddToScheme(scheme.Scheme)
Expect(err).NotTo(HaveOccurred())
Expand Down
7 changes: 4 additions & 3 deletions hack/docs/internal/cronjob-tutorial/writing_tests_env.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,14 @@ var (

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

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