Skip to content

Commit

Permalink
🔨 Introduce hack scripts relevant to BDD tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MarianMacik committed Sep 26, 2023
1 parent 081c4ab commit f0c12cb
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 0 deletions.
Empty file modified hack/clean-cluster-operators.sh
100644 → 100755
Empty file.
Empty file modified hack/clean-crds.sh
100644 → 100755
Empty file.
Empty file modified hack/clean-stuck-namespaces.sh
100644 → 100755
Empty file.
56 changes: 56 additions & 0 deletions hack/env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,3 +38,59 @@ getCsvFile() {
getBundleCsvFile() {
echo "${BUNDLE_DIR}/sonataflow-operator.clusterserviceversion.yaml"
}

DEPENDENT_CRDS_KEYS=(grafana hyperfoil infinispan kafka keycloak mongodb) # This list may need a revision
DEPENDENT_SENSITIVE_CRDS_KEYS=(prometheus)

getAllDependentCrds() {
for crdKey in ${DEPENDENT_CRDS_KEYS[*]}
do
for crd in $(getDependentCrds ${crdKey})
do
echo "$crd"
done
done

if [ "$1" = "all" ]
then
for crdKey in ${DEPENDENT_SENSITIVE_CRDS_KEYS[*]}
do
for crd in $(getDependentCrds ${crdKey})
do
echo "$crd"
done
done
fi
}

getDependentCrds() {
oc get crds | grep $1 | awk -F' ' '{print $1}'
}

# get_and_clean_cluster_resources namespace resourceName
get_and_clean_resources() {
clean_resources $1 $2 "$(oc get $2 -n $1 | grep -v NAME | awk '{print $1}')"
}

# clean_cluster_resources namespace resourceName {list of resources}
clean_resources() {
for resourceName in $3
do
echo "Delete $2 ${resourceName} in namespace $1"
oc delete $2 ${resourceName} -n $1
done
}

# get_and_clean_cluster_resources resourceName
get_and_clean_cluster_resources() {
clean_cluster_resources $1 "$(oc get $1 | grep -v NAME | awk '{print $1}')"
}

# clean_cluster_resources resourceName {list of resources}
clean_cluster_resources() {
for resourceName in $2
do
echo "Delete cluster $1 ${resourceName}"
oc delete $1 ${resourceName} --timeout=30s
done
}
Empty file modified hack/run-tests.sh
100644 → 100755
Empty file.

0 comments on commit f0c12cb

Please sign in to comment.