Skip to content

Commit 70a2f8a

Browse files
TimPansinoumaannamalaimergify[bot]
authored
Add Additional Delay to Test Startup Fixture (#1494)
* Add additional delay to test startup fixture * Fix assertion error message --------- Co-authored-by: Uma Annamalai <uannamalai@newrelic.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent 6dcee40 commit 70a2f8a

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

tests/testing_support/fixtures.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,16 @@ def _collector_agent_registration_fixture(request, settings_fixture):
333333

334334
@pytest.fixture
335335
def collector_available_fixture(request, collector_agent_registration):
336-
application = application_instance()
337-
active = application.active
338-
assert active
336+
application = collector_agent_registration
337+
settings = global_settings()
338+
339+
# Wait for the application to become active.
340+
timeout = (settings.startup_timeout or 0) + 10.0
341+
while not application.active and timeout > 0:
342+
time.sleep(0.1)
343+
timeout -= 0.1
344+
345+
assert application.active, f"Application failed to activate after {timeout} seconds."
339346

340347

341348
def raise_background_exceptions(timeout=5.0):

0 commit comments

Comments
 (0)