Repository navigation
test: avoid credential-bearing URI literals in fixtures and examples - #520
Conversation
Validate URI components and credentials structurally while retaining metacharacter-escaping coverage. Remove unnecessary fixture authentication, redact illustrative TLS output and require an explicit runtime URI for manual longhaul deployment. Co-authored-by: Copilot <[email protected]> Copilot-Session: 33b3cb3c-1b25-4ffb-bff1-ebf0f3d04058 Signed-off-by: Rayhan Hossain <[email protected]>
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the credential-literal cleanup in test fixtures and documentation.
No open issues 🎉
What changed in this PR
This PR removes complete credential-bearing literals from test fixtures and documentation without changing production URI formatting or automated deployment behavior.
Changes:
- Replace the basic Mongo URI string comparison with explicit component assertions, preserving credential-escaping tests.
- Remove unnecessary credentials from the connection-string regex fixture and redact illustrative TLS output.
- Require a deployment-specific
LONGHAUL_DOCUMENTDB_URIfor manual longhaul Secret creation.
| File | Description |
|---|---|
test/shared/mongo/client_test.go |
Assert URI components individually instead of comparing a complete credential-bearing literal. |
test/longhaul/README.md |
Require an explicitly configured deployment URI for manual Secret creation. |
test/e2e/pkg/e2eutils/assertions/assertions_test.go |
Remove authentication data from the regex assertion fixture. |
documentdb-playground/tls/E2E-TESTING.md |
Label example output as redacted and replace credentials with placeholders. |
Review effort: Balanced
|
🤖 Auto-triaged by documentdb-triage-tool. Applied: Reasoningcomponent from path globs (docs, test, playground); effort from diff stats (26+9 LOC, 4 files) If a label is wrong, ping |
Summary
These are synthetic test/example values, not application credential defaults. Keeping complete credential-bearing literals out of them makes the examples clearer and avoids misleading credential detections without modifying production URI formatting or weakening tests.
Validation
go test -race ./mongoandgo vet ./mongointest/shared.go test -race ./pkg/e2eutils/assertionsandgo vet ./pkg/e2eutils/assertionsintest/e2e.No operator, CRD, URI-builder, or automated deployment behavior changes.