You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 6b10411
Browse filesBrowse the repository at this point in the historyBrowse files
chore(devex): streamline local OpenSearch and Postgres test workflows (#10034)
## Summary
Follow-up to #9838 to make the local dev and test workflow for
OpenSearch (and PostgreSQL-backed tests) smooth out of the box while
keeping OpenSearch opt-in by default for `just relay` / `just dev` /
`just setup`.
### What changed
- **Fix Docker Compose `--profile '*'` handling (`Justfile`,
`scripts/dev-reset.sh`):**
- `just down`, `just ps`, and `just logs` now pass `--profile '*'` so
`buzz-opensearch` is actually stopped, listed, and tailable.
- `scripts/dev-reset.sh` passes `--profile '*'` to `docker compose down
-v --remove-orphans` so `buzz-opensearch-data` is wiped alongside
Postgres instead of leaving stale indexed docs behind.
- **One-command local OpenSearch dev flow (`Justfile`,
`scripts/dev-setup.sh`):**
- Added `search := ""` toggle (`just search=1 relay`, `just search=1
relay-release`, `just search=1 relay-web`, `just search=1 dev`, `just
search=1 setup`) that auto-starts `buzz-opensearch`, waits for health
(dumping container logs on timeout), and defaults
`BUZZ_OPENSEARCH_URL=http://localhost:9200` +
`BUZZ_OPENSEARCH_PREVIEW=true`.
- `_ensure-services` also auto-starts `buzz-opensearch` when
`BUZZ_OPENSEARCH_URL` (from env or `.env`) points to
`http://localhost:9200` or `http://127.0.0.1:9200`.
- Preserved caller-supplied `BUZZ_OPENSEARCH_URL` /
`BUZZ_OPENSEARCH_PREVIEW` overrides across `source .env`.
- **One-command search & Postgres test runners (`Justfile`,
`scripts/postgres-test-*.sh`, `crates/buzz-search/tests/`):**
- Added `just test-postgres [*ARGS]` (auto-starts Docker services
including local OpenSearch when `BUZZ_TEST_OPENSEARCH_URL` targets
`localhost:9200` / `127.0.0.1:9200`, matching the CI PostgreSQL lane,
and sets local DB/OpenSearch env defaults), `just test-search [*ARGS]`
(delegates to `just test-postgres -p buzz-search --tests`), and routed
`just test-media-access` through `test-postgres`.
- Added Homebrew keg-only `libpq` / `postgresql@17` lookup in
`scripts/postgres-test-{run,setup,wrapper}.sh` and clearer errors when
`BUZZ_POSTGRES_ADMIN_URL` or `cargo-nextest` is missing.
- Improved OpenSearch test panic messages in `buzz-search` to include
the target URL and `just test-search` hint.
- **Docs (`docs/opensearch-search-deployment.md`, `CONTRIBUTING.md`,
`TESTING.md`, `AGENTS.md`):**
- Documented `just search=1 relay`/`dev`, `just test-search`, and `just
test-postgres`.
## Testing
### Live Docker runs (macOS, head `cf91cb1653`)
- `just ps`: listed `buzz-opensearch` (`Up ... (healthy)
127.0.0.1:9200->9200/tcp`) alongside Postgres, Redis, MinIO, Adminer,
Keycloak, Prometheus.
- `just logs --tail 3 opensearch`: tailed `buzz-opensearch` logs.
- `just down`: stopped and removed `buzz-opensearch` along with all
other services (`docker ps --filter name=buzz-opensearch` returned
empty).
- `just search=1 _ensure-services`: brought up the default services,
waited for Postgres/Redis healthy, then created/started
`buzz-opensearch` and waited until healthy (`Waiting for OpenSearch....
ready`).
- `docker compose --profile '*' config --volumes`: confirmed
`opensearch-data` is included for `scripts/dev-reset.sh`'s `down -v`.
- `just test-search -E 'binary(postgres_opensearch_search) &
test(search_finds_event_in_same_community)'`: passed (`1 passed, 38
skipped` in `1.509s`) with zero manual env vars.
- `just test-postgres -p buzz-relay --lib -E
'test(the_flag_picks_the_backend_for_the_whole_relay_while_it_runs)'`:
passed (`1 passed, 2604 skipped` in `1.891s`) with zero manual env vars.
- `just search=1 relay` (against a disposable DB on non-colliding
ports): booted cleanly, `/health` returned `ok`, relay logged `search
outbox enabled`, `Search service ready (opensearch: true)`, and `search
indexer started`, and `http://localhost:9200/_alias/buzz-messages`
resolved to `buzz-messages-v2`.
### Static & unit checks
- `bash -n` on all modified shell scripts
- `scripts/test-postgres-test-wrapper.sh` and
`scripts/test-postgres-test-discovery.sh`
- `cargo fmt -p buzz-search -- --check`, `cargo test -p buzz-search
--lib`, `cargo check -p buzz-search --tests`, and `cargo clippy -p
buzz-search --tests -- -D warnings`
- `just file-size-check` and `scripts/check-branch-skew.sh`
---------
Signed-off-by: Salman Mohammed <smohammed@squareup.com>
Co-authored-by: gems <fd3f5b81c5a75b0b7b88ab01493114227182cc60e16422921001d458d2a64236@buzz.block.builderlab.xyz>
0 commit comments