forked from AnkanMisra/MicroAI-Paygate
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_e2e.sh
More file actions
executable file
·44 lines (37 loc) · 1.23 KB
/
Copy pathrun_e2e.sh
File metadata and controls
executable file
·44 lines (37 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
# Get the directory where the script is located
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
# Function to cleanup background processes on exit
cleanup() {
echo "Stopping services..."
# Use a portable check for jobs since xargs -r is not available on all macOS versions
if [ -n "$(jobs -p)" ]; then
jobs -p | xargs kill 2>/dev/null
fi
exit
}
trap cleanup EXIT
echo "Building Verifier..."
cd "$SCRIPT_DIR/verifier" && cargo build --quiet
if [ $? -ne 0 ]; then
echo "Verifier build failed"
exit 1
fi
echo "Starting Verifier..."
cargo run --quiet &
VERIFIER_PID=$!
echo "Starting Gateway..."
cd "$SCRIPT_DIR/gateway"
export RECEIPT_STORE="${RECEIPT_STORE:-memory}"
export CACHE_ENABLED="${CACHE_ENABLED:-false}"
# The gateway now requires VERIFIER_URL at startup; point it at the verifier
# we just spawned on localhost above. Honors any caller-supplied override.
export VERIFIER_URL="${VERIFIER_URL:-http://127.0.0.1:3002}"
go run . &
GATEWAY_PID=$!
# Wait for services to be ready
echo "Waiting for services to initialize (10s)..."
sleep 10
echo "Running E2E Tests..."
cd "$SCRIPT_DIR" || { echo "Error: Failed to change directory to $SCRIPT_DIR"; exit 1; }
bun test tests/e2e.test.ts