Skip to content
Snippets Groups Projects
Commit 7db3bd0e authored by Eric Cano's avatar Eric Cano Committed by Cedric CAFFY
Browse files

#252: Added pre-run cleanup in prepare_test to allow running tests back to back.

This can now be done without tearing down and re-creating the containers.
parent 593e3da5
No related branches found
No related tags found
No related merge requests found
......@@ -72,6 +72,28 @@ echo "Preparing CTA configuration for tests"
exit 1
fi
kubectl --namespace ${NAMESPACE} exec ctafrontend -- cta-catalogue-admin-user-create /etc/cta/cta-catalogue.conf --username ctaadmin1 -m "docker cli"
echo "Cleaning up leftovers from potential previous runs."
kubectl --namespace ${NAMESPACE} exec ctaeos -- eos rm /eos/ctaeos/cta/*
kubectl --namespace ${NAMESPACE} exec ctacli -- cta-admin --json tape ls --all | \
jq -r '.[] | .vid ' | xargs -I{} kubectl --namespace ${NAMESPACE} exec ctacli -- \
cta-admin tape rm -v {}
kubectl --namespace ${NAMESPACE} exec ctacli -- cta-admin --json archiveroute ls | \
jq '.[] | "-i " + .instance + " -s " + .storageClass + " -c " + (.copyNumber|tostring)' | \
xargs -I{} bash -c "kubectl --namespace ${NAMESPACE} exec ctacli -- cta-admin archiveroute rm {}"
kubectl --namespace ${NAMESPACE} exec ctacli -- cta-admin --json tapepool ls | \
jq -r '.[] | .name' | \
xargs -I{} kubectl --namespace ${NAMESPACE} exec ctacli -- cta-admin tapepool rm -n {}
kubectl --namespace ${NAMESPACE} exec ctacli -- cta-admin --json storageclass ls | \
jq -r '.[] | "-i " + .diskInstance + " -n " + .name' | \
xargs -I{} bash -c "kubectl --namespace ${NAMESPACE} exec ctacli -- cta-admin storageclass rm {}"
for ((i=0; i<${#TAPEDRIVES_IN_USE[@]}; i++)); do
kubectl --namespace ${NAMESPACE} exec ctacli -- cta-admin logicallibrary add \
--name ${TAPEDRIVES_IN_USE[${i}]} \
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment