Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions e2e-tests/functions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[shfmt] reported by reviewdog 🐶

local check_type=$1 # add | delete
local component=$2 # instance | pgbouncer | repohost
local vars=("${@:3}") # everything after the 2nd argument
case "$component" in
instance)
POD=$(kubectl get -n "${NAMESPACE}" pod -l postgres-operator.crunchydata.com/instance-set=instance1 -o 'jsonpath={.items[0].metadata.name}')
CONTAINER=""
;;
pgbouncer)
POD=$(kubectl get -n "${NAMESPACE}" pod -l postgres-operator.crunchydata.com/role=pgbouncer -o 'jsonpath={.items[0].metadata.name}')
CONTAINER="pgbouncer"
;;
repohost)
POD=$(kubectl get -n "${NAMESPACE}" pod -l postgres-operator.crunchydata.com/data=pgbackrest -o 'jsonpath={.items[0].metadata.name}')
CONTAINER="pgbackrest"
;;
*)
echo "ERROR: unknown component '$component'"
return 1
;;
esac
echo "Fetching environment variables for $component pod $POD..."
local env_content
env_content=$(get_envs_from_pod "${NAMESPACE}" "$POD" "$CONTAINER")
local errors=0
for var_entry in "${vars[@]}"; do
if [[ "$check_type" == "add" ]]; then
local var_name="${var_entry%%=*}"
local var_expected="${var_entry#*=}"
check_env_in_pod add "$POD" "$var_name" "$var_expected" "$env_content" || errors=$((errors+1))
else
check_env_in_pod delete "$POD" "$var_entry" "" "$env_content" || errors=$((errors+1))
fi
done
if (( errors > 0 )); then
echo "$errors environment check(s) failed for component '$component'"
return 1
else
echo "All environment checks passed for component '$component'"
fi

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash

# tis is check for test check
# set root repo relatively to a test dir
ROOT_REPO=${ROOT_REPO:-$(realpath ../../..)}
CERT_MANAGER_VER="1.19.1"
Expand Down Expand Up @@ -1256,4 +1256,4 @@ check_envs_for_component() {
else
echo "All environment checks passed for component '$component'"
fi
}
}
Loading