1212# 4. Adjust test path from ./internal/services/SERVICE/... to ./internal/services/SERVICE/migration/...
1313#
1414# Environment Variables:
15- # TF_MIGRATE_BINARY_PATH: Path to tf-migrate binary (default: /Users/tjozsa/cf-repos/sdks/migration-work/agent-a/tf-migrate/bin/tf-migrate)
15+ # TF_MIGRATE_BINARY_PATH: Path to tf-migrate binary (required for migration tests)
16+ # TF_MIG_TEST: Enable migration test mode (required for migration tests, set to "1" or "true")
1617
1718# ./internal/services/account
1819# account creation can only be done by a tenant admin and the current CI does
1920# have that support.
20- # TODO: support tenant admin auth for acceptance tests
2121
2222# Product group definitions - services that need special handling
2323# Using functions instead of associative arrays for broader bash compatibility
@@ -231,7 +231,7 @@ declare -a ALL_SERVICES=(
231231 " resource=./internal/services/spectrum_application"
232232 " resource=./internal/services/sso_connector"
233233 " resource=./internal/services/tiered_cache"
234- # "resource=./internal/services/token_validation_config"
234+ " resource=./internal/services/token_validation_config"
235235 " resource=./internal/services/token_validation_rules"
236236 " resource=./internal/services/turnstile_widget"
237237 " resource=./internal/services/url_normalization_settings"
@@ -245,7 +245,7 @@ declare -a ALL_SERVICES=(
245245 " resource=./internal/services/workers_kv_namespace"
246246 " resource=./internal/services/workers_route"
247247 " resource=./internal/services/workers_script"
248- # "resource=./internal/services/workflow"
248+ " resource=./internal/services/workflow"
249249 " resource=./internal/services/zero_trust_access_application"
250250 " resource=./internal/services/zero_trust_access_custom_page"
251251 " resource=./internal/services/zero_trust_access_group"
@@ -602,6 +602,7 @@ run_tests() {
602602 if [ ! -d " $migration_dir " ]; then
603603 log " ${YELLOW} Skipping $test_name for $service (no migration directory found)${NC} " > " $log_file "
604604 log " Skipping $test_name for $service (no migration directory found)"
605+ echo " TESTS_SKIPPED" >> " $log_file " # Marker for process_service to detect skip
605606 return 0
606607 fi
607608 else
@@ -612,16 +613,20 @@ run_tests() {
612613 log " ${WHITE} Running $test_name : $test_path ${NC} " > " $log_file "
613614 log " Running $test_name : $test_path "
614615
615- # Build command with optional TF_MIGRATE_BINARY_PATH for migration tests
616- local env_prefix=" "
616+ # Validate required environment variables for migration tests
617617 if [ " $TEST_TYPE " = " migration" ]; then
618- # Set TF_MIGRATE_BINARY_PATH for migration tests
619- local tf_migrate_path=" ${TF_MIGRATE_BINARY_PATH:-/ Users/ tjozsa/ cf-repos/ sdks/ migration-work/ agent-a/ tf-migrate/ bin/ tf-migrate} "
620- env_prefix=" TF_MIGRATE_BINARY_PATH=$tf_migrate_path "
618+ if [ -z " $TF_MIGRATE_BINARY_PATH " ]; then
619+ log " ${RED} ERROR: TF_MIGRATE_BINARY_PATH environment variable must be set for migration tests${NC} "
620+ return 1
621+ fi
622+ if [ -z " $TF_MIG_TEST " ]; then
623+ log " ${RED} ERROR: TF_MIG_TEST environment variable must be set for migration tests${NC} "
624+ return 1
625+ fi
621626 fi
622627
623- # Build command with optional parallel flag
624- local test_cmd=" ${env_prefix} TF_ACC=1 go test -v -run \" $test_pattern \" -count 1 -timeout \" $TEST_TIMEOUT \" "
628+ # Build test command (all environment variables are inherited from parent process)
629+ local test_cmd=" go test -v -run \" $test_pattern \" -count 1 -timeout \" $TEST_TIMEOUT \" "
625630
626631 # Add parallel flag if specified and not 0
627632 if [ " $parallel_count " -gt 0 ]; then
@@ -712,12 +717,20 @@ process_service() {
712717 # Run tests
713718 run_tests " $service " " $parallel_count "
714719 local test_result=$?
715-
720+
716721 local end_time=$( date +%s)
717722 local total_duration=$(( end_time - start_time))
718-
723+
724+ # Check if tests were skipped by looking for the skip marker
725+ local service_name=$( basename " $service " )
726+ local tests_log=" $LOG_DIR /${service_name} -tests.log"
727+
719728 if [ $test_result -eq 0 ]; then
720- log " ${GREEN} ✓ Completed: $service (${total_duration} s total)${NC} "
729+ if [ -f " $tests_log " ] && grep -q " TESTS_SKIPPED" " $tests_log " 2> /dev/null; then
730+ log " ${YELLOW} ⏭ Skipped: $service (${total_duration} s total)${NC} "
731+ else
732+ log " ${GREEN} ✓ Completed: $service (${total_duration} s total)${NC} "
733+ fi
721734 else
722735 log " ${RED} ✗ Failed: $service (${total_duration} s total)${NC} "
723736 fi
@@ -776,7 +789,7 @@ main() {
776789 (
777790 export JOB_ID=" PROG"
778791 while sleep 30; do
779- completed=$( find " $LOG_DIR " -name " *-combined.log" -exec grep -l " ✓ Completed:\|✗ Failed:" {} \; 2> /dev/null | wc -l | tr -d ' ' )
792+ completed=$( find " $LOG_DIR " -name " *-combined.log" -exec grep -l " ✓ Completed:\|⏭ Skipped:\| ✗ Failed:" {} \; 2> /dev/null | wc -l | tr -d ' ' )
780793 total=${# SERVICES[@]}
781794 log " ${WHITE} Progress: $completed /$total services completed${NC} "
782795 done
@@ -1094,23 +1107,27 @@ main() {
10941107
10951108 # Count results
10961109 local passed=0
1110+ local skipped=0
10971111 local failed=0
10981112 local failed_list=" "
1099-
1113+
11001114 debug_log " ${WHITE} DEBUG: Starting result counting for ${# ordered_services[@]} services${NC} "
1101-
1115+
11021116 # Temporarily disable exit on error during counting
11031117 set +e
1104-
1118+
11051119 for service_config in " ${ordered_services[@]} " ; do
11061120 local service=$( parse_service_config " $service_config " " resource" )
11071121 local service_name=$( basename " $service " )
11081122 local combined_log=" $LOG_DIR /${service_name} -combined.log"
1109-
1123+
11101124 debug_log " ${WHITE} DEBUG: Checking results for $service_name ${NC} "
1111-
1125+
11121126 if [ -f " $combined_log " ]; then
1113- if grep -q " ✓ Completed:" " $combined_log " 2> /dev/null; then
1127+ if grep -q " ⏭ Skipped:" " $combined_log " 2> /dev/null; then
1128+ skipped=$(( skipped + 1 ))
1129+ debug_log " ${WHITE} DEBUG: $service_name marked as SKIPPED${NC} "
1130+ elif grep -q " ✓ Completed:" " $combined_log " 2> /dev/null; then
11141131 passed=$(( passed + 1 ))
11151132 debug_log " ${WHITE} DEBUG: $service_name marked as PASSED${NC} "
11161133 else
@@ -1124,8 +1141,8 @@ main() {
11241141 debug_log " ${WHITE} DEBUG: $service_name marked as FAILED (no log file)${NC} "
11251142 fi
11261143 done
1127-
1128- debug_log " ${WHITE} DEBUG: Result counting complete - passed=$passed , failed=$failed ${NC} "
1144+
1145+ debug_log " ${WHITE} DEBUG: Result counting complete - passed=$passed , skipped= $skipped , failed=$failed ${NC} "
11291146
11301147 # Re-enable exit on error
11311148 set -e
@@ -1151,8 +1168,9 @@ main() {
11511168 log " === EXECUTION SUMMARY ==="
11521169 log " Total execution time: ${minutes} m ${seconds} s"
11531170 log " Passed: $passed "
1171+ log " Skipped: $skipped "
11541172 log " Failed: $failed "
1155-
1173+
11561174 if [ $failed -gt 0 ]; then
11571175 echo " "
11581176 log " Failed services:"
@@ -1162,7 +1180,7 @@ main() {
11621180 echo " "
11631181 log " Check individual log files in $LOG_DIR for detailed error information"
11641182 fi
1165-
1183+
11661184 log " Summary complete"
11671185 } | cat # Using cat to force immediate output as a single block
11681186
@@ -1232,8 +1250,8 @@ if [ "$1" = "--help" ] || [ "$1" = "-h" ]; then
12321250 echo " "
12331251 echo " Environment variables:"
12341252 echo " PARALLEL_JOBS Override default parallel job count"
1235- echo " TF_MIGRATE_BINARY_PATH Path to tf-migrate binary for migration tests"
1236- echo " (default: /Users/tjozsa/cf-repos/sdks/ migration-work/agent-a/tf-migrate/bin/tf-migrate )"
1253+ echo " TF_MIGRATE_BINARY_PATH Path to tf-migrate binary (required for migration tests) "
1254+ echo " TF_MIG_TEST Enable migration test mode (required for migration tests )"
12371255 echo " "
12381256 echo " Product Groups:"
12391257 for group in $( get_available_product_groups) ; do
@@ -1261,22 +1279,16 @@ fi
12611279# Initialize defaults
12621280PRODUCT_GROUP=" default"
12631281TEST_TYPE=" acceptance"
1264- LEGACY_SYNTAX=false
12651282
12661283# Parse product group and test type
12671284if [[ $# -gt 0 && ! " $1 " =~ ^-- ]]; then
12681285 # Check if first argument is a product group
12691286 available_groups=" $( get_available_product_groups) "
1270- if [[ " $1 " == " migration" ]] || [[ " $1 " == " acceptance" ]]; then
1271- # Legacy syntax: just test type specified
1272- TEST_TYPE=" $1 "
1273- LEGACY_SYNTAX=true
1274- shift
1275- elif [[ " $1 " == " default" ]] || [[ " $available_groups " =~ " $1 " ]]; then
1276- # New syntax: product group specified
1287+ if [[ " $1 " == " default" ]] || [[ " $available_groups " =~ " $1 " ]]; then
1288+ # Product group specified
12771289 PRODUCT_GROUP=" $1 "
12781290 shift
1279-
1291+
12801292 # Check for test type as second argument
12811293 if [[ $# -gt 0 && ! " $1 " =~ ^-- ]]; then
12821294 case $1 in
@@ -1308,15 +1320,10 @@ fi
13081320while [[ $# -gt 0 ]]; do
13091321 case $1 in
13101322 --dry-run)
1311- # Filter services first for dry run using same logic as main execution
1312- if [ " $TEST_TYPE " = " migration" ] && [ " $LEGACY_SYNTAX " = " true" ]; then
1313- dry_services=(" ${ALL_SERVICES[@]} " )
1314- echo " Would run ${# dry_services[@]} services with $PARALLEL_JOBS parallel jobs (all services, migration tests)"
1315- else
1316- filter_services_by_group " $PRODUCT_GROUP "
1317- dry_services=(" ${SERVICES[@]} " )
1318- echo " Would run ${# dry_services[@]} services with $PARALLEL_JOBS parallel jobs ($PRODUCT_GROUP group, $TEST_TYPE tests)"
1319- fi
1323+ # Filter services by product group for dry run
1324+ filter_services_by_group " $PRODUCT_GROUP "
1325+ dry_services=(" ${SERVICES[@]} " )
1326+ echo " Would run ${# dry_services[@]} services with $PARALLEL_JOBS parallel jobs ($PRODUCT_GROUP group, $TEST_TYPE tests)"
13201327 for service_config in " ${dry_services[@]} " ; do
13211328 service=$( parse_service_config " $service_config " " resource" )
13221329 parallel_count=$( parse_service_config " $service_config " " parallel" )
@@ -1355,14 +1362,7 @@ if ! [[ "$PARALLEL_JOBS" =~ ^[0-9]+$ ]] || [ "$PARALLEL_JOBS" -lt 1 ]; then
13551362fi
13561363
13571364# Filter services by product group
1358- # Special case: legacy "migration" syntax should use all services for backward compatibility
1359- if [ " $TEST_TYPE " = " migration" ] && [ " $LEGACY_SYNTAX " = " true" ]; then
1360- # Legacy syntax: "./scripts/run-ci-tests migration" should run all services
1361- SERVICES=(" ${ALL_SERVICES[@]} " )
1362- else
1363- # Normal product group filtering (including explicit "default migration")
1364- filter_services_by_group " $PRODUCT_GROUP "
1365- fi
1365+ filter_services_by_group " $PRODUCT_GROUP "
13661366
13671367# Run main function
13681368main
0 commit comments