Skip to content

Commit 2540846

Browse files
authored
test: Add Operator E2E tests for Feast Apply and Materialize functionality (feast-dev#5389)
Signed-off-by: Srihari <[email protected]>
1 parent 434dd92 commit 2540846

File tree

8 files changed

+449
-20
lines changed

8 files changed

+449
-20
lines changed

infra/feast-operator/test/e2e/e2e_test.go

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,38 +17,60 @@ limitations under the License.
1717
package e2e
1818

1919
import (
20+
"fmt"
21+
"os"
22+
2023
"github.com/feast-dev/feast/infra/feast-operator/test/utils"
2124
. "github.com/onsi/ginkgo/v2"
25+
. "github.com/onsi/gomega"
2226
)
2327

2428
var _ = Describe("controller", Ordered, func() {
29+
_, isRunOnOpenShiftCI := os.LookupEnv("RUN_ON_OPENSHIFT_CI")
2530
featureStoreName := "simple-feast-setup"
2631
feastResourceName := utils.FeastPrefix + featureStoreName
2732
feastK8sResourceNames := []string{
2833
feastResourceName + "-online",
2934
feastResourceName + "-offline",
3035
feastResourceName + "-ui",
3136
}
37+
namespace := "test-ns-feast"
38+
defaultFeatureStoreCRTest := "TesDefaultFeastCR"
39+
remoteRegistryFeatureStoreCRTest := "TestRemoteRegistryFeastCR"
40+
applyAndMaterializeTest := "TestApplyAndMaterializeFeastDefinitions"
3241

3342
runTestDeploySimpleCRFunc := utils.GetTestDeploySimpleCRFunc("/test/e2e",
3443
"test/testdata/feast_integration_test_crs/v1alpha1_default_featurestore.yaml",
35-
featureStoreName, feastResourceName, feastK8sResourceNames)
44+
featureStoreName, feastResourceName, feastK8sResourceNames, namespace)
3645

3746
runTestWithRemoteRegistryFunction := utils.GetTestWithRemoteRegistryFunc("/test/e2e",
3847
"test/testdata/feast_integration_test_crs/v1alpha1_default_featurestore.yaml",
3948
"test/testdata/feast_integration_test_crs/v1alpha1_remote_registry_featurestore.yaml",
40-
featureStoreName, feastResourceName, feastK8sResourceNames)
49+
featureStoreName, feastResourceName, feastK8sResourceNames, namespace)
50+
51+
runTestApplyAndMaterializeFunc := utils.RunTestApplyAndMaterializeFunc("/test/e2e", namespace, "credit-scoring", utils.FeastPrefix+"credit-scoring")
4152

4253
BeforeAll(func() {
43-
utils.DeployOperatorFromCode("/test/e2e", false)
54+
if !isRunOnOpenShiftCI {
55+
utils.DeployOperatorFromCode("/test/e2e", false)
56+
}
57+
By(fmt.Sprintf("Creating test namespace: %s", namespace))
58+
err := utils.CreateNamespace(namespace, "/test/e2e")
59+
Expect(err).ToNot(HaveOccurred(), fmt.Sprintf("failed to create namespace %s", namespace))
4460
})
4561

4662
AfterAll(func() {
47-
utils.DeleteOperatorDeployment("/test/e2e")
63+
if !isRunOnOpenShiftCI {
64+
utils.DeleteOperatorDeployment("/test/e2e")
65+
}
66+
By(fmt.Sprintf("Deleting test namespace: %s", namespace))
67+
err := utils.DeleteNamespace(namespace, "/test/e2e")
68+
Expect(err).ToNot(HaveOccurred(), fmt.Sprintf("failed to delete namespace %s", namespace))
4869
})
4970

5071
Context("Operator E2E Tests", func() {
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)
72+
It("Should be able to deploy and run a "+defaultFeatureStoreCRTest+" successfully", runTestDeploySimpleCRFunc)
73+
It("Should be able to deploy and run a "+remoteRegistryFeatureStoreCRTest+" successfully", runTestWithRemoteRegistryFunction)
74+
It("Should be able to apply and run a "+applyAndMaterializeTest+" materialize feature store definitions using CronJob successfully", runTestApplyAndMaterializeFunc)
5375
})
5476
})

infra/feast-operator/test/previous-version/previous_version_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ var _ = Describe("previous version operator", Ordered, func() {
3838
}
3939

4040
runTestDeploySimpleCRFunc := utils.GetTestDeploySimpleCRFunc("/test/upgrade", utils.GetSimplePreviousVerCR(),
41-
utils.FeatureStoreName, utils.FeastResourceName, feastK8sResourceNames)
41+
utils.FeatureStoreName, utils.FeastResourceName, feastK8sResourceNames, "default")
4242
runTestWithRemoteRegistryFunction := utils.GetTestWithRemoteRegistryFunc("/test/upgrade", utils.GetSimplePreviousVerCR(),
43-
utils.GetRemoteRegistryPreviousVerCR(), utils.FeatureStoreName, utils.FeastResourceName, feastK8sResourceNames)
43+
utils.GetRemoteRegistryPreviousVerCR(), utils.FeatureStoreName, utils.FeastResourceName, feastK8sResourceNames, "default")
4444

4545
// Run Test on previous version operator
4646
It("Should be able to deploy and run a default feature store CR successfully", runTestDeploySimpleCRFunc)
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: feast-data-stores
5+
namespace: test-ns-feast
6+
stringData:
7+
redis: |
8+
connection_string: redis.test-ns-feast.svc.cluster.local:6379
9+
sql: |
10+
path: postgresql+psycopg://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres.test-ns-feast.svc.cluster.local:5432/${POSTGRES_DB}
11+
cache_ttl_seconds: 60
12+
sqlalchemy_config_kwargs:
13+
echo: false
14+
pool_pre_ping: true
15+
---
16+
apiVersion: feast.dev/v1alpha1
17+
kind: FeatureStore
18+
metadata:
19+
name: credit-scoring
20+
namespace: test-ns-feast
21+
spec:
22+
feastProject: credit_scoring_local
23+
feastProjectDir:
24+
git:
25+
url: https://github.com/feast-dev/feast-credit-score-local-tutorial
26+
ref: 598a270
27+
services:
28+
offlineStore:
29+
persistence:
30+
file:
31+
type: duckdb
32+
onlineStore:
33+
persistence:
34+
store:
35+
type: redis
36+
secretRef:
37+
name: feast-data-stores
38+
server:
39+
envFrom:
40+
- secretRef:
41+
name: postgres-secret
42+
env:
43+
- name: MPLCONFIGDIR
44+
value: /tmp
45+
resources:
46+
requests:
47+
cpu: 150m
48+
memory: 128Mi
49+
registry:
50+
local:
51+
persistence:
52+
store:
53+
type: sql
54+
secretRef:
55+
name: feast-data-stores
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: postgres-secret
5+
namespace: test-ns-feast
6+
stringData:
7+
POSTGRES_DB: feast
8+
POSTGRES_USER: feast
9+
POSTGRES_PASSWORD: feast
10+
---
11+
apiVersion: apps/v1
12+
kind: Deployment
13+
metadata:
14+
name: postgres
15+
namespace: test-ns-feast
16+
spec:
17+
replicas: 1
18+
selector:
19+
matchLabels:
20+
app: postgres
21+
template:
22+
metadata:
23+
labels:
24+
app: postgres
25+
spec:
26+
containers:
27+
- name: postgres
28+
image: 'postgres:16-alpine'
29+
ports:
30+
- containerPort: 5432
31+
envFrom:
32+
- secretRef:
33+
name: postgres-secret
34+
volumeMounts:
35+
- mountPath: /var/lib/postgresql
36+
name: postgresdata
37+
volumes:
38+
- name: postgresdata
39+
emptyDir: {}
40+
---
41+
apiVersion: v1
42+
kind: Service
43+
metadata:
44+
name: postgres
45+
namespace: test-ns-feast
46+
labels:
47+
app: postgres
48+
spec:
49+
type: ClusterIP
50+
ports:
51+
- port: 5432
52+
targetPort: 5432
53+
protocol: TCP
54+
selector:
55+
app: postgres
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: redis
5+
namespace: test-ns-feast
6+
spec:
7+
replicas: 1
8+
selector:
9+
matchLabels:
10+
app: redis
11+
template:
12+
metadata:
13+
labels:
14+
app: redis
15+
spec:
16+
containers:
17+
- name: redis
18+
image: 'quay.io/sclorg/redis-7-c9s'
19+
ports:
20+
- containerPort: 6379
21+
env:
22+
- name: ALLOW_EMPTY_PASSWORD
23+
value: "yes"
24+
---
25+
apiVersion: v1
26+
kind: Service
27+
metadata:
28+
name: redis
29+
namespace: test-ns-feast
30+
labels:
31+
app: redis
32+
spec:
33+
type: ClusterIP
34+
ports:
35+
- port: 6379
36+
targetPort: 6379
37+
protocol: TCP
38+
selector:
39+
app: redis

infra/feast-operator/test/testdata/feast_integration_test_crs/v1alpha1_remote_registry_featurestore.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ spec:
1212
remote:
1313
feastRef:
1414
name: simple-feast-setup
15-
namespace: default
15+
namespace: test-ns-feast

infra/feast-operator/test/upgrade/upgrade_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@ var _ = Describe("operator upgrade", Ordered, func() {
3333

3434
Context("Operator upgrade Tests", func() {
3535
runTestDeploySimpleCRFunc := utils.GetTestDeploySimpleCRFunc("/test/upgrade", utils.GetSimplePreviousVerCR(),
36-
utils.FeatureStoreName, utils.FeastResourceName, []string{})
36+
utils.FeatureStoreName, utils.FeastResourceName, []string{}, "default")
3737
runTestWithRemoteRegistryFunction := utils.GetTestWithRemoteRegistryFunc("/test/upgrade", utils.GetSimplePreviousVerCR(),
38-
utils.GetRemoteRegistryPreviousVerCR(), utils.FeatureStoreName, utils.FeastResourceName, []string{})
38+
utils.GetRemoteRegistryPreviousVerCR(), utils.FeatureStoreName, utils.FeastResourceName, []string{}, "default")
3939

4040
// Run Test on current version operator with previous version CR
4141
It("Should be able to deploy and run a default feature store CR successfully", runTestDeploySimpleCRFunc)

0 commit comments

Comments
 (0)