Repository navigation
perf(tests): Reuse one Relay container per module in Relay tests - #131668
Draft
sentry-junior[bot] wants to merge 7 commits into
Draft
sentry-junior[bot] wants to merge 7 commits into
sentry-junior[bot] wants to merge 7 commits into
Conversation
relay_server started a new Relay container for every test. Keep one per module instead: a test starts it only when the module's Relay is not ready, so the first test starts it and later tests reuse it. Each test still gets its own project keys, which is what Relay caches configs by. Authenticate the test Relay with static auth, since its database registration would be flushed after the first test, and keep the test settings and option overrides for the module, since Relay keeps fetching its global config while it runs. Refs DI-2898 Co-Authored-By: Joshua Li <14209781+joshuarli@users.noreply.github.com>
…ainer-per-module Co-Authored-By: Joshua Li <14209781+joshuarli@users.noreply.github.com>
A reused Relay fetches its global config when it starts, inside a test. Its 10s refetch could land in the next test's setup, before that test has database access, and the endpoint returned a 500. Co-Authored-By: Joshua Li <14209781+joshuarli@users.noreply.github.com>
Temporary measurement for this PR; reverted before review. Co-Authored-By: Joshua Li <14209781+joshuarli@users.noreply.github.com>
This reverts commit bf08579. Co-Authored-By: Joshua Li <14209781+joshuarli@users.noreply.github.com>
A reused Relay fetches its global config only at startup and holds envelopes until it has one. If that fetch fails, start another Relay instead of letting every test in the module time out. Co-Authored-By: Joshua Li <14209781+joshuarli@users.noreply.github.com>
OptionsStore.model follows the current silo mode. get_store and get_last_update_channel read it for the query and again for the except clause, so a silo mode switch on another thread in between let Option.DoesNotExist escape as an error. Tests hit this when a live server request ran while the test switched silo mode. Co-Authored-By: Joshua Li <14209781+joshuarli@users.noreply.github.com>
This branch was successfully deployed
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.
Refs DI-2898
relay_serverwas function-scoped, so every Relay integration test started and stopped its own Relay container. Container startup is a large share of the slowest Relay files (lang/java/test_plugin.py,lang/javascript/test_plugin.py), since neither has rejection tests that wait out timeouts.What changes
relay_serverstays function-scoped but only starts a container when the module's Relay fails its readiness probe. The first test in a module starts it, later tests reuse it, and a Relay that dies mid-module gets replaced.relay_server_setupstill removes the container when the module ends.relay_test_settings()and therelay.endpoint-fetch-config.enabledoverride now stay active for the whole module. Relay fetches its global config once per container (cache.global_config_fetch_interval: 3600), and the fixture restarts a Relay that comes up without one.SENTRY_RELAY_STATIC_AUTH, read fromtemplate/credentials.json. Its normal registration is aRelayrow, which the firstTransactionTestCaseflush deletes, so later tests would get "Unknown relay".Isolation
test_sdk.py, which reuses project id 1 but gets a new key each time.relay.endpoint-fetch-config.enabled, no Relay test overrides an option that goes into the global config.Overlap with #131170
#131170 (merged) changes
src/sentry/testutils/relay.pyand two Relay test files, and this PR doesn't touch any of them. Its outcome checks filter on each test's own org, project and key IDs, so late outcomes from an earlier test on the shared Relay can't match.Status: parked
lang/javascript/test_plugin.pyis slower than on master.OptionsStorerace fix is in fix(options): Read the silo-dependent model once in OptionsStore #131740.via @joshuarli.
--
View Session [Sentry]