init app of test arena

This commit is contained in:
2025-11-24 02:14:25 +01:00
parent d778206940
commit 4df7501aba
41 changed files with 5542 additions and 0 deletions

View File

@@ -0,0 +1,8 @@
#!/bin/bash
# Mock script to return scenarios
# Usage: ./get_scenarios.sh <branch_name>
BRANCH=$1
# Mock output
echo '["scenario_login", "scenario_payment", "scenario_profile", "scenario_logout"]'

View File

@@ -0,0 +1,56 @@
#!/bin/bash
# Mock script to run tests
# Usage: ./run_tests.sh <branch> <scenarios_json> <env> <mode> <job_id>
BRANCH=$1
SCENARIOS=$2
ENV=$3
MODE=$4
JOB_ID=$5
echo "Starting job $JOB_ID on branch $BRANCH with env $ENV and mode $MODE"
# Simulate work
sleep 5
# Create results directory if not exists (mapped volume)
# If running locally without docker mapping, this might fail if /results doesn't exist.
# We should use a relative path for safety if not in docker, but the requirement says Docker.
# We'll assume /results is mounted.
RESULTS_DIR="/results/$JOB_ID"
# Fallback for local testing if /results is not writable
if [ ! -d "/results" ]; then
RESULTS_DIR="./results/$JOB_ID"
fi
mkdir -p $RESULTS_DIR
# Generate HTML report
cat <<EOF > $RESULTS_DIR/index.html
<!DOCTYPE html>
<html>
<head>
<title>Test Results - Job $JOB_ID</title>
<style>body { font-family: sans-serif; padding: 20px; } .pass { color: green; } .fail { color: red; }</style>
</head>
<body>
<h1>Test Results for Job $JOB_ID</h1>
<p>Branch: $BRANCH</p>
<p>Environment: $ENV</p>
<p>Mode: $MODE</p>
<hr>
<h2>Scenarios</h2>
<ul>
<li class="pass">scenario_login: PASSED</li>
<li class="pass">scenario_payment: PASSED</li>
<li class="pass">scenario_profile: PASSED</li>
<li class="pass">scenario_logout: PASSED</li>
</ul>
<p><strong>Overall Status: PASSED</strong></p>
</body>
</html>
EOF
echo "Job $JOB_ID completed."
exit 0