-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create utils testing for OpenShift validator
Remove OpenShift validation from Webhook, and add a test for validating it in Utils package
- Loading branch information
Showing
4 changed files
with
45 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package utils | ||
|
||
import ( | ||
"testing" | ||
|
||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
) | ||
|
||
func TestEvents(t *testing.T) { | ||
RegisterFailHandler(Fail) | ||
RunSpecs(t, "Utils Suite") | ||
} | ||
|
||
var _ = BeforeSuite(func() { | ||
// call start or refactor when moving to "normal" testEnv test | ||
}) | ||
|
||
var _ = AfterSuite(func() { | ||
// call stop or refactor when moving to "normal" testEnv test | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package utils | ||
|
||
import ( | ||
. "github.com/onsi/ginkgo/v2" | ||
. "github.com/onsi/gomega" | ||
|
||
"sigs.k8s.io/controller-runtime/pkg/envtest" | ||
) | ||
|
||
var _ = Describe("Check OpenShift Existance Validation", func() { | ||
testEnv := &envtest.Environment{} | ||
cfg, err := testEnv.Start() | ||
Expect(err).NotTo(HaveOccurred()) | ||
Expect(cfg).NotTo(BeNil()) | ||
When("Validator doesn't aware of OpenShift", func() { | ||
It("should not support OpenShift", func() { | ||
openshiftCheck, err := NewOpenshiftValidator(cfg) | ||
Expect(err).NotTo(HaveOccurred(), "failed to check if we run on Openshift") | ||
Expect(openshiftCheck.IsOpenshiftSupported()).To(BeFalse()) | ||
}) | ||
}) | ||
|
||
}) |