#!/usr/bin/env bash
set -euo pipefail

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
SCRIPTS=(
  "01_up_master.sh"
  "02_verify_ready_and_nodes_json.sh"
  "03_register_via_curl.sh"
  "04_reregister_and_error_cases.sh"
  "05_status_report_via_curl.sh"
  "06_config_update_and_nodes_json.sh"
  "07_stats_single_node.sh"
  "08_multi_node_stats.sh"
  "09_restart_persistence.sh"
  "10_down.sh"
)

for script in "${SCRIPTS[@]}"; do
  echo "[TEST] Running $script"
  MASTER_IMAGE_TAG="${MASTER_IMAGE_TAG:-argus-master:latest}" "$SCRIPT_DIR/$script"
  echo "[TEST] $script completed"
  echo
done

echo "[TEST] Master module E2E tests completed"
