Skip to content

Commit

Permalink
fixing test_suite.go updated
Browse files Browse the repository at this point in the history
  • Loading branch information
Sajiyah-Salat committed Jul 31, 2023
1 parent 7441728 commit 18058b0
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions hack/docs/internal/cronjob-tutorial/generate_cronjob.go
Original file line number Diff line number Diff line change
Expand Up @@ -477,13 +477,13 @@ func updateSuiteTest(sp *Sample) {
filepath.Join(sp.ctx.Dir, "internal/controller/suite_test.go"),
`limitations under the License.
*/`, SuiteTestIntro)
CheckError("fixing suite_test.go", err)
CheckError("updating suite_test.go to add license intro", err)

err = pluginutil.InsertCode(
filepath.Join(sp.ctx.Dir, "internal/controller/suite_test.go"),
`import (`, `
"context"`)
CheckError("fixing suite_test.go", err)
CheckError("updating suite_test.go to add context", err)

err = pluginutil.InsertCode(
filepath.Join(sp.ctx.Dir, "internal/controller/suite_test.go"),
Expand All @@ -493,7 +493,7 @@ func updateSuiteTest(sp *Sample) {
`, `
ctrl "sigs.k8s.io/controller-runtime"
`)
CheckError("fixing suite_test.go", err)
CheckError("updating suite_test.go to add ctrl import", err)

err = pluginutil.ReplaceInFile(
filepath.Join(sp.ctx.Dir, "internal/controller/suite_test.go"),
Expand All @@ -502,14 +502,14 @@ var cfg *rest.Config
var k8sClient client.Client
var testEnv *envtest.Environment
`, SuiteTestEnv)
CheckError("fixing suite_test.go", err)
CheckError("updating suite_test.go to add more variables", err)

err = pluginutil.InsertCode(
filepath.Join(sp.ctx.Dir, "internal/controller/suite_test.go"),
`
logf.SetLogger(zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true)))
`, SuiteTestReadCRD)
CheckError("fixing suite_test.go", err)
CheckError("updating suite_test.go to add text about CRD", err)

err = pluginutil.InsertCode(
filepath.Join(sp.ctx.Dir, "internal/controller/suite_test.go"),
Expand All @@ -523,7 +523,7 @@ var testEnv *envtest.Environment
/*
Then, we start the envtest cluster.
*/`)
CheckError("fixing suite_test.go", err)
CheckError("updating suite_test.go to add text to show where envtest cluster start", err)

err = pluginutil.ReplaceInFile(
filepath.Join(sp.ctx.Dir, "internal/controller/suite_test.go"),
Expand All @@ -533,7 +533,7 @@ var testEnv *envtest.Environment
//+kubebuilder:scaffold:scheme
`, SuiteTestAddSchema)
CheckError("fixing suite_test.go", err)
CheckError("updating suite_test.go to add schema", err)

err = pluginutil.InsertCode(
filepath.Join(sp.ctx.Dir, "internal/controller/suite_test.go"),
Expand All @@ -542,7 +542,7 @@ var testEnv *envtest.Environment
Expect(err).NotTo(HaveOccurred())
Expect(k8sClient).NotTo(BeNil())
`, SuiteTestDescription)
CheckError("fixing suite_test.go", err)
CheckError("updating suite_test.go for test description", err)

err = pluginutil.ReplaceInFile(
filepath.Join(sp.ctx.Dir, "internal/controller/suite_test.go"),
Expand All @@ -553,7 +553,7 @@ var _ = AfterSuite(func() {
Expect(err).NotTo(HaveOccurred())
})
`, SuiteTestCleanup)
CheckError("fixing suite_test.go", err)
CheckError("updating suite_test.go to test cleanup", err)
}

func updateKustomization(sp *Sample) {
Expand Down

0 comments on commit 18058b0

Please sign in to comment.