-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathrun-e2e.sh
More file actions
executable file
·131 lines (109 loc) · 3.62 KB
/
run-e2e.sh
File metadata and controls
executable file
·131 lines (109 loc) · 3.62 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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
#!/usr/bin/env bash
# Jumpstarter End-to-End Test Runner
# This script runs the e2e test suite (assumes setup-e2e.sh was run first)
#
# The tests are implemented using Go + Ginkgo. Label filters can be used to
# run specific subsets:
# --label-filter "core" - run core tests only
# --label-filter "hooks" - run hooks tests only
# --label-filter "direct-listener" - run direct-listener tests only
# --label-filter "!operator-only" - skip operator-specific tests
set -euo pipefail
# Get the directory where this script is located
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
# Get the monorepo root (parent of e2e directory)
REPO_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
# Load shared utilities
# shellcheck source=lib/common.sh
source "$SCRIPT_DIR/lib/common.sh"
# Check if setup was completed
check_setup() {
if ! load_setup_config "$REPO_ROOT"; then
log_error "Setup not complete! Please run setup-e2e.sh first:"
log_error " bash e2e/setup-e2e.sh"
log_error ""
log_error "Or in CI mode, run the full setup automatically"
return 1
fi
# Export SSL certificate paths for Python
export SSL_CERT_FILE
export REQUESTS_CA_BUNDLE
export LOGIN_ENDPOINT
if ! verify_namespace; then
log_error "Please run setup-e2e.sh again."
return 1
fi
log_info "Setup verified"
return 0
}
# Run the tests
run_tests() {
log_info "Running jumpstarter e2e tests..."
cd "$REPO_ROOT"
# Activate virtual environment
activate_venv "python/.venv" || {
log_error "Please run setup-e2e.sh first."
exit 1
}
# Use insecure GRPC for testing
export JUMPSTARTER_GRPC_INSECURE=1
log_info "Running ginkgo e2e tests..."
run_ginkgo "$SCRIPT_DIR/test" "${GINKGO_LABEL_FILTER:-}"
}
# Full setup and run (for CI or first-time use)
full_run() {
log_info "Running full setup + test cycle..."
if [ -f "$SCRIPT_DIR/setup-e2e.sh" ]; then
bash "$SCRIPT_DIR/setup-e2e.sh"
else
log_error "setup-e2e.sh not found!"
exit 1
fi
# After setup, load the configuration
if ! load_setup_config "$REPO_ROOT"; then
log_warn "Could not load setup config after running setup-e2e.sh"
fi
# Export SSL certificate paths for Python
export SSL_CERT_FILE="${SSL_CERT_FILE:-}"
export REQUESTS_CA_BUNDLE="${REQUESTS_CA_BUNDLE:-}"
run_tests
}
# Main execution
main() {
# Default namespace
export E2E_TEST_NS="${E2E_TEST_NS:-jumpstarter-lab}"
log_info "=== Jumpstarter E2E Test Runner ==="
log_info "Namespace: $E2E_TEST_NS"
log_info "Repository Root: $REPO_ROOT"
echo ""
# If --full flag is passed, always run full setup
if [[ "${1:-}" == "--full" ]]; then
full_run
# In CI mode, check if setup was already done
elif is_ci; then
if check_setup 2>/dev/null; then
log_info "Setup already complete, skipping setup and running tests..."
run_tests
else
log_info "Setup not found in CI, running full setup..."
full_run
fi
else
# Local development: require setup to be done first
if check_setup; then
run_tests
else
log_error ""
log_error "Setup is required before running tests."
log_error ""
log_error "Options:"
log_error " 1. Run setup first: bash e2e/setup-e2e.sh"
log_error " 2. Run full cycle: bash e2e/run-e2e.sh --full"
exit 1
fi
fi
echo ""
log_info "All e2e tests completed successfully!"
}
# Run main function
main "$@"