Add test coverage for Postgres audit log functionality#45
Merged
rbjornstad merged 3 commits intopostgres-auditfrom Feb 4, 2026
Merged
Add test coverage for Postgres audit log functionality#45rbjornstad merged 3 commits intopostgres-auditfrom
rbjornstad merged 3 commits intopostgres-auditfrom
Conversation
Draft
Copilot
AI
changed the title
[WIP] Add Postgres audit support for Kubernetes testing
Add test coverage for Postgres audit functionality
Feb 4, 2026
- Updated FakeClients to accept environment name parameter - Updated all existing test calls to FakeClients with environment parameter - Added TestGeneratePostgresLogSinkName with coverage for simple names, names with hyphens, and long names requiring truncation - Added TestPostgresAuditEnabled with three test cases: * Verifies no sink created when Postgres cluster has audit disabled * Verifies no error when k8s clients unavailable * Verifies sink creation attempted when Postgres cluster has audit enabled Co-authored-by: rbjornstad <2776430+rbjornstad@users.noreply.github.com>
Replace incorrect check for hyphens with proper validation that the truncated name differs from the natural name when it exceeds length limit. Co-authored-by: rbjornstad <2776430+rbjornstad@users.noreply.github.com>
Copilot
AI
changed the title
Add test coverage for Postgres audit functionality
Add test coverage for Postgres audit log functionality
Feb 4, 2026
rbjornstad
approved these changes
Feb 4, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses gaps in test coverage for the Postgres audit logging feature introduced in the parent PR.
Changes
FakeClients signature: Changed from hardcoded
"prod"environment to acceptenvNameparameter, matching reconciler lookup pattern viaenv.EnvironmentNameTestGeneratePostgresLogSinkName: Added coverage parallel to existing
TestGenerateLogSinkNamefor simple names, hyphenated names, and truncation/hashing for names exceeding 100 charactersTestPostgresAuditEnabled: Added three test cases:
audit.enabled: false→ no sink createdk8sClients: nil→ graceful handling without errorsaudit.enabled: true→ sink creation attemptedWarning
Firewall rules blocked me from connecting to one or more addresses (expand for details)
I tried to connect to the following addresses, but was blocked by firewall rules:
logging.googleapis.com/tmp/go-build2238488704/b001/audit.test /tmp/go-build2238488704/b001/audit.test -test.testlogfile=/tmp/go-build2238488704/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true -test.run=TestGeneratePostgresLogSinkName|TestPostgresAuditEnabled pimachinery@v0.3-ifaceassert ep/bin/linux-x64/rg --gdwarf-5 ions/policy/v1be-l mpile ep/bin/linux-x64internal/reconcilers/google/audit/sql.go -o dDuleILOr .cfg 0.1-go1.25.6.linux-amd64/pkg/tool/linux_amd64/vet -p cilers/google/au-o mpile 0.1-go1.25.6.lin-importcfg(dns block)/tmp/go-build3375315084/b001/audit.test /tmp/go-build3375315084/b001/audit.test -test.testlogfile=/tmp/go-build3375315084/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s -test.v=true -test.run=TestGeneratePostgresLogSinkName|TestPostgresAuditEnabled om/go-openapi/sw-ifaceassert ep/bin/linux-x64/rg -p ions/storage/v1a-l mpile ep/bin/linux-x64internal/reconcilers/google/audit/iam.go -o en8D88-EN .cfg 0.1-go1.25.6.linux-amd64/pkg/tool/linux_amd64/vet -p enapi/swag/jsonu-atomic mpile cilers/google/au-buildtags(dns block)/tmp/go-build1234764806/b001/audit.test /tmp/go-build1234764806/b001/audit.test -test.testlogfile=/tmp/go-build1234764806/b001/testlog.txt -test.paniconexit0 -test.timeout=10m0s /tmp/go-build2238488704/b831/vet.cfg g_.a pi@v0.35.0/apiserverinternal/v1a-ifaceassert 0.1-go1.25.6.linux-amd64/pkg/tool/linux_amd64/vet -p d/autoscaling/v2-l mpile 0.1-go1.25.6.lininternal/reconcilers/google/audit/log_buckets.go -w v-guQjFeh .cfg ux-amd64/pkg/tool/linux_amd64/vet -c v1 mpile ux-amd64/pkg/too-buildtags(dns block)If you need me to access, download, or install something from one of these locations, you can either:
💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.