-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathe2e.sh
More file actions
executable file
·229 lines (194 loc) · 7.73 KB
/
Copy pathe2e.sh
File metadata and controls
executable file
·229 lines (194 loc) · 7.73 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
#!/usr/bin/env bash
# Manual end-to-end test runner for ASAPQuery-backend.
#
# The default "all" target stays local to this repository. "system" is an
# explicit opt-in because it delegates to ASAPCollector's multi-node harness
# and may build images, start containers, and use SSH.
set -Eeuo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
REPO_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
TARGET="${1:-all}"
CURRENT_STAGE="startup"
STARTED_AT="$(date +%s)"
export CARGO_TARGET_DIR="${ASAP_E2E_CARGO_TARGET_DIR:-${REPO_DIR}/target/e2e}"
export GOCACHE="${ASAP_E2E_GO_CACHE:-${REPO_DIR}/target/e2e-go-cache}"
export CARGO_INCREMENTAL="${ASAP_E2E_CARGO_INCREMENTAL:-0}"
usage() {
cat <<'EOF'
Usage: ./scripts/e2e.sh [target]
Targets:
all Run every local component suite, then the repository E2E
contracts Shared Rust type/protobuf wire contracts
control-plane Planner HTTP, OpAMP, publication, and runtime feedback
data-plane Query, routing, storage, ingest adapter, and lifecycle tests
asapquery Collector-free Remote Write -> QueryPlan process conformance
asapquery-demo Run the real Prometheus compatibility demo (requires Docker)
differential Production DDSketch PromQL vs deterministic raw-value oracle
sketch-oracles Every sketch via production binary + independent raw oracle
monitor Real monitor gRPC transport tests
whole Controller plan -> backend install -> OTLP -> store -> PromQL
whole-matrix All sketch families and query shapes (diagnostic)
differential-all Production sketch oracles plus the in-process query matrix
system Delegate to ASAPCollector's real multi-node system harness
list Print the suites and audit Rust E2E ignore markers
Useful environment variables:
ASAP_COLLECTOR_DIR Sibling ASAPCollector checkout (system target)
ASAP_E2E_CARGO_TARGET_DIR Rust build directory
ASAP_E2E_GO_CACHE Go build cache directory
ASAP_E2E_CARGO_INCREMENTAL Set to 1 to retain Rust incremental artifacts
ASAP_E2E_NOCAPTURE=1 Pass --nocapture to Rust test binaries
EOF
}
say() {
printf '\n==> %s\n' "$*"
}
die() {
printf '\nERROR [%s]: %s\n' "${CURRENT_STAGE}" "$*" >&2
exit 1
}
on_error() {
local code=$?
printf '\nFAILED [%s] (exit %s)\n' "${CURRENT_STAGE}" "${code}" >&2
exit "${code}"
}
trap on_error ERR
need() {
command -v "$1" >/dev/null 2>&1 || die "required command not found: $1"
}
rust_test() {
local package=$1
shift
local test_args=(--test-threads=1)
if [[ "${ASAP_E2E_NOCAPTURE:-0}" == "1" ]]; then
test_args+=(--nocapture)
fi
cargo test --locked -p "${package}" "$@" -- "${test_args[@]}"
}
contracts() {
CURRENT_STAGE="contracts/asap_types"
say "contracts: shared policy and routing types"
rust_test asap_types
CURRENT_STAGE="contracts/asap_otel_proto"
say "contracts: modified OTLP and monitor protobuf compatibility"
rust_test asap_otel_proto --tests
}
control_plane() {
CURRENT_STAGE="control-plane"
say "control-plane: HTTP planning, OpAMP, publication, and feedback"
rust_test control_plane
}
data_plane() {
CURRENT_STAGE="data-plane/library"
say "data-plane: HTTP query/routing, storage, lifecycle, and fallback"
rust_test data_plane --lib
CURRENT_STAGE="data-plane/edge-runtime-wire"
say "data-plane: edge runtime sketch envelope -> backend accumulator"
rust_test data_plane --test edge_runtime_consumes_precompute_rs
CURRENT_STAGE="data-plane/production-process"
say "data-plane: production binary -> modified OTLP -> SketchStore -> PromQL"
rust_test data_plane --test component_process_e2e
differential
}
asapquery() {
CURRENT_STAGE="asapquery/physical-compile"
say "asapquery: canonical workload -> backend-local atomic PhysicalPlan"
rust_test control_plane compatibility_demo_snapshot_compiles_the_complete_query_matrix
CURRENT_STAGE="asapquery/production-process"
say "asapquery: Remote Write -> precompute/store -> QueryPlan DAG -> fallback"
rust_test data_plane --test asapquery_compatibility_process_e2e
}
asapquery_demo() {
CURRENT_STAGE="asapquery/real-prometheus-demo"
say "asapquery: real Prometheus Remote Write compatibility demo"
"${REPO_DIR}/demos/asapquery/run.sh"
}
differential() {
CURRENT_STAGE="data-plane/promql-differential"
say "data-plane: production DDSketch PromQL -> raw oracle + range endpoint consistency"
rust_test data_plane --test promql_differential_process_e2e
}
sketch_oracles() {
differential
CURRENT_STAGE="data-plane/all-sketch-production-oracles"
say "data-plane: production KLL/HLL/CountSketch/CMS -> independent raw-data oracles"
rust_test data_plane --test all_sketches_process_oracle_e2e
}
monitor() {
CURRENT_STAGE="monitor-grpc"
say "monitor: real bidirectional gRPC server/client"
rust_test data_plane --test monitor_grpc
CURRENT_STAGE="monitor-production-process"
say "monitor: production coordinator process -> two edge streams -> sampling grants"
rust_test data_plane --test monitor_process_e2e
}
whole() {
CURRENT_STAGE="whole/controller-to-query"
say "whole repository: production controller -> production backend -> OTLP -> PromQL"
cargo build --locked -p control_plane --bin control_plane -p data_plane --bin data_plane
ASAP_E2E_CONTROL_PLANE_BIN="${CARGO_TARGET_DIR}/debug/control_plane" \
rust_test data_plane --test backend_process_e2e
}
whole_matrix() {
CURRENT_STAGE="whole/sketch-query-matrix"
say "whole repository diagnostic: every sketch and query scenario"
rust_test data_plane --test e2e_controller_plans_and_backend_serves
}
differential_all() {
local status=0
sketch_oracles || status=$?
whole_matrix || status=$?
return "${status}"
}
list_suites() {
usage
printf '\nRust E2E tests marked #[ignore] (expected: none):\n'
local ignored
if ignored="$(git -C "${REPO_DIR}" grep -n -E '^[[:space:]]*#[[:space:]]*\[[[:space:]]*ignore' -- '*.rs')"; then
printf '%s\n' "${ignored}"
die "ignored Rust tests found; convert them to executable E2E/unit tests or remove stale coverage"
fi
printf 'none\n'
}
system_e2e() {
CURRENT_STAGE="external-system"
need docker
local collector_dir="${ASAP_COLLECTOR_DIR:-${REPO_DIR}/../ASAPCollector}"
local runner="${collector_dir}/deploy/mvp-multinode/scripts/run_demo.sh"
[[ -f "${runner}" ]] || die "ASAPCollector system runner not found: ${runner}"
say "external system: delegating to ASAPCollector multi-node harness"
printf 'This target may build images, start remote containers, and use SSH.\n'
BACKEND="${REPO_DIR}" bash "${runner}" all
}
main() {
cd "${REPO_DIR}"
case "${TARGET}" in
all)
need cargo
need rg
contracts
control_plane
data_plane
monitor
whole
;;
contracts) need cargo; contracts ;;
control-plane) need cargo; control_plane ;;
data-plane) need cargo; data_plane ;;
asapquery) need cargo; asapquery ;;
asapquery-demo) need cargo; asapquery_demo ;;
differential) need cargo; differential ;;
sketch-oracles) need cargo; sketch_oracles ;;
monitor) need cargo; monitor ;;
whole) need cargo; whole ;;
whole-matrix) need cargo; whole_matrix ;;
differential-all) need cargo; differential_all ;;
system) system_e2e ;;
list) list_suites; exit 0 ;;
-h|--help|help) usage; exit 0 ;;
*) usage >&2; die "unknown target: ${TARGET}" ;;
esac
local elapsed=$(( $(date +%s) - STARTED_AT ))
CURRENT_STAGE="complete"
printf '\nPASS: %s E2E target completed in %ss\n' "${TARGET}" "${elapsed}"
}
main "$@"