Skip to content

Commit

Permalink
Merge pull request #132 from sustainable-computing-io/initialize-testing
Browse files Browse the repository at this point in the history
add initial test files
  • Loading branch information
mamy-CS authored Sep 11, 2024
2 parents 096551d + 3e50486 commit e350536
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 0 deletions.
32 changes: 32 additions & 0 deletions test/e2e/e2e_suite_test.go
Original file line number Diff line number Diff line change
@@ -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")
}
43 changes: 43 additions & 0 deletions test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
@@ -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))
})
})

0 comments on commit e350536

Please sign in to comment.