Skip to content

feat: move Valkey to clientless validation#138

Open
cofin wants to merge 3 commits into
mainfrom
feat/clientless-valkey
Open

feat: move Valkey to clientless validation#138
cofin wants to merge 3 commits into
mainfrom
feat/clientless-valkey

Conversation

@cofin
Copy link
Copy Markdown
Member

@cofin cofin commented May 24, 2026

Move readiness off the valkey Python client. The valkey/valkey:latest image already ships valkey-cli, so the fixture uses that for the ping instead of needing a Python dependency.

tests/test_valkey.py drives the service through a small run_valkey(service, *args) helper, preserving the default no-xdist, xdist database, and xdist server scenarios.

The valkey extra is now an empty compatibility group; users install their own client.

cofin added a commit that referenced this pull request May 24, 2026
Match the fix landing in concurrent clientless-* PRs (#134, #135, #136,
#137, #138). pytest-cdist 0.3.x accepts only one steal entry, and 3:10
leaves the middle shard empty when file justification moves a large
test file across the chunk boundary, failing CI.
cofin added a commit that referenced this pull request May 25, 2026
## Summary

`_provide_dolt_service` cached a container handle from `_get_container` above its retry loop. Under parallel xdist with `transient=True`, `docker_service.run` returns success but the container can be auto-removed (Docker `remove=True` plus a brief Dolt startup blip) between the readiness check passing and the post-`run` setup `exec_run`. Every retry then 404s against the same stale ID and the fixture silently yields a broken service, surfacing later as `docker.errors.NotFound` at test setup.

This recurring flake has hit \`tests/test_dolt.py::test_xdist_isolate_server\` on the open clientless PRs (e.g. valkey #138 Python 3.11 - 1/3).

## Changes

- Refetch the container by name inside the loop so a fresh handle is used each iteration.
- Tolerate \`docker.errors.NotFound\` and 404/409 \`APIError\` from \`exec_run\` so a vanished container re-tries cleanly instead of bubbling up.
- Replace the previous silent-skip-on-missing-container path with an explicit \`RuntimeError\` after 5 attempts: a genuinely dead container should fail fixture setup loudly instead of producing a half-baked \`DoltService\`.
cofin added a commit that referenced this pull request May 25, 2026
Replace the `google.cloud.bigquery` / `google.api_core.client_options` /
`google.auth.credentials` imports with a stdlib `urllib.request` REST
probe against the emulator's `/bigquery/v2/projects/<project>/queries`
endpoint, mirroring the Elasticsearch (#139), Valkey (#138), and Redis
family (#136) clientless conversions.

- src/pytest_databases/docker/bigquery.py: drop the three `google.*`
  imports; remove `credentials` and `client_options` from
  `BigQueryService` (keep `host`, `port`, `container`, `project`,
  `dataset`, and the `endpoint` property); add a
  `_query_bigquery_emulator(host, port, project, sql, *, timeout=2.0)`
  helper that POSTs `{"query": sql, "useLegacySql": false}` and parses
  the response; rewrite `check()` to call the helper with `SELECT 1 as
  one` and assert `jobComplete and rows[0].f[0].v == "1"`, swallowing
  `URLError`/`HTTPError`/`JSONDecodeError`/`TimeoutError`/`OSError`;
  delete the `bigquery_client` fixture. The emulator `--dataset=` start
  flag and `DATASET_NAME` env var are preserved so the default dataset
  is still auto-created by the emulator binary itself.
- tests/test_bigquery.py: rewrite to drive the emulator through stdlib
  `urllib.request` only; preserve `test_service_fixture` (SELECT 1 via
  REST); drop `test_client_fixture`; rewrite `test_xdist` to issue
  `CREATE TABLE` against `bigquery_service.dataset` via the REST
  endpoint; add `test_plugin_imports_without_google_cloud_bigquery`
  regression guard that intercepts `google.cloud.bigquery`,
  `google.api_core.client_options`, and `google.auth.credentials` via
  `builtins.__import__`.
- pyproject.toml: empty the `bigquery` compatibility extra so
  `pytest-databases[bigquery]` no longer pulls in
  `google-cloud-bigquery`; drop the `pytest_databases.docker.bigquery`
  `attr-defined` mypy override now that the module no longer touches
  Google client attribute surface.
- docs/supported-databases/bigquery.rst: rewrite the example in the
  user-owned-client style; users now build their own `bigquery.Client`
  from `bigquery_service.endpoint`, `bigquery_service.project`, and
  `AnonymousCredentials()`.
- uv.lock: drop `google-cloud-bigquery`, `google-crc32c`, and
  `google-resumable-media`.
cofin added a commit that referenced this pull request May 25, 2026
Match the fix landing in concurrent clientless-* PRs (#134, #135, #136,
#137, #138). pytest-cdist 0.3.x accepts only one steal entry, and 3:10
leaves the middle shard empty when file justification moves a large
test file across the chunk boundary, failing CI.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant