diff --git a/scripts/acceptance/local-cluster.sh b/scripts/acceptance/local-cluster.sh index ac22726..a28fc60 100755 --- a/scripts/acceptance/local-cluster.sh +++ b/scripts/acceptance/local-cluster.sh @@ -263,13 +263,14 @@ mark_local_database() { local primary primary=$(kubectl --context "$context" -n "$namespace" get cluster easyai-postgres \ -o 'jsonpath={.status.currentPrimary}') - kubectl --context "$context" -n "$namespace" exec "$primary" -c postgres -- \ - psql -X -v ON_ERROR_STOP=1 -U postgres -d easyai_ai_gateway \ - -v cluster_id="$LOCAL_CLUSTER_ID" -c \ - "INSERT INTO system_settings(setting_key,value) - VALUES('acceptance_local_cluster_id',jsonb_build_object('clusterId', :'cluster_id')) - ON CONFLICT(setting_key) DO UPDATE SET value=excluded.value,updated_at=now();" \ - >/dev/null + [[ $LOCAL_CLUSTER_ID =~ ^easyai-local-[0-9a-f]{24}$ ]] + printf '%s\n' \ + "INSERT INTO system_settings(setting_key,value) + VALUES('acceptance_local_cluster_id',jsonb_build_object('clusterId', :'cluster_id')) + ON CONFLICT(setting_key) DO UPDATE SET value=excluded.value,updated_at=now();" | + kubectl --context "$context" -n "$namespace" exec -i "$primary" -c postgres -- \ + psql -X -v ON_ERROR_STOP=1 -U postgres -d easyai_ai_gateway \ + -v cluster_id="$LOCAL_CLUSTER_ID" >/dev/null } import_snapshot() {