Fix Postgres CI key-store test when DATABASE_URL is set - #23
Open
dmitryflynn wants to merge 1 commit into
Open
dmitryflynn wants to merge 1 commit into
dmitryflynn wants to merge 1 commit into
Conversation
…gleton. The live Postgres job sets NETLOGIC_DATABASE_URL before pytest imports api_keys, so api_key_store is already PgApiKeyStore. Assert the builder after clearing the env instead. Co-authored-by: dmitryflynn <dmitryflynn@users.noreply.github.com>
dmitryflynn
marked this pull request as ready for review
August 27, 2026 20:01
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.
Bug
The Postgres integration (live DB) CI job has been red on
mainand on open PRs. Runtime evidence:Reproduced locally with
NETLOGIC_DATABASE_URLset at import time: the singleton isPgApiKeyStore, which does not subclassApiKeyStore.Cause
That job always exports
NETLOGIC_DATABASE_URL.api_key_storeis built at import. The test assumed the singleton was still in-memory.Fix
Clear the env, then assert
_build_api_key_store()returnsApiKeyStore. The Postgres-selected singleton is covered bytest_api_key_store_selects_postgres_when_enabled.Verification
With
NETLOGIC_DATABASE_URLset: import singleton isPgApiKeyStore; after pop, builder returnsApiKeyStore.