e2e: use retryKubectlFile() for creating & deleting secrets

Signed-off-by: Rakshith R <rar@redhat.com>
This commit is contained in:
Rakshith R 2021-08-02 16:34:12 +05:30 committed by mergify[bot]
parent 0744ad502b
commit 8ca7a35820

View File

@ -815,11 +815,7 @@ var _ = Describe("RBD", func() {
namespace := cephCSINamespace namespace := cephCSINamespace
// create user Secret // create user Secret
secret, err := getSecret(vaultExamplePath + "user-secret.yaml") err = retryKubectlFile(namespace, kubectlCreate, vaultExamplePath+"user-secret.yaml", deployTimeout)
if err != nil {
e2elog.Failf("failed to load user Secret: %v", err)
}
_, err = c.CoreV1().Secrets(namespace).Create(context.TODO(), &secret, metav1.CreateOptions{})
if err != nil { if err != nil {
e2elog.Failf("failed to create user Secret: %v", err) e2elog.Failf("failed to create user Secret: %v", err)
} }
@ -832,7 +828,11 @@ var _ = Describe("RBD", func() {
validateRBDImageCount(f, 0, defaultRBDPool) validateRBDImageCount(f, 0, defaultRBDPool)
// delete user secret // delete user secret
err = c.CoreV1().Secrets(namespace).Delete(context.TODO(), secret.Name, metav1.DeleteOptions{}) err = retryKubectlFile(namespace,
kubectlDelete,
vaultExamplePath+"user-secret.yaml",
deployTimeout,
"--ignore-not-found=true")
if err != nil { if err != nil {
e2elog.Failf("failed to delete user Secret: %v", err) e2elog.Failf("failed to delete user Secret: %v", err)
} }
@ -867,11 +867,7 @@ var _ = Describe("RBD", func() {
namespace := f.UniqueName namespace := f.UniqueName
// create user Secret // create user Secret
secret, err := getSecret(vaultExamplePath + "user-secret.yaml") err = retryKubectlFile(namespace, kubectlCreate, vaultExamplePath+"user-secret.yaml", deployTimeout)
if err != nil {
e2elog.Failf("failed to load user Secret: %v", err)
}
_, err = c.CoreV1().Secrets(namespace).Create(context.TODO(), &secret, metav1.CreateOptions{})
if err != nil { if err != nil {
e2elog.Failf("failed to create user Secret: %v", err) e2elog.Failf("failed to create user Secret: %v", err)
} }
@ -884,7 +880,12 @@ var _ = Describe("RBD", func() {
validateRBDImageCount(f, 0, defaultRBDPool) validateRBDImageCount(f, 0, defaultRBDPool)
// delete user secret // delete user secret
err = c.CoreV1().Secrets(namespace).Delete(context.TODO(), secret.Name, metav1.DeleteOptions{}) err = retryKubectlFile(
namespace,
kubectlDelete,
vaultExamplePath+"user-secret.yaml",
deployTimeout,
"--ignore-not-found=true")
if err != nil { if err != nil {
e2elog.Failf("failed to delete user Secret: %v", err) e2elog.Failf("failed to delete user Secret: %v", err)
} }