Skip to content

test: real GCS-adapter tests for certstore (fake-gcs-server)#14

Merged
pstaylor-patrick merged 1 commit into
mainfrom
test/certstore-gcs
May 24, 2026
Merged

test: real GCS-adapter tests for certstore (fake-gcs-server)#14
pstaylor-patrick merged 1 commit into
mainfrom
test/certstore-gcs

Conversation

@pstaylor-patrick

Copy link
Copy Markdown
Collaborator

What this PR does

Adds real tests for our GCS certmagic.Storage adapter (internal/certstore) — previously 0% covered — against a live GCS-compatible backend (fsouza/fake-gcs-server, started by TestMain over Docker).

Principled scope: these assert our adapter's contract, not the GCS client:

  • Load/Stat of a missing key → fs.ErrNotExist (certmagic relies on this mapping)
  • StoreLoadDelete round-trip; Exists reflects it
  • List returns keys with our internal certs/ prefix trimmed
  • directory-prefix Delete removes everything beneath it
  • the distributed Lock is mutually exclusive (conditional create) and re-acquirable after Unlock

Bona fide (audited)

Mutation-tested: removing our List prefix-trim makes TestListTrimsPrefix go red (certs/site/a.pem vs site/a.pem); the lock test fails if mutual exclusion breaks. Runs in CI (a new step; runners have Docker), skips loudly only if Docker/emulator is unavailable.

🤖 Generated with Claude Code

Cover OUR certmagic.Storage adapter contract against a real GCS-compatible
backend (fsouza/fake-gcs-server, started by TestMain over docker) — not the
GCS client itself:

- Load/Stat of a missing key map to fs.ErrNotExist (certmagic depends on this)
- Store→Load→Delete round-trip; Exists reflects it
- List returns keys with our internal prefix trimmed off
- directory-prefix Delete removes all keys beneath it
- the distributed Lock provides mutual exclusion (conditional create) and is
  re-acquirable after Unlock

Runs in CI (runners have docker); skips loudly if docker/emulator unavailable.
Audited bona fide: dropping the List prefix-trim makes TestListTrimsPrefix go
red ("certs/site/a.pem" vs "site/a.pem").

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@pstaylor-patrick pstaylor-patrick merged commit 62e260f into main May 24, 2026
4 checks passed
@pstaylor-patrick pstaylor-patrick deleted the test/certstore-gcs branch May 24, 2026 21:36
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