UXInteract / task_039 /tests /validate_enhanced_cases.sh
DojiSum's picture
Publish the current 141-task UXInteract release
ef987bb verified
Raw History Blame Contribute Delete
1.77 kB
#!/usr/bin/env bash
set -euo pipefail
TEST_DIR="$(cd "$(dirname "$0")" && pwd)"
TEMP_DIR="$(mktemp -d /tmp/task-060-enhanced-XXXXXX)"
cleanup() { rm -rf -- "$TEMP_DIR"; }
trap cleanup EXIT
# Preserve legitimate local packages and support assets, not only root Go files.
tar --exclude='./tests' --exclude='./logs' --exclude='./.git' -cf - . | tar -xf - -C "$TEMP_DIR"
cp "$TEST_DIR/enhanced_cases_test.go.fixture" "$TEMP_DIR/enhanced_cases_test.go"
cp ./sensitive_words.txt "$TEMP_DIR/sensitive_words.txt"
test -f "$TEMP_DIR/go.mod"
export GOPROXY=off
export GOSUMDB=off
# Reuse Go's container-local compilation cache across the five isolated test
# cases. A fresh empty cache per case can spend the 45s limit compiling stdlib.
export HARBOR_TEST_SEED=60001
command -v timeout >/dev/null 2>&1
case "${1:-}" in
'') test_names=(TestEnhancedDistinctWordsAcrossAllContentTypes TestEnhancedRepeatedConfigurationReplacement TestEnhancedAuditTrailForMultipleAttempts TestEnhancedFileConfigAndSubmission TestEnhancedInvalidTypeAndDefensiveCopies) ;;
ENHANCED_CASE_1) test_names=(TestEnhancedDistinctWordsAcrossAllContentTypes) ;;
ENHANCED_CASE_2) test_names=(TestEnhancedRepeatedConfigurationReplacement) ;;
ENHANCED_CASE_3) test_names=(TestEnhancedAuditTrailForMultipleAttempts) ;;
ENHANCED_CASE_4) test_names=(TestEnhancedFileConfigAndSubmission) ;;
ENHANCED_CASE_5) test_names=(TestEnhancedInvalidTypeAndDefensiveCopies TestEnhancedWordOwnershipAndEmptyReplacement) ;;
*) echo "unknown enhanced case: $1" >&2; exit 2 ;;
esac
for test_name in "${test_names[@]}"; do
(cd "$TEMP_DIR" && timeout --signal=TERM --kill-after=5s 45s go test -count=1 -run "^${test_name}$" ./...)
done
echo "task 60 enhanced cases passed (${#test_names[@]}/${#test_names[@]})"