@@ -18,6 +18,7 @@ package e2e
1818
1919import (
2020 "fmt"
21+ "os"
2122 "os/exec"
2223 "time"
2324
@@ -36,70 +37,79 @@ const (
3637
3738var _ = Describe ("controller" , Ordered , func () {
3839 BeforeAll (func () {
39- By ("creating manager namespace" )
40- cmd := exec .Command ("kubectl" , "create" , "ns" , feastControllerNamespace )
41- _ , _ = utils .Run (cmd )
42- var err error
43- // projectimage stores the name of the image used in the example
44- var projectimage = "localhost/feast-operator:v0.0.1"
45-
46- By ("building the manager(Operator) image" )
47- cmd = exec .Command ("make" , "docker-build" , fmt .Sprintf ("IMG=%s" , projectimage ))
48- _ , err = utils .Run (cmd )
49- ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
50-
51- By ("loading the the manager(Operator) image on Kind" )
52- err = utils .LoadImageToKindClusterWithName (projectimage )
53- ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
54-
55- By ("building the feast image" )
56- cmd = exec .Command ("make" , "feast-ci-dev-docker-img" )
57- _ , err = utils .Run (cmd )
58- ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
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 ("Tag the local feast image for the integration tests" )
64- cmd = exec .Command ("docker" , "image" , "tag" , feastImage , feastLocalImage )
65- _ , err = utils .Run (cmd )
66- ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
67-
68- By ("loading the the feast image on Kind cluster" )
69- err = utils .LoadImageToKindClusterWithName (feastLocalImage )
70- ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
71-
72- By ("installing CRDs" )
73- cmd = exec .Command ("make" , "install" )
74- _ , err = utils .Run (cmd )
75- ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
76-
77- By ("deploying the controller-manager" )
78- cmd = exec .Command ("make" , "deploy" , fmt .Sprintf ("IMG=%s" , projectimage ), fmt .Sprintf ("FS_IMG=%s" , feastLocalImage ))
79- _ , err = utils .Run (cmd )
80- ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
81-
82- By ("Validating that the controller-manager deployment is in available state" )
83- err = checkIfDeploymentExistsAndAvailable (feastControllerNamespace , controllerDeploymentName , timeout )
84- Expect (err ).ToNot (HaveOccurred (), fmt .Sprintf (
85- "Deployment %s is not available but expected to be available. \n Error: %v\n " ,
86- controllerDeploymentName , err ,
87- ))
88- fmt .Printf ("Feast Control Manager Deployment %s is available\n " , controllerDeploymentName )
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 ())
76+
77+ By ("installing CRDs" )
78+ cmd = exec .Command ("make" , "install" )
79+ _ , err = utils .Run (cmd )
80+ ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
81+
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 ())
86+
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+ }
8995 })
9096
9197 AfterAll (func () {
9298 // Add any post clean up code here.
93- By ("Uninstalling the feast CRD" )
94- cmd := exec .Command ("kubectl" , "delete" , "deployment" , controllerDeploymentName , "-n" , feastControllerNamespace )
95- _ , err := utils .Run (cmd )
96- ExpectWithOffset (1 , err ).NotTo (HaveOccurred ())
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+ }
97106 })
98107
99108 Context ("Operator E2E Tests" , func () {
100109 It ("Should be able to deploy and run a default feature store CR successfully" , func () {
101110 By ("deploying the Simple Feast Custom Resource to Kubernetes" )
102111 namespace := "default"
112+
103113 cmd := exec .Command ("kubectl" , "apply" , "-f" ,
104114 "test/testdata/feast_integration_test_crs/v1alpha1_default_featurestore.yaml" , "-n" , namespace )
105115 _ , cmdOutputerr := utils .Run (cmd )
@@ -120,8 +130,8 @@ var _ = Describe("controller", Ordered, func() {
120130 namespace := "default"
121131 cmd := exec .Command ("kubectl" , "apply" , "-f" ,
122132 "test/testdata/feast_integration_test_crs/v1alpha1_default_featurestore.yaml" , "-n" , namespace )
123- _ , cmdOutputerr := utils .Run (cmd )
124- ExpectWithOffset (1 , cmdOutputerr ).NotTo (HaveOccurred ())
133+ _ , cmdOutputErr := utils .Run (cmd )
134+ ExpectWithOffset (1 , cmdOutputErr ).NotTo (HaveOccurred ())
125135
126136 featureStoreName := "simple-feast-setup"
127137 validateTheFeatureStoreCustomResource (namespace , featureStoreName , timeout )
@@ -134,8 +144,8 @@ var _ = Describe("controller", Ordered, func() {
134144 By ("deploying the Simple Feast remote registry Custom Resource on Kubernetes" )
135145 cmd = exec .Command ("kubectl" , "apply" , "-f" ,
136146 "test/testdata/feast_integration_test_crs/v1alpha1_remote_registry_featurestore.yaml" , "-n" , remoteRegistryNs )
137- _ , cmdOutputerr = utils .Run (cmd )
138- ExpectWithOffset (1 , cmdOutputerr ).NotTo (HaveOccurred ())
147+ _ , cmdOutputErr = utils .Run (cmd )
148+ ExpectWithOffset (1 , cmdOutputErr ).NotTo (HaveOccurred ())
139149
140150 remoteFeatureStoreName := "simple-feast-remote-setup"
141151
@@ -144,14 +154,14 @@ var _ = Describe("controller", Ordered, func() {
144154 By ("deleting the feast remote registry deployment" )
145155 cmd = exec .Command ("kubectl" , "delete" , "-f" ,
146156 "test/testdata/feast_integration_test_crs/v1alpha1_remote_registry_featurestore.yaml" , "-n" , remoteRegistryNs )
147- _ , cmdOutputerr = utils .Run (cmd )
148- ExpectWithOffset (1 , cmdOutputerr ).NotTo (HaveOccurred ())
157+ _ , cmdOutputErr = utils .Run (cmd )
158+ ExpectWithOffset (1 , cmdOutputErr ).NotTo (HaveOccurred ())
149159
150160 By ("deleting the feast deployment" )
151161 cmd = exec .Command ("kubectl" , "delete" , "-f" ,
152162 "test/testdata/feast_integration_test_crs/v1alpha1_default_featurestore.yaml" , "-n" , namespace )
153- _ , cmdOutputerr = utils .Run (cmd )
154- ExpectWithOffset (1 , cmdOutputerr ).NotTo (HaveOccurred ())
163+ _ , cmdOutputErr = utils .Run (cmd )
164+ ExpectWithOffset (1 , cmdOutputErr ).NotTo (HaveOccurred ())
155165 })
156166 })
157167})
0 commit comments