From 26696b49790b8d0a9f1cf701ff96fd6aacd40911 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Mon, 14 Feb 2022 16:56:15 +0100 Subject: [PATCH] e2e: retry deleting Rook artifacts in case of error On occasion deploying CephFS components fail due to errors like these: failed to delete provisioner rbac .../csi-provisioner-rbac.yaml By using the deleteResource() helper, an retry is done in case of a failure. Signed-off-by: Niels de Vos --- e2e/cephfs.go | 13 ++----------- e2e/cephfs_helper.go | 1 + 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/e2e/cephfs.go b/e2e/cephfs.go index 6de77cd5e..afb3a516f 100644 --- a/e2e/cephfs.go +++ b/e2e/cephfs.go @@ -51,21 +51,12 @@ var ( func deployCephfsPlugin() { // delete objects deployed by rook - data, err := replaceNamespaceInTemplate(cephFSDirPath + cephFSProvisionerRBAC) - if err != nil { - e2elog.Failf("failed to read content from %s: %v", cephFSDirPath+cephFSProvisionerRBAC, err) - } - _, err = framework.RunKubectlInput(cephCSINamespace, data, "--ignore-not-found=true", ns, "delete", "-f", "-") + err := deleteResource(cephFSDirPath + cephFSProvisionerRBAC) if err != nil { e2elog.Failf("failed to delete provisioner rbac %s: %v", cephFSDirPath+cephFSProvisionerRBAC, err) } - data, err = replaceNamespaceInTemplate(cephFSDirPath + cephFSNodePluginRBAC) - if err != nil { - e2elog.Failf("failed to read content from %s: %v", cephFSDirPath+cephFSNodePluginRBAC, err) - } - _, err = framework.RunKubectlInput(cephCSINamespace, data, "delete", "--ignore-not-found=true", ns, "-f", "-") - + err = deleteResource(cephFSDirPath + cephFSNodePluginRBAC) if err != nil { e2elog.Failf("failed to delete nodeplugin rbac %s: %v", cephFSDirPath+cephFSNodePluginRBAC, err) } diff --git a/e2e/cephfs_helper.go b/e2e/cephfs_helper.go index 0ffd1e4e8..e9d7bfd13 100644 --- a/e2e/cephfs_helper.go +++ b/e2e/cephfs_helper.go @@ -105,6 +105,7 @@ func createCephfsStorageClass( sc.Namespace = cephCSINamespace timeout := time.Duration(deployTimeout) * time.Minute + return wait.PollImmediate(poll, timeout, func() (bool, error) { _, err = c.StorageV1().StorageClasses().Create(context.TODO(), &sc, metav1.CreateOptions{}) if err != nil {