diff --git a/testing/deploy-tenant-upgrade.sh b/testing/deploy-tenant-upgrade.sh index 9f0ad22ecfe..90072e076bf 100755 --- a/testing/deploy-tenant-upgrade.sh +++ b/testing/deploy-tenant-upgrade.sh @@ -28,11 +28,11 @@ tenant="storage-lite" bucket="data" dummy="dummy.data" localport="9000" -totalwait=0 alias="minios3" -# Preparing tenant for bucket manipulation -function bootstrap_tenant() { +# Port forward +function port_forward() { + totalwait=0 echo 'Validating tenant pods are ready to serve' for pod in `kubectl --namespace $namespace --selector=v1.min.io/tenant=$tenant get pod -o json | jq '.items[] | select(.metadata.name|contains("'$tenant'"))| .metadata.name' | sed 's/"//g'`; do while true; do @@ -61,6 +61,15 @@ function bootstrap_tenant() { echo "Establishing port-forward" kubectl port-forward service/$tenant-hl -n $namespace $localport:$localport & + echo 'start - wait for port-forward to be completed' + sleep 15 + echo 'end - wait for port-forward to be completed' +} + +# Preparing tenant for bucket manipulation +function bootstrap_tenant() { + port_forward + # Obtain root credentials TENANT_CONFIG_SECRET=$(kubectl -n $namespace get tenants $tenant -o jsonpath="{.spec.configuration.name}") USER=$(kubectl -n $namespace get secrets "$TENANT_CONFIG_SECRET" -o go-template='{{index .data "config.env"|base64decode }}' | grep 'export MINIO_ROOT_USER="' | sed -e 's/export MINIO_ROOT_USER="//g' | sed -e 's/"//g') @@ -75,6 +84,8 @@ function bootstrap_tenant() { # Upload dummy data to tenant bucket function upload_dummy_data() { + port_forward + echo "Uploading dummy data to tenant bucket" cp ${SCRIPT_DIR}/deploy-tenant-upgrade.sh ${SCRIPT_DIR}/$dummy mc cp ${SCRIPT_DIR}/$dummy $alias/$bucket/$dummy --insecure @@ -82,10 +93,12 @@ function upload_dummy_data() { # Download dummy data from tenant bucket function download_dummy_data() { + port_forward + echo "Download dummy data from tenant bucket" mc cp $alias/$bucket/$dummy ${SCRIPT_DIR}/$dummy --insecure - if cmp -s "${SCRIPT_DIR}/deploy-tenant-upgrade.sh" "${SCRIPT_DIR}/$dummy"; then + if cmp "${SCRIPT_DIR}/deploy-tenant-upgrade.sh" "${SCRIPT_DIR}/$dummy"; then echo "Operator upgrade test complete; no issue found" else echo "Operator upgrade test failed"