Skip to content

Commit d3bd9dd

Browse files
author
Arvind Thirumurugan
committed
add initial IT
1 parent bdbc0e0 commit d3bd9dd

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

test/crdinstaller/crd_installer_integration_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,25 @@ import (
2020
. "github.com/onsi/ginkgo/v2"
2121
. "github.com/onsi/gomega"
2222

23+
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
24+
"k8s.io/apimachinery/pkg/types"
25+
2326
cmdCRDInstaller "go.goms.io/fleet/cmd/crdinstaller/utils"
2427
)
2528

2629
var _ = Describe("Test CRD Installer", func() {
2730
It("should install CRDs and create a CRD instance", func() {
2831
Expect(cmdCRDInstaller.InstallCRD(ctx, k8sClient, "./original_crds/test.kubernetes-fleet.io_testresources.yaml")).To(Succeed())
2932
})
33+
34+
It("should verify CRD installation", func() {
35+
crdName := "testresources.test.kubernetes-fleet.io"
36+
crd := &apiextensionsv1.CustomResourceDefinition{}
37+
Expect(k8sClient.Get(ctx, types.NamespacedName{Name: crdName}, crd)).NotTo(HaveOccurred(), "CRD %s should be installed", crdName)
38+
39+
v1alpha1Version := crd.Spec.Versions[0]
40+
Expect(v1alpha1Version.Name).Should(Equal("v1alpha1"), "CRD %s should have version v1alpha1", crdName)
41+
42+
Expect(v1alpha1Version.Schema.OpenAPIV3Schema.Properties["spec"].Properties["properties"].Properties["bar"]).ShouldNot(BeNil(), "CRD %s should have 'bar' property in spec", crdName)
43+
})
3044
})

0 commit comments

Comments
 (0)