From 52780efdff462a0e919004d194413c771770e3d9 Mon Sep 17 00:00:00 2001 From: randytqwjp Date: Wed, 23 Oct 2024 04:15:36 +0900 Subject: [PATCH] fix controller test --- cmd/tortoisectl/main.go | 2 +- internal/controller/tortoise_controller_test.go | 6 ++++++ test/e2e/e2e_suite_test.go | 2 +- test/e2e/e2e_test.go | 4 ++-- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/cmd/tortoisectl/main.go b/cmd/tortoisectl/main.go index f50d98a..5316e67 100644 --- a/cmd/tortoisectl/main.go +++ b/cmd/tortoisectl/main.go @@ -1,4 +1,4 @@ -package main +package tortoisectl import "github.com/mercari/tortoise/cmd/tortoisectl/commands" diff --git a/internal/controller/tortoise_controller_test.go b/internal/controller/tortoise_controller_test.go index 72fd16a..93a9e33 100644 --- a/internal/controller/tortoise_controller_test.go +++ b/internal/controller/tortoise_controller_test.go @@ -16,8 +16,10 @@ import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" autoscalingv1 "k8s.io/autoscaler/vertical-pod-autoscaler/pkg/apis/autoscaling.k8s.io/v1" "k8s.io/client-go/tools/record" + "k8s.io/utils/ptr" ctrl "sigs.k8s.io/controller-runtime" "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/config" "sigs.k8s.io/yaml" "github.com/mercari/tortoise/api/v1beta3" @@ -235,6 +237,9 @@ func startController(ctx context.Context) func() { mgr, err := ctrl.NewManager(cfg, ctrl.Options{ Scheme: scheme, LeaderElection: false, + Controller: config.Controller{ + SkipNameValidation: ptr.To(true), + }, }) Expect(err).ShouldNot(HaveOccurred()) @@ -289,6 +294,7 @@ var _ = Describe("Test TortoiseController", func() { if err != nil { Expect(apierrors.IsNotFound(err)).To(Equal(true)) } + } generateTestCases := func(path string) { diff --git a/test/e2e/e2e_suite_test.go b/test/e2e/e2e_suite_test.go index 9b3d64f..ade105f 100644 --- a/test/e2e/e2e_suite_test.go +++ b/test/e2e/e2e_suite_test.go @@ -27,6 +27,6 @@ import ( // Run e2e tests using the Ginkgo runner. func TestE2E(t *testing.T) { RegisterFailHandler(Fail) - _, _ = fmt.Fprintf(GinkgoWriter, "Starting tortoise-migration-2 suite\n") + _, _ = fmt.Fprintf(GinkgoWriter, "Starting tortoise suite\n") RunSpecs(t, "e2e suite") } diff --git a/test/e2e/e2e_test.go b/test/e2e/e2e_test.go index de79eb3..9720932 100644 --- a/test/e2e/e2e_test.go +++ b/test/e2e/e2e_test.go @@ -24,10 +24,10 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "mercari.com/tortoise/test/utils" + "github.com/mercari/tortoise/test/utils" ) -const namespace = "tortoise-migration-2-system" +const namespace = "tortoise-system" var _ = Describe("controller", Ordered, func() { BeforeAll(func() {