#!/bin/bash # E2E Test: Namespace Reconciliation # Tests new namespace reconciliation features including CREATE/UPDATE events and orphaned mirror cleanup SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" source "$SCRIPT_DIR/common.sh" TEST_NAME="Namespace Reconciliation" log_info "Starting $TEST_NAME tests" # Cleanup function for this test cleanup() { log_info "Cleaning up test resources" cleanup_resource secret test-ns-recon-pattern-secret default cleanup_resource secret test-ns-recon-all-secret default cleanup_resource secret test-orphan-cleanup-secret default cleanup_resource configmap test-label-change-cm default cleanup_namespace e2e-recon-app-1 cleanup_namespace e2e-recon-app-2 cleanup_namespace e2e-recon-app-3 cleanup_namespace e2e-recon-new cleanup_namespace e2e-label-test cleanup_namespace e2e-no-label cleanup_namespace e2e-orphan-1 cleanup_namespace e2e-orphan-2 cleanup_namespace e2e-orphan-3 sleep 5 } # Trap cleanup on exit trap cleanup EXIT # Clean up any existing resources cleanup # Wait for cleanup to complete sleep 3 # Test 1: Create source with pattern, then create matching namespace log_info "Test 1: Create namespace matching existing pattern" # Create initial namespaces kubectl create namespace e2e-recon-app-1 kubectl create namespace e2e-recon-app-2 # Create secret with pattern cat <