Add user delete process 2

This commit is contained in:
Urtzi Alfaro
2025-10-31 18:57:58 +01:00
parent 269d3b5032
commit f44d235c6d
15 changed files with 166 additions and 145 deletions

View File

@@ -14,7 +14,14 @@ NC='\033[0m'
# Configuration
TENANT_ID="${1:-dbc2128a-7539-470c-94b9-c1e37031bd77}"
SERVICE_TOKEN="${SERVICE_TOKEN}"
# Generate or use provided SERVICE_TOKEN
if [ -z "${SERVICE_TOKEN}" ]; then
SERVICE_TOKEN=$(python3 scripts/generate_service_token.py tenant-deletion-orchestrator 2>&1 | grep -A1 "Token:" | tail -1 | sed 's/^[[:space:]]*//' | tr -d '\n')
else
# Clean the token if provided (remove whitespace and newlines)
SERVICE_TOKEN=$(echo "${SERVICE_TOKEN}" | tr -d '[:space:]')
fi
# Results
TOTAL_SERVICES=12
@@ -44,6 +51,7 @@ print_info() {
test_service() {
local service_name=$1
local endpoint_path=$2
local port=${3:-8000} # Default to 8000 if not specified
echo ""
echo -e "${BLUE}Testing ${service_name}...${NC}"
@@ -62,7 +70,7 @@ test_service() {
# Execute request
local result=$(kubectl exec -n bakery-ia "$pod" -- curl -s -w "\nHTTP_CODE:%{http_code}" \
-H "Authorization: Bearer ${SERVICE_TOKEN}" \
"http://localhost:8000${endpoint_path}/tenant/${TENANT_ID}/deletion-preview" 2>&1)
"http://localhost:${port}${endpoint_path}/tenant/${TENANT_ID}/deletion-preview" 2>&1)
local http_code=$(echo "$result" | grep "HTTP_CODE" | cut -d':' -f2)
local body=$(echo "$result" | sed '/HTTP_CODE/d')
@@ -114,11 +122,11 @@ test_service "sales-service" "/api/v1/sales"
test_service "production-service" "/api/v1/production"
test_service "suppliers-service" "/api/v1/suppliers"
test_service "pos-service" "/api/v1/pos"
test_service "city-service" "/api/v1/nominatim"
test_service "external-service" "/api/v1/external"
test_service "forecasting-service" "/api/v1/forecasting"
test_service "training-service" "/api/v1/training"
test_service "alert-processor-service" "/api/v1/analytics"
test_service "notification-service" "/api/v1/notifications"
test_service "alert-processor-api" "/api/v1/alerts" 8010
test_service "notification-service" "/api/v1/notification"
# Summary
echo ""