Skip to content

Commit

Permalink
fix: E2E test for conversion webhook
Browse files Browse the repository at this point in the history
Signed-off-by: Mateus Oliveira <[email protected]>
  • Loading branch information
mateusoliveira43 committed Jan 7, 2025
1 parent 458615a commit ad175f2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ test-e2e-local: ## Run the end-to-end tests locally
./test/e2e/local.sh

.PHONY: test-e2e-ci
test-e2e-ci: ## Run the end-to-end tests (used in the CI)`
test-e2e-ci: ## Run the end-to-end tests (used in the CI)
./test/e2e/ci.sh

.PHONY: test-book
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,24 @@ var _ = Describe("Manager", Ordered, func() {
Eventually(verifyCAInjection).Should(Succeed())
})

It("should convert CronJob v1 to v2", func() {
By("creating CronJob v1 resource")
cmd := exec.Command(
"kubectl", "create",
"-f", filepath.Join("config", "samples", "batch_v1_cronjob.yaml"),
)
_, err := utils.Run(cmd)
Expect(err).NotTo(HaveOccurred(), "Failed to create CronJob v1 resource")

By("fetching CronJob v2 resource")
cmd = exec.Command(
"kubectl", "get",
"cronjobs.v2.batch.tutorial.kubebuilder.io", "cronjob-sample",
)
_, err = utils.Run(cmd)
Expect(err).NotTo(HaveOccurred(), "Failed to get CronJob v2 resource")
})

// +kubebuilder:scaffold:e2e-webhooks-checks

// TODO: Customize the e2e test suite with scenarios specific to your project.
Expand Down

0 comments on commit ad175f2

Please sign in to comment.