Skip to content

Commit dde5828

Browse files
committed
Automate OCP-11594 in upstream
1 parent aebf0a6 commit dde5828

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

test/extended/quota/resourcequota.go

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,58 @@ var _ = g.Describe("[sig-api-machinery][Feature:ResourceQuota]", func() {
164164
})
165165
o.Expect(err).NotTo(o.HaveOccurred())
166166
})
167+
168+
g.It("check the quota after import-image with --all option", func() {
169+
testProject := oc.SetupProject()
170+
testResourceQuotaName := "my-imagestream-quota-" + testProject
171+
clusterAdminKubeClient := oc.AdminKubeClient()
172+
173+
rq := &corev1.ResourceQuota{
174+
ObjectMeta: metav1.ObjectMeta{Name: testResourceQuotaName, Namespace: testProject},
175+
Spec: corev1.ResourceQuotaSpec{
176+
Hard: corev1.ResourceList{
177+
"openshift.io/imagestreams": resource.MustParse("10"),
178+
},
179+
},
180+
}
181+
182+
g.By("create the imagestreams and checking the usage")
183+
_, err := clusterAdminKubeClient.CoreV1().ResourceQuotas(testProject).Create(context.Background(), rq, metav1.CreateOptions{})
184+
o.Expect(err).NotTo(o.HaveOccurred())
185+
186+
err = waitForResourceQuotaStatus(clusterAdminKubeClient, testResourceQuotaName, testProject, func(actualResourceQuota *corev1.ResourceQuota) error {
187+
expectedUsedStatus := corev1.ResourceList{
188+
"openshift.io/imagestreams": resource.MustParse("0"),
189+
}
190+
if !equality.Semantic.DeepEqual(actualResourceQuota.Status.Used, expectedUsedStatus) {
191+
return fmt.Errorf("unexpected current total usage: actual: %#v, expected: %#v", actualResourceQuota.Status.Used, expectedUsedStatus)
192+
}
193+
return nil
194+
})
195+
o.Expect(err).NotTo(o.HaveOccurred())
196+
197+
g.By("trying to tag a container image")
198+
err = oc.AsAdmin().WithoutNamespace().Run("import-image").Args("centos", "--from=quay.io/openshifttest/alpine", "--confirm=true", "--all=true", "-n", testProject).Execute()
199+
o.Expect(err).NotTo(o.HaveOccurred())
200+
201+
err = oc.AsAdmin().WithoutNamespace().Run("tag").Args("quay.io/openshifttest/base-alpine@sha256:3126e4eed4a3ebd8bf972b2453fa838200988ee07c01b2251e3ea47e4b1f245c", "--source=docker", "mystream:latest", "-n", testProject).Execute()
202+
o.Expect(err).NotTo(o.HaveOccurred())
203+
204+
err = exutil.WaitForAnImageStreamTag(oc, testProject, "mystream", "latest")
205+
o.Expect(err).NotTo(o.HaveOccurred())
206+
207+
g.By("checking the imagestream usage again")
208+
err = waitForResourceQuotaStatus(clusterAdminKubeClient, testResourceQuotaName, testProject, func(actualResourceQuota *corev1.ResourceQuota) error {
209+
expectedUsedStatus := corev1.ResourceList{
210+
"openshift.io/imagestreams": resource.MustParse("2"),
211+
}
212+
if !equality.Semantic.DeepEqual(actualResourceQuota.Status.Used, expectedUsedStatus) {
213+
return fmt.Errorf("unexpected current total usage: actual: %#v, expected: %#v", actualResourceQuota.Status.Used, expectedUsedStatus)
214+
}
215+
return nil
216+
})
217+
o.Expect(err).NotTo(o.HaveOccurred())
218+
})
167219
})
168220
})
169221

test/extended/util/annotate/generated/zz_generated.annotations.go

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)