Skip to content

Commit

Permalink
Make sure PV and PVC in tests use same storageClassName.
Browse files Browse the repository at this point in the history
ALso fixed a problem with backup tests that was causing them to skip
policy cleanup.
  • Loading branch information
draghuram committed Feb 21, 2020
1 parent f42adfa commit db89bb7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
1 change: 1 addition & 0 deletions tests/src/common/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def create_pvc_for_pv(pv):
"storage": pv.spec.capacity["storage"]
}
},
"storageClassName": "standard",
"volumeMode": "Filesystem",
"volumeName": pv.metadata.name
}
Expand Down
9 changes: 6 additions & 3 deletions tests/src/test_backup.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def resources(globalconfig):
kubeclient.create_backuploc_creds(backuploc_creds, backuploc["access_key"], backuploc["secret_key"],
globalconfig.restic_password)

resdata = {"backuploc_creds": backuploc_creds, "pods": []}
resdata = {"backuploc_creds": backuploc_creds, "pods": [], "backup_names": []}

# If we create multiple resources in set up, we need to take care to do clean
# up in case there are any errors. This is not an issue right now as we create
Expand All @@ -59,7 +59,10 @@ def resources(globalconfig):
util.ignore_errors(lambda: log_state(globalconfig.namespace, resdata))

util.ignore_errors_pred("restore_name" in resdata, lambda: globalconfig.mr_api.delete(resdata["restore_name"]))
util.ignore_errors_pred("backup_name" in resdata, lambda: globalconfig.mbp_api.delete(resdata["backup_name"]))

for backup_name in resdata.get("backup_names", []):
util.ignore_errors(lambda: globalconfig.mbp_api.delete(backup_name))

util.ignore_errors_pred("etcd_creds" in resdata, lambda: globalconfig.secret_api.delete(resdata["etcd_creds"]))
util.ignore_errors_pred("backuploc_name" in resdata, lambda: globalconfig.backuploc_api.delete(resdata["backuploc_name"]))
util.ignore_errors_pred("pvc_name" in resdata, lambda: globalconfig.pvc_api.delete(resdata["pvc_name"]))
Expand Down Expand Up @@ -107,7 +110,7 @@ def test_creating_backuplocation(globalconfig, resources):
def do_backup(globalconfig, resources, backup_name, backup_spec):
print("creating backup: {}".format(backup_name))
globalconfig.mbp_api.create(backup_name, backup_spec)
resources["backup_name"] = backup_name
resources["backup_names"].append(backup_name)

# Wait for cronjob to appear
label_selector='kubedr.type=backup,kubedr.backup-policy={}'.format(backup_name)
Expand Down

0 comments on commit db89bb7

Please sign in to comment.