From 3e5048609effecb7e94b2c6d0b0f8f8bb500b8a5 Mon Sep 17 00:00:00 2001 From: MohammedAbdi Date: Wed, 11 Sep 2024 12:13:05 -0400 Subject: [PATCH] add initial test files Signed-off-by: MohammedAbdi --- test/e2e/e2e_suite_test.go | 32 ++++++++++++++++++++++++++++ test/e2e/e2e_test.go | 43 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) diff --git a/test/e2e/e2e_suite_test.go b/test/e2e/e2e_suite_test.go index e69de29..78df5f5 100644 --- a/test/e2e/e2e_suite_test.go +++ b/test/e2e/e2e_suite_test.go @@ -0,0 +1,32 @@ +/* +Copyright 2024. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package e2e + +import ( + "fmt" + "testing" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +// Run e2e tests using the Ginkgo runner. +func TestE2E(t *testing.T) { + RegisterFailHandler(Fail) + fmt.Fprintf(GinkgoWriter, "Starting susql-operator suite\n") + RunSpecs(t, "e2e suite") +} diff --git a/test/e2e/e2e_test.go b/test/e2e/e2e_test.go index e69de29..8c079a4 100644 --- a/test/e2e/e2e_test.go +++ b/test/e2e/e2e_test.go @@ -0,0 +1,43 @@ +/* +Copyright 2024. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package e2e + +import ( + "fmt" + "os/exec" + + . "github.com/onsi/ginkgo/v2" + . "github.com/onsi/gomega" +) + +//TODO: add more test cases - + +var _ = Describe("controller", Ordered, func() { + var namespace string = "susql-operator" + + BeforeAll(func() { + fmt.Println("Setting up Kind cluster") + cmd := exec.Command("kind", "create", "cluster") + output, err := cmd.CombinedOutput() + Expect(err).NotTo(HaveOccurred(), fmt.Sprintf("Failed to create Kind cluster: %s", output)) + + By("creating manager namespace") + cmdNamespace := exec.Command("kubectl", "create", "ns", namespace) + outputNs, err := cmdNamespace.CombinedOutput() + Expect(err).NotTo(HaveOccurred(), fmt.Sprintf("Failed to create namespace: %s", outputNs)) + }) +})