From ca051a08cf29311359cc7fb272589d03d8d83851 Mon Sep 17 00:00:00 2001 From: Volodymyr Zotov Date: Thu, 21 Aug 2025 15:22:41 -0500 Subject: [PATCH] Move `testhelper` package to `pkg` so it can be installed as dependency in secrets injector repo --- {test => pkg}/testhelper/defaults/defaults.go | 0 {test => pkg}/testhelper/kind/kind.go | 2 +- {test => pkg}/testhelper/kube/kube.go | 4 ++-- {test => pkg}/testhelper/operator/operator.go | 2 +- {test => pkg}/testhelper/system/system.go | 0 test/e2e/e2e_suite_test.go | 19 +++++++++++++++++++ test/e2e/e2e_test.go | 8 ++++---- 7 files changed, 27 insertions(+), 8 deletions(-) rename {test => pkg}/testhelper/defaults/defaults.go (100%) rename {test => pkg}/testhelper/kind/kind.go (88%) rename {test => pkg}/testhelper/kube/kube.go (96%) rename {test => pkg}/testhelper/operator/operator.go (95%) rename {test => pkg}/testhelper/system/system.go (100%) diff --git a/test/testhelper/defaults/defaults.go b/pkg/testhelper/defaults/defaults.go similarity index 100% rename from test/testhelper/defaults/defaults.go rename to pkg/testhelper/defaults/defaults.go diff --git a/test/testhelper/kind/kind.go b/pkg/testhelper/kind/kind.go similarity index 88% rename from test/testhelper/kind/kind.go rename to pkg/testhelper/kind/kind.go index 4f20160..a561f31 100644 --- a/test/testhelper/kind/kind.go +++ b/pkg/testhelper/kind/kind.go @@ -8,7 +8,7 @@ import ( //nolint:staticcheck // ST1001 . "github.com/onsi/gomega" - "github.com/1Password/onepassword-operator/test/testhelper/system" + "github.com/1Password/onepassword-operator/pkg/testhelper/system" ) // LoadImageToKind loads a local docker image to the Kind cluster diff --git a/test/testhelper/kube/kube.go b/pkg/testhelper/kube/kube.go similarity index 96% rename from test/testhelper/kube/kube.go rename to pkg/testhelper/kube/kube.go index 4684f34..6ee441b 100644 --- a/test/testhelper/kube/kube.go +++ b/pkg/testhelper/kube/kube.go @@ -11,8 +11,8 @@ import ( //nolint:staticcheck // ST1001 . "github.com/onsi/gomega" - "github.com/1Password/onepassword-operator/test/testhelper/defaults" - "github.com/1Password/onepassword-operator/test/testhelper/system" + "github.com/1Password/onepassword-operator/pkg/testhelper/defaults" + "github.com/1Password/onepassword-operator/pkg/testhelper/system" ) func CreateSecretFromEnvVar(envVar, secretName string) { diff --git a/test/testhelper/operator/operator.go b/pkg/testhelper/operator/operator.go similarity index 95% rename from test/testhelper/operator/operator.go rename to pkg/testhelper/operator/operator.go index 69785b0..41bd8cf 100644 --- a/test/testhelper/operator/operator.go +++ b/pkg/testhelper/operator/operator.go @@ -8,7 +8,7 @@ import ( //nolint:staticcheck // ST1001 . "github.com/onsi/gomega" - "github.com/1Password/onepassword-operator/test/testhelper/system" + "github.com/1Password/onepassword-operator/pkg/testhelper/system" ) func BuildOperatorImage() { diff --git a/test/testhelper/system/system.go b/pkg/testhelper/system/system.go similarity index 100% rename from test/testhelper/system/system.go rename to pkg/testhelper/system/system.go diff --git a/test/e2e/e2e_suite_test.go b/test/e2e/e2e_suite_test.go index c45bc90..04ed1b5 100644 --- a/test/e2e/e2e_suite_test.go +++ b/test/e2e/e2e_suite_test.go @@ -12,3 +12,22 @@ func TestE2E(t *testing.T) { RegisterFailHandler(Fail) RunSpecs(t, "onepassword-operator e2e suite") } + +//By("create onepassword-token secret") +//connectToken, _ := os.LookupEnv("OP_CONNECT_TOKEN") +//Expect(connectToken).NotTo(BeEmpty()) +//output := exec.Command("kubectl", "-n", namespace, "create", "secret", "generic", "onepassword-token", "--from-literal=token="+connectToken) +//_, err = utils.Run(output) +//ExpectWithOffset(1, err).NotTo(HaveOccurred()) + +//It("Secret is updated after POOLING_INTERVAL", func() { +// // TODO: implement +//}) +// +//It("Secret with `ignore-secret` annotation is not updated", func() { +// // TODO: implement +//}) +// +//It("Deployment not auto restarts when ", func() { +// // TODO: implement +//}) diff --git a/test/e2e/e2e_test.go b/test/e2e/e2e_test.go index 0e6db5e..d2e57ef 100644 --- a/test/e2e/e2e_test.go +++ b/test/e2e/e2e_test.go @@ -6,10 +6,10 @@ import ( . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" - "github.com/1Password/onepassword-operator/test/testhelper/kind" - "github.com/1Password/onepassword-operator/test/testhelper/kube" - "github.com/1Password/onepassword-operator/test/testhelper/operator" - "github.com/1Password/onepassword-operator/test/testhelper/system" + "github.com/1Password/onepassword-operator/pkg/testhelper/kind" + "github.com/1Password/onepassword-operator/pkg/testhelper/kube" + "github.com/1Password/onepassword-operator/pkg/testhelper/operator" + "github.com/1Password/onepassword-operator/pkg/testhelper/system" ) const (