Skip to content

Commit

Permalink
add e2e for imagepulljob secret
Browse files Browse the repository at this point in the history
Signed-off-by: liheng.zms <liheng.zms@alibaba-inc.com>
  • Loading branch information
zmberg committed Aug 7, 2023
1 parent 22b6068 commit 13a11a3
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions test/e2e/apps/pullimages.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package apps

import (
"context"
"fmt"
"time"

Expand Down Expand Up @@ -93,7 +94,7 @@ var _ = SIGDescribe("PullImage", func() {
framework.ConformanceIt("create an always job to pull an image on all real nodes", func() {
job := baseJob.DeepCopy()
job.Spec = appsv1alpha1.ImagePullJobSpec{
Image: NginxImage,
Image: "nginx:1.14.1",
ImagePullJobTemplate: appsv1alpha1.ImagePullJobTemplate{
Selector: &appsv1alpha1.ImagePullJobNodeSelector{LabelSelector: metav1.LabelSelector{MatchExpressions: []metav1.LabelSelectorRequirement{
{Key: framework.FakeNodeImageLabelKey, Operator: metav1.LabelSelectorOpDoesNotExist},
Expand All @@ -108,11 +109,23 @@ var _ = SIGDescribe("PullImage", func() {
ActiveDeadlineSeconds: utilpointer.Int64Ptr(50),
TTLSecondsAfterFinished: utilpointer.Int32Ptr(20),
},
PullSecrets: []string{"test-pull-secret"},
},
}
err := testerForImagePullJob.CreateJob(job)
secret := &v1.Secret{
ObjectMeta: metav1.ObjectMeta{
Namespace: ns,
Name: "test-pull-secret",
},
Type: v1.SecretTypeDockercfg,
Data: map[string][]byte{
v1.DockerConfigKey: []byte(`{"auths":{"docker.io/library/nginx":{"username":"echoserver","password":"test","auth":"ZWNob3NlcnZlcjp0ZXN0"}}}`),
},
}
_, err := c.CoreV1().Secrets(ns).Create(context.TODO(), secret, metav1.CreateOptions{})
gomega.Expect(err).NotTo(gomega.HaveOccurred())
err = testerForImagePullJob.CreateJob(job)
gomega.Expect(err).NotTo(gomega.HaveOccurred())

ginkgo.By("Desired should be equal to number of nodes")
gomega.Eventually(func() int32 {
job, err = testerForImagePullJob.GetJob(job)
Expand Down

0 comments on commit 13a11a3

Please sign in to comment.