···40 let (state, backfill_rx, buffer_rx) = AppState::new(&cfg)?;
41 let state = Arc::new(state);
4243- tokio::spawn({
44- let port = cfg.api_port;
45- let state = state.clone();
46- async move {
47- if let Err(e) = api::serve(state, port).await {
48- error!("API server failed: {e}");
49- }
50- }
51- });
05253 tokio::spawn({
54 let state = state.clone();
···40 let (state, backfill_rx, buffer_rx) = AppState::new(&cfg)?;
41 let state = Arc::new(state);
4243+ tokio::spawn(
44+ api::serve(state.clone(), cfg.api_port).inspect_err(|e| error!("API server failed: {e}")),
45+ );
46+47+ if cfg.enable_debug {
48+ tokio::spawn(
49+ api::serve_debug(state.clone(), cfg.debug_port)
50+ .inspect_err(|e| error!("debug server failed: {e}")),
51+ );
52+ }
5354 tokio::spawn({
55 let state = state.clone();
+2
tests/common.nu
···15 HYDRANT_DATABASE_PATH: ($db_path),
16 HYDRANT_FULL_NETWORK: "false",
17 HYDRANT_API_PORT: ($port | into string),
0018 HYDRANT_LOG_LEVEL: "debug"
19 } {
20 sh -c $"($binary) >($log_file) 2>&1 & echo $!" | str trim | into int
···15 HYDRANT_DATABASE_PATH: ($db_path),
16 HYDRANT_FULL_NETWORK: "false",
17 HYDRANT_API_PORT: ($port | into string),
18+ HYDRANT_ENABLE_DEBUG: "true",
19+ HYDRANT_DEBUG_PORT: ($port + 1 | into string),
20 HYDRANT_LOG_LEVEL: "debug"
21 } {
22 sh -c $"($binary) >($log_file) 2>&1 & echo $!" | str trim | into int
+4-3
tests/repo_sync_integrity.nu
···55}
5657# verify countRecords API against debug endpoint
58-def check-count [hydrant_url: string, did: string] {
59 print "verifying countRecords API..."
60 let collections = [
61 "app.bsky.feed.post"
···7778 # 2. get actual scan count from debug endpoint
79 let debug_count = try {
80- (http get $"($hydrant_url)/debug/count?did=($did)&collection=($coll)").count
81 } catch {
82 print $" error calling debug count for ($coll)"
83 return false
···98 let pds = "https://zwsp.xyz"
99 let port = 3001
100 let url = $"http://localhost:($port)"
0101 let db_path = (mktemp -d -t hydrant_test.XXXXXX)
102103 print $"testing backfill integrity for ($did)..."
···116 if (wait-for-backfill $url) {
117 # Run both consistency checks
118 let integrity_passed = (check-consistency $url $pds $did)
119- let count_passed = (check-count $url $did)
120121 if $integrity_passed and $count_passed {
122 print "all integrity checks passed!"
···55}
5657# verify countRecords API against debug endpoint
58+def check-count [hydrant_url: string, debug_url: string, did: string] {
59 print "verifying countRecords API..."
60 let collections = [
61 "app.bsky.feed.post"
···7778 # 2. get actual scan count from debug endpoint
79 let debug_count = try {
80+ (http get $"($debug_url)/debug/count?did=($did)&collection=($coll)").count
81 } catch {
82 print $" error calling debug count for ($coll)"
83 return false
···98 let pds = "https://zwsp.xyz"
99 let port = 3001
100 let url = $"http://localhost:($port)"
101+ let debug_url = $"http://127.0.0.1:($port + 1)"
102 let db_path = (mktemp -d -t hydrant_test.XXXXXX)
103104 print $"testing backfill integrity for ($did)..."
···117 if (wait-for-backfill $url) {
118 # Run both consistency checks
119 let integrity_passed = (check-consistency $url $pds $did)
120+ let count_passed = (check-count $url $debug_url $did)
121122 if $integrity_passed and $count_passed {
123 print "all integrity checks passed!"