Skip to content

encryption: run tests in parallel - #1399

Merged
bootjp merged 1 commit into
mainfrom
test/parallel-encryption
Nov 7, 2026
Merged

bootjp merged 1 commit into
mainfrom
test/parallel-encryption

Conversation

@bootjp

@bootjp bootjp commented Nov 6, 2026

Copy link
Copy Markdown
Owner

Summary

Adds t.Parallel() to 112 top-level tests in ./internal/encryption (86) and ./internal/encryption/kek (26) that did not call it (188 already did). Part of the effort to parallelize the Go test suite; CI-side sharding is in #1387.

Candidates were picked with a go/ast scan that skips any test which (directly or through same-package helpers) calls t.Setenv/os.Setenv/os.Chdir, writes a package-level variable from test code, calls process-global setters (slog.SetDefault, prometheus.MustRegister, signal.Notify, runtime.GOMAXPROCS(n), …), or carries a comment about parallelism.

Left serial (6 tests, all in kek): t.Setenv plus process-wide os.Unsetenv of the KEK env var by NewEnvWrapper / NewWrapperFromSources (TestEnvWrapper{InvalidInputStillUnsets,RejectsInvalidDEKLength,RoundTripAndUnset}, TestNewWrapperFromSources{FileAndEnv,NoSource,RejectsAmbiguity}). No tests were reverted by hand: the newly parallel tests use t.TempDir() for sidecar/KEK files, in-memory fakes for AWS KMS / GCP KMS / Vault (no listeners or fixed ports), and per-test keystores; the only fixed paths (/tmp/never-written, a NUL-containing path) are never written.

Behavior change / risk

Test-only. No production code changes. Risk is limited to hidden shared state between tests, which the -race -count=3 run did not surface.

Test evidence

  • go test -race -count=3 ./internal/encryption ./internal/encryption/kek — ok
  • package time (-race -count=1, shared loaded machine):
    • internal/encryption: 67.6s → 52.8s
    • internal/encryption/kek: 1.8s → 1.6s
  • golangci-lint run ./internal/encryption/... — 0 issues; gofmt -l clean
  • No flakes observed

Self-review

  1. Data loss: no production code touched; nothing to lose.
  2. Concurrency: newly parallel tests use per-test t.TempDir(), per-test keystores and in-memory KMS fakes; env-mutating KEK tests stay serial (Go runs serial top-level tests before paused parallel ones resume). -race -count=3 clean.
  3. Performance: internal/encryption wall time drops ~22% locally; most of its slow tests were already parallel.
  4. Data consistency: no change to MVCC/OCC/HLC or the encryption code paths.
  5. Test coverage: unchanged; test bodies are untouched apart from the inserted t.Parallel() calls.

Signed-off-by: bootjp <contact@bootjp.me>
@coderabbitai

coderabbitai Bot commented Nov 6, 2026

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 36 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: ab375329-1500-4e79-bd36-a27b267e74df
Commits

Reviewing files that changed from the base of the PR and between a9e3223 and e382ff1.

Files selected for processing: 16

  • internal/encryption/audit_test.go
  • internal/encryption/cache_invalidation_test.go
  • internal/encryption/cipher_prop_test.go
  • internal/encryption/cipher_test.go
  • internal/encryption/envelope_test.go
  • internal/encryption/kek/aws_kms_test.go
  • internal/encryption/kek/file_fifo_unix_test.go
  • internal/encryption/kek/file_test.go
  • internal/encryption/kek/gcp_kms_test.go
  • internal/encryption/kek/source_test.go
  • internal/encryption/kek/vault_test.go
  • internal/encryption/keystore_test.go
  • internal/encryption/nonce_observation_test.go
  • internal/encryption/rotation_material_test.go
  • internal/encryption/sidecar_test.go
  • internal/encryption/startup_test.go
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-06T13:46:17.195466Z e382ff1 PR opened
🔒 Security Review ✅ Completed 2026-11-06T13:47:44.620056Z e382ff1 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@bootjp
bootjp merged commit 106069d into main Nov 7, 2026
18 checks passed
@bootjp
bootjp deleted the test/parallel-encryption branch November 7, 2026 00:44
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