@@ -27,36 +27,22 @@ import (
2727 "github.com/feast-dev/feast/infra/feast-operator/test/utils"
2828)
2929
30- const namespace = "feast-operator-system"
30+ const feastControllerNamespace = "feast-operator-system"
3131
3232var _ = Describe ("controller" , Ordered , func () {
3333 BeforeAll (func () {
34- By ("installing prometheus operator" )
35- Expect (utils .InstallPrometheusOperator ()).To (Succeed ())
36-
37- By ("installing the cert-manager" )
38- Expect (utils .InstallCertManager ()).To (Succeed ())
39-
4034 By ("creating manager namespace" )
41- cmd := exec .Command ("kubectl" , "create" , "ns" , namespace )
35+ cmd := exec .Command ("kubectl" , "create" , "ns" , feastControllerNamespace )
4236 _ , _ = utils .Run (cmd )
4337 })
4438
4539 AfterAll (func () {
46- By ("uninstalling the Prometheus manager bundle" )
47- utils .UninstallPrometheusOperator ()
48-
49- By ("uninstalling the cert-manager bundle" )
50- utils .UninstallCertManager ()
51-
52- By ("removing manager namespace" )
53- cmd := exec .Command ("kubectl" , "delete" , "ns" , namespace )
54- _ , _ = utils .Run (cmd )
40+ //Add any post clean up code here.
5541 })
5642
5743 Context ("Operator" , func () {
58- It ("should run successfully" , func () {
59- var controllerPodName string
44+ It ("Should be able to deploy and run a default feature store CR successfully" , func () {
45+ // var controllerPodName string
6046 var err error
6147
6248 // projectimage stores the name of the image used in the example
@@ -72,13 +58,19 @@ var _ = Describe("controller", Ordered, func() {
7258 ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
7359
7460 By ("building the feast image" )
75- cmd = exec .Command ("make" , "feast-image-build" )
61+ cmd = exec .Command ("make" , "feast-ci-dev-docker-img" )
62+ _ , err = utils .Run (cmd )
63+ ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
64+ var feastImage = "feastdev/feature-server:dev"
65+ var feastLocalImage = "localhost/feastdev/feature-server:dev"
66+
67+ By ("Tag the local feast image for the integration tests" )
68+ cmd = exec .Command ("docker" , "image" , "tag" , feastImage , feastLocalImage )
7669 _ , err = utils .Run (cmd )
7770 ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
7871
79- var feastImage = "example.com/feature-transformation-server:operator.v0"
80- By ("loading the the feast image on Kind" )
81- err = utils .LoadImageToKindClusterWithName (feastImage )
72+ By ("loading the the feast image on Kind cluster" )
73+ err = utils .LoadImageToKindClusterWithName (feastLocalImage )
8274 ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
8375
8476 By ("installing CRDs" )
@@ -91,41 +83,77 @@ var _ = Describe("controller", Ordered, func() {
9183 _ , err = utils .Run (cmd )
9284 ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
9385
94- By ("validating that the controller-manager pod is running as expected" )
95- verifyControllerUp := func () error {
96- // Get pod name
97-
98- cmd = exec .Command ("kubectl" , "get" ,
99- "pods" , "-l" , "control-plane=controller-manager" ,
100- "-o" , "go-template={{ range .items }}" +
101- "{{ if not .metadata.deletionTimestamp }}" +
102- "{{ .metadata.name }}" +
103- "{{ \" \\ n\" }}{{ end }}{{ end }}" ,
104- "-n" , namespace ,
105- )
106-
107- podOutput , err := utils .Run (cmd )
108- ExpectWithOffset (2 , err ).NotTo (HaveOccurred ())
109- podNames := utils .GetNonEmptyLines (string (podOutput ))
110- if len (podNames ) != 1 {
111- return fmt .Errorf ("expect 1 controller pods running, but got %d" , len (podNames ))
112- }
113- controllerPodName = podNames [0 ]
114- ExpectWithOffset (2 , controllerPodName ).Should (ContainSubstring ("controller-manager" ))
115-
116- // Validate pod status
117- cmd = exec .Command ("kubectl" , "get" ,
118- "pods" , controllerPodName , "-o" , "jsonpath={.status.phase}" ,
119- "-n" , namespace ,
120- )
121- status , err := utils .Run (cmd )
122- ExpectWithOffset (2 , err ).NotTo (HaveOccurred ())
123- if string (status ) != "Running" {
124- return fmt .Errorf ("controller pod in %s status" , status )
125- }
126- return nil
86+ timeout := 2 * time .Minute
87+
88+ controllerDeploymentName := "feast-operator-controller-manager"
89+ By ("Validating that the controller-manager deployment is in available state" )
90+ err = checkIfDeploymentExistsAndAvailable (feastControllerNamespace , controllerDeploymentName , timeout )
91+ Expect (err ).To (BeNil (), fmt .Sprintf (
92+ "Deployment %s is not available but expected to be available. \n Error: %v\n " ,
93+ controllerDeploymentName , err ,
94+ ))
95+ fmt .Printf ("Feast Control Manager Deployment %s is available\n " , controllerDeploymentName )
96+
97+ By ("deploying the Simple Feast Custom Resource to Kubernetes" )
98+ cmd = exec .Command ("kubectl" , "apply" , "-f" ,
99+ "test/testdata/feast_integration_test_crs/v1alpha1_default_featurestore.yaml" )
100+ _ , cmdOutputerr := utils .Run (cmd )
101+ ExpectWithOffset (1 , cmdOutputerr ).NotTo (HaveOccurred ())
102+
103+ namespace := "default"
104+
105+ deploymentNames := [3 ]string {"feast-simple-feast-setup-registry" , "feast-simple-feast-setup-online" , "feast-simple-feast-setup-offline" }
106+ for _ , deploymentName := range deploymentNames {
107+ By (fmt .Sprintf ("validate the feast deployment: %s is up and in availability state." , deploymentName ))
108+ err = checkIfDeploymentExistsAndAvailable (namespace , deploymentName , timeout )
109+ Expect (err ).To (BeNil (), fmt .Sprintf (
110+ "Deployment %s is not available but expected to be available. \n Error: %v\n " ,
111+ deploymentName , err ,
112+ ))
113+ fmt .Printf ("Feast Deployment %s is available\n " , deploymentName )
127114 }
128- EventuallyWithOffset (1 , verifyControllerUp , time .Minute , time .Second ).Should (Succeed ())
115+
116+ By ("Check if the feast client - kubernetes config map exists." )
117+ configMapName := "feast-simple-feast-setup-client"
118+ err = checkIfConfigMapExists (namespace , configMapName )
119+ Expect (err ).To (BeNil (), fmt .Sprintf (
120+ "config map %s is not available but expected to be available. \n Error: %v\n " ,
121+ configMapName , err ,
122+ ))
123+ fmt .Printf ("Feast Deployment %s is available\n " , configMapName )
124+
125+ serviceAccountNames := [3 ]string {"feast-simple-feast-setup-registry" , "feast-simple-feast-setup-online" , "feast-simple-feast-setup-offline" }
126+ for _ , serviceAccountName := range serviceAccountNames {
127+ By (fmt .Sprintf ("validate the feast service account: %s is available." , serviceAccountName ))
128+ err = checkIfServiceAccountExists (namespace , serviceAccountName )
129+ Expect (err ).To (BeNil (), fmt .Sprintf (
130+ "Service account %s does not exist in namespace %s. Error: %v" ,
131+ serviceAccountName , namespace , err ,
132+ ))
133+ fmt .Printf ("Service account %s exists in namespace %s\n " , serviceAccountName , namespace )
134+ }
135+
136+ serviceNames := [3 ]string {"feast-simple-feast-setup-registry" , "feast-simple-feast-setup-online" , "feast-simple-feast-setup-offline" }
137+ for _ , serviceName := range serviceNames {
138+ By (fmt .Sprintf ("validate the kubernetes service name: %s is available." , serviceName ))
139+ err = checkIfKubernetesServiceExists (namespace , serviceName )
140+ Expect (err ).To (BeNil (), fmt .Sprintf (
141+ "kubernetes service %s is not available but expected to be available. \n Error: %v\n " ,
142+ serviceName , err ,
143+ ))
144+ fmt .Printf ("kubernetes service %s is available\n " , serviceName )
145+ }
146+
147+ By ("deleting the feast deployment" )
148+ cmd = exec .Command ("kubectl" , "delete" , "-f" ,
149+ "test/testdata/feast_integration_test_crs/v1alpha1_default_featurestore.yaml" )
150+ _ , cmdOutputerr = utils .Run (cmd )
151+ ExpectWithOffset (1 , cmdOutputerr ).NotTo (HaveOccurred ())
152+
153+ By ("Uninstalling the feast CRD" )
154+ cmd = exec .Command ("kubectl" , "delete" , "deployment" , controllerDeploymentName , "-n" , feastControllerNamespace )
155+ _ , err = utils .Run (cmd )
156+ ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
129157
130158 })
131159 })
0 commit comments