@@ -17,217 +17,38 @@ limitations under the License.
17
17
package e2e
18
18
19
19
import (
20
- "fmt"
21
- "os"
22
- "os/exec"
23
- "time"
24
-
25
- . "github.com/onsi/ginkgo/v2"
26
- . "github.com/onsi/gomega"
27
-
28
20
"github.com/feast-dev/feast/infra/feast-operator/test/utils"
29
- )
30
-
31
- const (
32
- feastControllerNamespace = "feast-operator-system"
33
- timeout = 2 * time .Minute
34
- controllerDeploymentName = "feast-operator-controller-manager"
35
- feastPrefix = "feast-"
21
+ . "github.com/onsi/ginkgo/v2"
36
22
)
37
23
38
24
var _ = Describe ("controller" , Ordered , func () {
39
- BeforeAll (func () {
40
- _ , isRunOnOpenShiftCI := os .LookupEnv ("RUN_ON_OPENSHIFT_CI" )
41
- if ! isRunOnOpenShiftCI {
42
- By ("creating manager namespace" )
43
- cmd := exec .Command ("kubectl" , "create" , "ns" , feastControllerNamespace )
44
- _ , _ = utils .Run (cmd )
45
-
46
- var err error
47
- // projectimage stores the name of the image used in the example
48
- var projectimage = "localhost/feast-operator:v0.0.1"
49
-
50
- By ("building the manager(Operator) image" )
51
- cmd = exec .Command ("make" , "docker-build" , fmt .Sprintf ("IMG=%s" , projectimage ))
52
- _ , err = utils .Run (cmd )
53
- ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
54
-
55
- By ("loading the the manager(Operator) image on Kind" )
56
- err = utils .LoadImageToKindClusterWithName (projectimage )
57
- ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
58
-
59
- // this image will be built in above make target.
60
- var feastImage = "feastdev/feature-server:dev"
61
- var feastLocalImage = "localhost/feastdev/feature-server:dev"
62
-
63
- By ("building the feast image" )
64
- cmd = exec .Command ("make" , "feast-ci-dev-docker-img" )
65
- _ , err = utils .Run (cmd )
66
- ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
67
-
68
- By ("Tag the local feast image for the integration tests" )
69
- cmd = exec .Command ("docker" , "image" , "tag" , feastImage , feastLocalImage )
70
- _ , err = utils .Run (cmd )
71
- ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
72
-
73
- By ("loading the the feast image on Kind cluster" )
74
- err = utils .LoadImageToKindClusterWithName (feastLocalImage )
75
- ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
25
+ featureStoreName := "simple-feast-setup"
26
+ feastResourceName := utils .FeastPrefix + featureStoreName
27
+ feastK8sResourceNames := []string {
28
+ feastResourceName + "-online" ,
29
+ feastResourceName + "-offline" ,
30
+ feastResourceName + "-ui" ,
31
+ }
76
32
77
- By ("installing CRDs" )
78
- cmd = exec .Command ("make" , "install" )
79
- _ , err = utils .Run (cmd )
80
- ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
33
+ runTestDeploySimpleCRFunc := utils .GetTestDeploySimpleCRFunc ("/test/e2e" ,
34
+ "test/testdata/feast_integration_test_crs/v1alpha1_default_featurestore.yaml" ,
35
+ featureStoreName , feastResourceName , feastK8sResourceNames )
81
36
82
- By ( "deploying the controller-manager" )
83
- cmd = exec . Command ( "make" , "deploy" , fmt . Sprintf ( "IMG=%s" , projectimage ), fmt . Sprintf ( "FS_IMG=%s" , feastLocalImage ))
84
- _ , err = utils . Run ( cmd )
85
- ExpectWithOffset ( 1 , err ). NotTo ( HaveOccurred () )
37
+ runTestWithRemoteRegistryFunction := utils . GetTestWithRemoteRegistryFunc ( "/test/e2e" ,
38
+ "test/testdata/feast_integration_test_crs/v1alpha1_default_featurestore.yaml" ,
39
+ "test/testdata/feast_integration_test_crs/v1alpha1_remote_registry_featurestore.yaml" ,
40
+ featureStoreName , feastResourceName , feastK8sResourceNames )
86
41
87
- By ("Validating that the controller-manager deployment is in available state" )
88
- err = checkIfDeploymentExistsAndAvailable (feastControllerNamespace , controllerDeploymentName , timeout )
89
- Expect (err ).ToNot (HaveOccurred (), fmt .Sprintf (
90
- "Deployment %s is not available but expected to be available. \n Error: %v\n " ,
91
- controllerDeploymentName , err ,
92
- ))
93
- fmt .Printf ("Feast Control Manager Deployment %s is available\n " , controllerDeploymentName )
94
- }
42
+ BeforeAll (func () {
43
+ utils .DeployOperatorFromCode ("/test/e2e" )
95
44
})
96
45
97
46
AfterAll (func () {
98
- // Add any post clean up code here.
99
- _ , isRunOnOpenShiftCI := os .LookupEnv ("RUN_ON_OPENSHIFT_CI" )
100
- if ! isRunOnOpenShiftCI {
101
- By ("Uninstalling the feast CRD" )
102
- cmd := exec .Command ("kubectl" , "delete" , "deployment" , controllerDeploymentName , "-n" , feastControllerNamespace )
103
- _ , err := utils .Run (cmd )
104
- ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
105
- }
47
+ utils .DeleteOperatorDeployment ("/test/e2e" )
106
48
})
107
49
108
50
Context ("Operator E2E Tests" , func () {
109
- It ("Should be able to deploy and run a default feature store CR successfully" , func () {
110
- By ("deploying the Simple Feast Custom Resource to Kubernetes" )
111
- namespace := "default"
112
-
113
- cmd := exec .Command ("kubectl" , "apply" , "-f" ,
114
- "test/testdata/feast_integration_test_crs/v1alpha1_default_featurestore.yaml" , "-n" , namespace )
115
- _ , cmdOutputerr := utils .Run (cmd )
116
- ExpectWithOffset (1 , cmdOutputerr ).NotTo (HaveOccurred ())
117
-
118
- featureStoreName := "simple-feast-setup"
119
- validateTheFeatureStoreCustomResource (namespace , featureStoreName , timeout )
120
-
121
- By ("deleting the feast deployment" )
122
- cmd = exec .Command ("kubectl" , "delete" , "-f" ,
123
- "test/testdata/feast_integration_test_crs/v1alpha1_default_featurestore.yaml" )
124
- _ , cmdOutputerr = utils .Run (cmd )
125
- ExpectWithOffset (1 , cmdOutputerr ).NotTo (HaveOccurred ())
126
- })
127
-
128
- It ("Should be able to deploy and run a feature store with remote registry CR successfully" , func () {
129
- By ("deploying the Simple Feast Custom Resource to Kubernetes" )
130
- namespace := "default"
131
- cmd := exec .Command ("kubectl" , "apply" , "-f" ,
132
- "test/testdata/feast_integration_test_crs/v1alpha1_default_featurestore.yaml" , "-n" , namespace )
133
- _ , cmdOutputErr := utils .Run (cmd )
134
- ExpectWithOffset (1 , cmdOutputErr ).NotTo (HaveOccurred ())
135
-
136
- featureStoreName := "simple-feast-setup"
137
- validateTheFeatureStoreCustomResource (namespace , featureStoreName , timeout )
138
-
139
- var remoteRegistryNs = "remote-registry"
140
- By (fmt .Sprintf ("Creating the remote registry namespace=%s" , remoteRegistryNs ))
141
- cmd = exec .Command ("kubectl" , "create" , "ns" , remoteRegistryNs )
142
- _ , _ = utils .Run (cmd )
143
-
144
- By ("deploying the Simple Feast remote registry Custom Resource on Kubernetes" )
145
- cmd = exec .Command ("kubectl" , "apply" , "-f" ,
146
- "test/testdata/feast_integration_test_crs/v1alpha1_remote_registry_featurestore.yaml" , "-n" , remoteRegistryNs )
147
- _ , cmdOutputErr = utils .Run (cmd )
148
- ExpectWithOffset (1 , cmdOutputErr ).NotTo (HaveOccurred ())
149
-
150
- remoteFeatureStoreName := "simple-feast-remote-setup"
151
-
152
- validateTheFeatureStoreCustomResource (remoteRegistryNs , remoteFeatureStoreName , timeout )
153
-
154
- By ("deleting the feast remote registry deployment" )
155
- cmd = exec .Command ("kubectl" , "delete" , "-f" ,
156
- "test/testdata/feast_integration_test_crs/v1alpha1_remote_registry_featurestore.yaml" , "-n" , remoteRegistryNs )
157
- _ , cmdOutputErr = utils .Run (cmd )
158
- ExpectWithOffset (1 , cmdOutputErr ).NotTo (HaveOccurred ())
159
-
160
- By ("deleting the feast deployment" )
161
- cmd = exec .Command ("kubectl" , "delete" , "-f" ,
162
- "test/testdata/feast_integration_test_crs/v1alpha1_default_featurestore.yaml" , "-n" , namespace )
163
- _ , cmdOutputErr = utils .Run (cmd )
164
- ExpectWithOffset (1 , cmdOutputErr ).NotTo (HaveOccurred ())
165
- })
51
+ It ("Should be able to deploy and run a default feature store CR successfully" , runTestDeploySimpleCRFunc )
52
+ It ("Should be able to deploy and run a feature store with remote registry CR successfully" , runTestWithRemoteRegistryFunction )
166
53
})
167
54
})
168
-
169
- func validateTheFeatureStoreCustomResource (namespace string , featureStoreName string , timeout time.Duration ) {
170
- hasRemoteRegistry , err := isFeatureStoreHavingRemoteRegistry (namespace , featureStoreName )
171
- Expect (err ).ToNot (HaveOccurred (), fmt .Sprintf (
172
- "Error occurred while checking FeatureStore %s is having remote registry or not. \n Error: %v\n " ,
173
- featureStoreName , err ))
174
-
175
- feastResourceName := feastPrefix + featureStoreName
176
- k8sResourceNames := []string {feastResourceName }
177
- feastK8sResourceNames := []string {
178
- feastResourceName + "-online" ,
179
- feastResourceName + "-offline" ,
180
- feastResourceName + "-ui" ,
181
- }
182
-
183
- if ! hasRemoteRegistry {
184
- feastK8sResourceNames = append (feastK8sResourceNames , feastResourceName + "-registry" )
185
- }
186
-
187
- for _ , deploymentName := range k8sResourceNames {
188
- By (fmt .Sprintf ("validate the feast deployment: %s is up and in availability state." , deploymentName ))
189
- err = checkIfDeploymentExistsAndAvailable (namespace , deploymentName , timeout )
190
- Expect (err ).ToNot (HaveOccurred (), fmt .Sprintf (
191
- "Deployment %s is not available but expected to be available. \n Error: %v\n " ,
192
- deploymentName , err ,
193
- ))
194
- fmt .Printf ("Feast Deployment %s is available\n " , deploymentName )
195
- }
196
-
197
- By ("Check if the feast client - kubernetes config map exists." )
198
- configMapName := feastResourceName + "-client"
199
- err = checkIfConfigMapExists (namespace , configMapName )
200
- Expect (err ).ToNot (HaveOccurred (), fmt .Sprintf (
201
- "config map %s is not available but expected to be available. \n Error: %v\n " ,
202
- configMapName , err ,
203
- ))
204
- fmt .Printf ("Feast Deployment client config map %s is available\n " , configMapName )
205
-
206
- for _ , serviceAccountName := range k8sResourceNames {
207
- By (fmt .Sprintf ("validate the feast service account: %s is available." , serviceAccountName ))
208
- err = checkIfServiceAccountExists (namespace , serviceAccountName )
209
- Expect (err ).ToNot (HaveOccurred (), fmt .Sprintf (
210
- "Service account %s does not exist in namespace %s. Error: %v" ,
211
- serviceAccountName , namespace , err ,
212
- ))
213
- fmt .Printf ("Service account %s exists in namespace %s\n " , serviceAccountName , namespace )
214
- }
215
-
216
- for _ , serviceName := range feastK8sResourceNames {
217
- By (fmt .Sprintf ("validate the kubernetes service name: %s is available." , serviceName ))
218
- err = checkIfKubernetesServiceExists (namespace , serviceName )
219
- Expect (err ).ToNot (HaveOccurred (), fmt .Sprintf (
220
- "kubernetes service %s is not available but expected to be available. \n Error: %v\n " ,
221
- serviceName , err ,
222
- ))
223
- fmt .Printf ("kubernetes service %s is available\n " , serviceName )
224
- }
225
-
226
- By (fmt .Sprintf ("Checking FeatureStore customer resource: %s is in Ready Status." , featureStoreName ))
227
- err = checkIfFeatureStoreCustomResourceConditionsInReady (featureStoreName , namespace )
228
- Expect (err ).ToNot (HaveOccurred (), fmt .Sprintf (
229
- "FeatureStore custom resource %s all conditions are not in ready state. \n Error: %v\n " ,
230
- featureStoreName , err ,
231
- ))
232
- fmt .Printf ("FeatureStore custom resource %s conditions are in Ready State\n " , featureStoreName )
233
- }
0 commit comments