Skip to content

Commit

Permalink
fix: patch imagePullSecrets validation in e2e test (#666)
Browse files Browse the repository at this point in the history
**Reason for Change**:
patch imagePullSecrets validation in e2e test, only the second image
need this check

**Requirements**

- [ ] added unit tests and e2e tests (if applicable).

**Issue Fixed**:
<!-- If this PR fixes GitHub issue 4321, add "Fixes #4321" to the next
line. -->

**Notes for Reviewers**:

Signed-off-by: Bangqi Zhu <[email protected]>
Co-authored-by: Bangqi Zhu <[email protected]>
  • Loading branch information
2 people authored and zhuangqh committed Nov 15, 2024
1 parent 8838c81 commit a06da2a
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions test/e2e/inference_with_adapters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ var validAdapters1 = []kaitov1alpha1.AdapterSpec{
Source: &kaitov1alpha1.DataSource{
Name: imageName1,
Image: fullImageName1,
ImagePullSecrets: []string{
aiModelsRegistrySecret,
},
},
Strength: &DefaultStrength,
},
Expand All @@ -40,9 +43,6 @@ var validAdapters2 = []kaitov1alpha1.AdapterSpec{
Source: &kaitov1alpha1.DataSource{
Name: imageName2,
Image: fullImageName2,
ImagePullSecrets: []string{
aiModelsRegistrySecret,
},
},
Strength: &DefaultStrength,
},
Expand Down Expand Up @@ -85,9 +85,6 @@ func validateInitContainers(workspaceObj *kaitov1alpha1.Workspace, expectedInitC
return false
}

if dep.Spec.Template.Spec.ImagePullSecrets == nil || len(dep.Spec.Template.Spec.ImagePullSecrets) == 0 {
return false
}
if len(initContainers) != len(expectedInitContainers) {
for _, initContainer := range initContainers {
GinkgoWriter.Printf("initContainer Name: %s\n", initContainer.Name)
Expand All @@ -99,6 +96,11 @@ func validateInitContainers(workspaceObj *kaitov1alpha1.Workspace, expectedInitC
}

initContainer, expectedInitContainer := initContainers[0], expectedInitContainers[0]
if expectedInitContainer.Name == imageName1 { //only the first adapter need to check imagePullSecrets
if dep.Spec.Template.Spec.ImagePullSecrets == nil || len(dep.Spec.Template.Spec.ImagePullSecrets) == 0 {
return false
}
}

GinkgoWriter.Printf("initContainer Image: %s, expectedInitContainer Image: %s", initContainer.Image, expectedInitContainer.Image)
GinkgoWriter.Printf("initContainer Name: %s, expectedInitContainer Name: %s", initContainer.Name, expectedInitContainer.Name)
Expand Down

0 comments on commit a06da2a

Please sign in to comment.