Skip to content

Commit 6c79e0b

Browse files
committed
docs: README test section now covers both integration suites
The repo grew a second integration suite (`tests/psql_integration_test.rs`, spawning the real `psql` binary) but the README's Test section was written before it landed. Updated the section to: - name the three kinds of tests explicitly (unit, tokio-postgres, psql) with what each catches - show how to run all suites at once vs. each one individually - include the `--ignored` invocation for the three binary-format- dependent extended-protocol tests, with a back-reference to the Wire-format section that explains why - mention `reuse lint` alongside the other PR gates No code change. README only.
1 parent 940ef66 commit 6c79e0b

1 file changed

Lines changed: 46 additions & 5 deletions

File tree

README.md

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -207,19 +207,60 @@ client-requested format code) and the `FieldFormat::Text` constants in
207207

208208
## Test
209209

210+
The repo has three kinds of tests, in increasing fidelity:
211+
212+
1. **Unit tests (`cargo test --lib`).** ~191 tests inline in each
213+
module. No Trino, no network, no subprocess. Run by default in CI
214+
on every commit.
215+
2. **Integration tests via `tokio-postgres`
216+
(`tests/integration_test.rs`).** ~30 tests that drive the gateway
217+
over the real PG wire protocol using the Rust `tokio-postgres`
218+
client. Each test spawns the gateway in-process on a random
219+
port and connects to it. Tests that need a real Trino
220+
automatically skip when `TRINO_HOST` is unset.
221+
3. **Integration tests via real `psql` (`tests/psql_integration_test.rs`).**
222+
10 tests that drive the gateway by spawning the real `psql`
223+
command-line client (libpq) as a subprocess. Catches client-
224+
specific issues that an embedded driver wouldn't surface — startup
225+
negotiation, notice handling, the simple-query-with-CommandComplete
226+
flow. Slower per case (~50ms subprocess overhead) so kept to a
227+
focused subset, not a full mirror of (2). Skipped automatically if
228+
`psql` isn't on `PATH` or `TRINO_HOST` is unset.
229+
210230
```bash
211-
cargo test # unit tests, no Trino
231+
# Unit tests only — no Trino required.
232+
cargo test --lib
233+
234+
# All gates a PR must pass.
212235
cargo clippy --all-targets -- -D warnings # lint
213236
cargo fmt --check # format
237+
reuse lint # license metadata
214238

215-
# With Trino (read-only):
239+
# Read-only Trino integration (covers both client suites — tokio-postgres
240+
# tests in (2) auto-skip without TRINO_HOST; psql tests in (3) auto-skip
241+
# without TRINO_HOST and without `psql` on PATH).
216242
TRINO_HOST=... TRINO_PORT=... TRINO_SSL=true TRINO_TLS_NO_VERIFY=true \
217243
TRINO_CATALOG=tpch TRINO_SCHEMA=sf1 \
218244
cargo test
219245

220-
# With DDL tests (needs a writable catalog like 'memory'):
221-
TRINO_WRITE_CATALOG=memory TRINO_WRITE_SCHEMA=default \
222-
cargo test
246+
# Run only the tokio-postgres suite.
247+
cargo test --test integration_test
248+
249+
# Run only the psql suite (needs postgresql-client installed).
250+
cargo test --test psql_integration_test
251+
252+
# DDL tests in the tokio-postgres suite need a writable catalog
253+
# (e.g. 'memory'). Set TRINO_WRITE_CATALOG / TRINO_WRITE_SCHEMA in
254+
# addition to the read-only env vars above.
255+
TRINO_HOST=... TRINO_PORT=... TRINO_SSL=true TRINO_TLS_NO_VERIFY=true \
256+
TRINO_CATALOG=tpch TRINO_SCHEMA=sf1 \
257+
TRINO_WRITE_CATALOG=memory TRINO_WRITE_SCHEMA=default \
258+
cargo test --test integration_test
259+
260+
# Three tokio-postgres extended-protocol tests that depend on binary
261+
# wire format are `#[ignore]`-marked (see "Wire format" above). Run
262+
# them on demand once binary support lands:
263+
cargo test --test integration_test -- --ignored
223264
```
224265

225266
`pre-commit run --all-files` runs the full battery (fmt, clippy, tests,

0 commit comments

Comments
 (0)