Skip to content
Merged
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
38 changes: 24 additions & 14 deletions infra/feast-operator/test/utils/test_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,7 @@ func TrainAndTestModel(namespace string, feastCRName string, feastDeploymentName
"cronJob": {
"containerConfigs": {
"commands": [
"pip install -r ../requirements.txt",
"pip install jupyter==1.1.1 scikit-learn==1.5.2 matplotlib==3.9.2 seaborn==0.13.2 joblib",

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

feels brittle?

"cd ../ && python run.py"
]
}
Expand All @@ -596,13 +596,17 @@ func TrainAndTestModel(namespace string, feastCRName string, feastDeploymentName
fmt.Println("Patched FeatureStore with train/test commands")

By("Validating patch was applied correctly")
cmd = exec.Command("kubectl", "get", "feast/"+feastCRName, "-n", namespace, "-o", "jsonpath={.status.applied.cronJob.containerConfigs.commands}")
output, err := Run(cmd, testDir)
ExpectWithOffset(1, err).NotTo(HaveOccurred())
outputStr := string(output)
Expect(outputStr).To(ContainSubstring("pip install -r ../requirements.txt"))
Expect(outputStr).To(ContainSubstring("python run.py"))
fmt.Print("FeatureStore patched correctly with commands", outputStr)

Eventually(func() string {
cmd := exec.Command("kubectl", "get", "feast/"+feastCRName, "-n", namespace, "-o", "jsonpath={.status.applied.cronJob.containerConfigs.commands}")
output, _ := Run(cmd, testDir)
return string(output)
}, "30s", "3s").Should(
And(
ContainSubstring("python run.py"),
),
)
fmt.Println("FeatureStore patched correctly with commands")

By("Creating Job from CronJob")
CreateAndVerifyJobFromCron(namespace, feastDeploymentName, "feast-test-job", testDir, []string{"Loan rejected!"})
Expand All @@ -616,7 +620,7 @@ func CreateAndVerifyJobFromCron(namespace, cronName, jobName, testDir string, ex
ExpectWithOffset(1, err).NotTo(HaveOccurred())

By("Waiting for Job completion")
cmd = exec.Command("kubectl", "wait", "--for=condition=complete", "--timeout=3m", "job/"+jobName, "-n", namespace)
cmd = exec.Command("kubectl", "wait", "--for=condition=complete", "--timeout=5m", "job/"+jobName, "-n", namespace)
_, err = Run(cmd, testDir)
ExpectWithOffset(1, err).NotTo(HaveOccurred())

Expand All @@ -631,6 +635,7 @@ func CreateAndVerifyJobFromCron(namespace, cronName, jobName, testDir string, ex
for _, expected := range expectedLogSubstrings {
Expect(outputStr).To(ContainSubstring(expected))
}
fmt.Printf("created Job %s and Verified expected Logs ", jobName)
}

// verifies the specified deployment exists and is in the "Available" state.
Expand All @@ -645,11 +650,16 @@ func checkDeployment(namespace, name string) {

// validate that the status of the FeatureStore CR is "Ready".
func validateFeatureStoreCRStatus(namespace, crName string) {
cmd := exec.Command("kubectl", "get", "feast", crName, "-n", namespace, "-o", "jsonpath={.status.phase}")
output, err := cmd.Output()
Expect(err).ToNot(HaveOccurred(), "failed to get Feature Store CR status")
Expect(string(output)).To(Equal("Ready"))
fmt.Printf("Feature Store CR is in %s state\n", output)
Eventually(func() string {
cmd := exec.Command("kubectl", "get", "feast", crName, "-n", namespace, "-o", "jsonpath={.status.phase}")
output, err := cmd.Output()
if err != nil {
return ""
}
return string(output)
}, "2m", "5s").Should(Equal("Ready"), "Feature Store CR did not reach 'Ready' state in time")

fmt.Printf("✅ Feature Store CR %s/%s is in Ready state\n", namespace, crName)
}

// validate the feature store yaml
Expand Down
Loading