Skip to content

Commit 927e3b7

Browse files
committed
test(demo): add compose status inspector
1 parent 600e212 commit 927e3b7

6 files changed

Lines changed: 53 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ All notable changes to StreamHive are documented here. This project follows [Sem
77
### Added
88

99
- **Ops**: `/peers` JSON endpoint for inspecting active peer addresses and connection direction.
10+
- **Demo**: `make demo-status` prints each Compose node's peers, metrics, and durable keys.
1011

1112
## [0.5.0] — 2026-07-01
1213

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: build run test test-race vet cover lint demo-replication demo-compose demo-repair ci help
1+
.PHONY: build run test test-race vet cover lint demo-replication demo-compose demo-repair demo-status ci help
22

33
build:
44
@mkdir -p bin
@@ -32,7 +32,10 @@ demo-compose:
3232
demo-repair:
3333
@./scripts/demo-repair.sh
3434

35+
demo-status:
36+
@./scripts/demo-status.sh
37+
3538
ci: vet test-race lint
3639

3740
help:
38-
@echo "Targets: build run test test-race vet cover lint demo-replication demo-compose demo-repair ci"
41+
@echo "Targets: build run test test-race vet cover lint demo-replication demo-compose demo-repair demo-status ci"

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ For a 3-node Docker Compose demo with durable stores and node restart rehydratio
6464
make demo-compose
6565
```
6666

67+
To inspect a running Compose cluster:
68+
69+
```bash
70+
make demo-status
71+
```
72+
6773
For a 3-node corruption repair demo that deletes node3's durable blob and waits for periodic anti-entropy to restore it:
6874

6975
```bash

docs/DEPLOYMENT.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ make demo-compose
2626

2727
The demo builds `streamhive:local`, starts node1, seeds one blob, starts node2 and node3, verifies node3 receives the blob, wipes node3's local demo data, restarts node3, and verifies startup anti-entropy rehydrates the blob again.
2828

29+
Inspect a running Compose cluster:
30+
31+
```bash
32+
make demo-status
33+
```
34+
35+
The status command prints each node's `/peers`, `/metrics`, and durable store keys.
36+
2937
Run the corruption repair demo:
3038

3139
```bash

scripts/demo-compose.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,3 +80,4 @@ echo "3-node compose demo passed: node3 rehydrated the blob after restart"
8080
echo "rehydrated key: $EXPECTED_KEY"
8181
curl -fsS http://127.0.0.1:18083/metrics
8282
echo
83+
"$ROOT_DIR/scripts/demo-status.sh"

scripts/demo-status.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/usr/bin/env sh
2+
set -eu
3+
4+
ROOT_DIR="$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)"
5+
DATA_DIR="${STREAMHIVE_DATA_DIR:-$ROOT_DIR/.streamhive-compose}"
6+
COMPOSE="docker compose"
7+
export STREAMHIVE_DATA_DIR="$DATA_DIR"
8+
9+
print_node() {
10+
name="$1"
11+
url="$2"
12+
13+
echo "== $name =="
14+
echo "-- peers --"
15+
curl -fsS "$url/peers"
16+
echo
17+
echo "-- metrics --"
18+
curl -fsS "$url/metrics"
19+
echo
20+
echo "-- durable keys --"
21+
keys="$($COMPOSE -f "$ROOT_DIR/docker-compose.yml" --profile tools run --rm --no-deps -v "$DATA_DIR/$name:/data" seed -store-dir /data -list-keys)"
22+
if [ -n "$keys" ]; then
23+
printf '%s\n' "$keys" | sed 's/^/ /'
24+
else
25+
echo " (none)"
26+
fi
27+
echo
28+
}
29+
30+
print_node node1 http://127.0.0.1:18081
31+
print_node node2 http://127.0.0.1:18082
32+
print_node node3 http://127.0.0.1:18083

0 commit comments

Comments
 (0)