This commit is contained in:
Damian Miller 2022-08-10 18:33:52 -04:00 коммит произвёл Zach Jones
Родитель f6c145dd86
Коммит 3d833ab39b
1 изменённых файлов: 8 добавлений и 8 удалений

Просмотреть файл

@ -20,28 +20,28 @@ import (
var _ = Describe("[Admin API] CertificateSigningRequest action", func() { var _ = Describe("[Admin API] CertificateSigningRequest action", func() {
BeforeEach(skipIfNotInDevelopmentEnv) BeforeEach(skipIfNotInDevelopmentEnv)
const objName = "e2e-test-csr" const prefix = "e2e-test-csr"
const namespace = "openshift" const namespace = "openshift"
const num = 4 const csrCount = 4
It("should be able to approve one or multiple CSRs", func() { It("should be able to approve one or multiple CSRs", func() {
By("creating mock CSRs via Kubernetes API") By("creating mock CSRs via Kubernetes API")
for i := 0; i < num; i++ { for i := 0; i < csrCount; i++ {
csr := mockCSR(objName+strconv.Itoa(i), namespace) csr := mockCSR(prefix+strconv.Itoa(i), namespace)
_, err := clients.Kubernetes.CertificatesV1().CertificateSigningRequests().Create(context.Background(), csr, metav1.CreateOptions{}) _, err := clients.Kubernetes.CertificatesV1().CertificateSigningRequests().Create(context.Background(), csr, metav1.CreateOptions{})
Expect(err).NotTo(HaveOccurred()) Expect(err).NotTo(HaveOccurred())
} }
defer func() { defer func() {
By("deleting the mock CSRs via Kubernetes API") By("deleting the mock CSRs via Kubernetes API")
for i := 0; i < num; i++ { for i := 0; i < csrCount; i++ {
err := clients.Kubernetes.CertificatesV1().CertificateSigningRequests().Delete(context.Background(), objName+strconv.Itoa(i), metav1.DeleteOptions{}) err := clients.Kubernetes.CertificatesV1().CertificateSigningRequests().Delete(context.Background(), prefix+strconv.Itoa(i), metav1.DeleteOptions{})
Expect(err).NotTo(HaveOccurred()) Expect(err).NotTo(HaveOccurred())
} }
}() }()
testCSRApproveOK(objName+"0", namespace) testCSRApproveOK(prefix+"0", namespace)
testCSRMassApproveOK(objName, namespace, num) testCSRMassApproveOK(prefix, namespace, csrCount)
}) })
}) })