Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 28 additions & 6 deletions infra/feast-operator/test/e2e/e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,38 +17,60 @@ limitations under the License.
package e2e

import (
"fmt"
"os"

"github.com/feast-dev/feast/infra/feast-operator/test/utils"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)

var _ = Describe("controller", Ordered, func() {
_, isRunOnOpenShiftCI := os.LookupEnv("RUN_ON_OPENSHIFT_CI")
featureStoreName := "simple-feast-setup"
feastResourceName := utils.FeastPrefix + featureStoreName
feastK8sResourceNames := []string{
feastResourceName + "-online",
feastResourceName + "-offline",
feastResourceName + "-ui",
}
namespace := "test-ns-feast"
defaultFeatureStoreCRTest := "TesDefaultFeastCR"
remoteRegistryFeatureStoreCRTest := "TestRemoteRegistryFeastCR"
applyAndMaterializeTest := "TestApplyAndMaterializeFeastDefinitions"

runTestDeploySimpleCRFunc := utils.GetTestDeploySimpleCRFunc("/test/e2e",
"test/testdata/feast_integration_test_crs/v1alpha1_default_featurestore.yaml",
featureStoreName, feastResourceName, feastK8sResourceNames)
featureStoreName, feastResourceName, feastK8sResourceNames, namespace)

runTestWithRemoteRegistryFunction := utils.GetTestWithRemoteRegistryFunc("/test/e2e",
"test/testdata/feast_integration_test_crs/v1alpha1_default_featurestore.yaml",
"test/testdata/feast_integration_test_crs/v1alpha1_remote_registry_featurestore.yaml",
featureStoreName, feastResourceName, feastK8sResourceNames)
featureStoreName, feastResourceName, feastK8sResourceNames, namespace)

runTestApplyAndMaterializeFunc := utils.RunTestApplyAndMaterializeFunc("/test/e2e", namespace, "credit-scoring", utils.FeastPrefix+"credit-scoring")

BeforeAll(func() {
utils.DeployOperatorFromCode("/test/e2e", false)
if !isRunOnOpenShiftCI {
utils.DeployOperatorFromCode("/test/e2e", false)
}
By(fmt.Sprintf("Creating test namespace: %s", namespace))
err := utils.CreateNamespace(namespace, "/test/e2e")
Expect(err).ToNot(HaveOccurred(), fmt.Sprintf("failed to create namespace %s", namespace))
})

AfterAll(func() {
utils.DeleteOperatorDeployment("/test/e2e")
if !isRunOnOpenShiftCI {
utils.DeleteOperatorDeployment("/test/e2e")
}
By(fmt.Sprintf("Deleting test namespace: %s", namespace))
err := utils.DeleteNamespace(namespace, "/test/e2e")
Expect(err).ToNot(HaveOccurred(), fmt.Sprintf("failed to delete namespace %s", namespace))
})

Context("Operator E2E Tests", func() {
It("Should be able to deploy and run a default feature store CR successfully", runTestDeploySimpleCRFunc)
It("Should be able to deploy and run a feature store with remote registry CR successfully", runTestWithRemoteRegistryFunction)
It("Should be able to deploy and run a "+defaultFeatureStoreCRTest+" successfully", runTestDeploySimpleCRFunc)
It("Should be able to deploy and run a "+remoteRegistryFeatureStoreCRTest+" successfully", runTestWithRemoteRegistryFunction)
It("Should be able to apply and run a "+applyAndMaterializeTest+" materialize feature store definitions using CronJob successfully", runTestApplyAndMaterializeFunc)
})
})
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@ var _ = Describe("previous version operator", Ordered, func() {
}

runTestDeploySimpleCRFunc := utils.GetTestDeploySimpleCRFunc("/test/upgrade", utils.GetSimplePreviousVerCR(),
utils.FeatureStoreName, utils.FeastResourceName, feastK8sResourceNames)
utils.FeatureStoreName, utils.FeastResourceName, feastK8sResourceNames, "default")
runTestWithRemoteRegistryFunction := utils.GetTestWithRemoteRegistryFunc("/test/upgrade", utils.GetSimplePreviousVerCR(),
utils.GetRemoteRegistryPreviousVerCR(), utils.FeatureStoreName, utils.FeastResourceName, feastK8sResourceNames)
utils.GetRemoteRegistryPreviousVerCR(), utils.FeatureStoreName, utils.FeastResourceName, feastK8sResourceNames, "default")

// Run Test on previous version operator
It("Should be able to deploy and run a default feature store CR successfully", runTestDeploySimpleCRFunc)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
apiVersion: v1
kind: Secret
metadata:
name: feast-data-stores
namespace: test-ns-feast
stringData:
redis: |
connection_string: redis.test-ns-feast.svc.cluster.local:6379
sql: |
path: postgresql+psycopg://${POSTGRES_USER}:${POSTGRES_PASSWORD}@postgres.test-ns-feast.svc.cluster.local:5432/${POSTGRES_DB}
cache_ttl_seconds: 60
sqlalchemy_config_kwargs:
echo: false
pool_pre_ping: true
---
apiVersion: feast.dev/v1alpha1
kind: FeatureStore
metadata:
name: credit-scoring
namespace: test-ns-feast
spec:
feastProject: credit_scoring_local
feastProjectDir:
git:
url: https://github.com/feast-dev/feast-credit-score-local-tutorial
ref: 598a270
services:
offlineStore:
persistence:
file:
type: duckdb
onlineStore:
persistence:
store:
type: redis
secretRef:
name: feast-data-stores
server:
envFrom:
- secretRef:
name: postgres-secret
env:
- name: MPLCONFIGDIR
value: /tmp
resources:
requests:
cpu: 150m
memory: 128Mi
registry:
local:
persistence:
store:
type: sql
secretRef:
name: feast-data-stores
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
apiVersion: v1
kind: Secret
metadata:
name: postgres-secret
namespace: test-ns-feast
stringData:
POSTGRES_DB: feast
POSTGRES_USER: feast
POSTGRES_PASSWORD: feast
---
apiVersion: apps/v1
kind: Deployment
metadata:
name: postgres
namespace: test-ns-feast
spec:
replicas: 1
selector:
matchLabels:
app: postgres
template:
metadata:
labels:
app: postgres
spec:
containers:
- name: postgres
image: 'postgres:16-alpine'
ports:
- containerPort: 5432
envFrom:
- secretRef:
name: postgres-secret
volumeMounts:
- mountPath: /var/lib/postgresql
name: postgresdata
volumes:
- name: postgresdata
emptyDir: {}
---
apiVersion: v1
kind: Service
metadata:
name: postgres
namespace: test-ns-feast
labels:
app: postgres
spec:
type: ClusterIP
ports:
- port: 5432
targetPort: 5432
protocol: TCP
selector:
app: postgres
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: redis
namespace: test-ns-feast
spec:
replicas: 1
selector:
matchLabels:
app: redis
template:
metadata:
labels:
app: redis
spec:
containers:
- name: redis
image: 'quay.io/sclorg/redis-7-c9s'
ports:
- containerPort: 6379
env:
- name: ALLOW_EMPTY_PASSWORD
value: "yes"
---
apiVersion: v1
kind: Service
metadata:
name: redis
namespace: test-ns-feast
labels:
app: redis
spec:
type: ClusterIP
ports:
- port: 6379
targetPort: 6379
protocol: TCP
selector:
app: redis
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ spec:
remote:
feastRef:
name: simple-feast-setup
namespace: default
namespace: test-ns-feast
4 changes: 2 additions & 2 deletions infra/feast-operator/test/upgrade/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ var _ = Describe("operator upgrade", Ordered, func() {

Context("Operator upgrade Tests", func() {
runTestDeploySimpleCRFunc := utils.GetTestDeploySimpleCRFunc("/test/upgrade", utils.GetSimplePreviousVerCR(),
utils.FeatureStoreName, utils.FeastResourceName, []string{})
utils.FeatureStoreName, utils.FeastResourceName, []string{}, "default")
runTestWithRemoteRegistryFunction := utils.GetTestWithRemoteRegistryFunc("/test/upgrade", utils.GetSimplePreviousVerCR(),
utils.GetRemoteRegistryPreviousVerCR(), utils.FeatureStoreName, utils.FeastResourceName, []string{})
utils.GetRemoteRegistryPreviousVerCR(), utils.FeatureStoreName, utils.FeastResourceName, []string{}, "default")

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