Skip to content

Commit

Permalink
Upgrade operator test (#2)
Browse files Browse the repository at this point in the history
Test operator upgrade from version x to version y
  • Loading branch information
allanrogerr authored Dec 13, 2022
1 parent 24e0dfe commit cec3a12
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions testing/deploy-tenant-upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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')
Expand All @@ -75,17 +84,21 @@ 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
}

# 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"
Expand Down

0 comments on commit cec3a12

Please sign in to comment.