Skip to content

test(SurrealDb): bump VerifySurrealDbResource and WithDataShouldPersistStateBetweenUsages timeouts to 10 minutes - #1431

Closed
tamirdresher wants to merge 1 commit into
CommunityToolkit:mainfrom
tamirdresher:fix/surrealdb-test-timeout
Closed

test(SurrealDb): bump VerifySurrealDbResource and WithDataShouldPersistStateBetweenUsages timeouts to 10 minutes#1431
tamirdresher wants to merge 1 commit into
CommunityToolkit:mainfrom
tamirdresher:fix/surrealdb-test-timeout

Conversation

@tamirdresher

Copy link
Copy Markdown
Contributor

Why

The post-merge .NET main run for #1394 hit a SurrealDB test failure (run 28141532703, attempt 2): SurrealDbFunctionalTests.WithDataShouldPersistStateBetweenUsages(useVolume: False) cancelled at 5m 03s with the resource already reporting:

- Current State: Running
- Current Health: Healthy
- - - - System.OperationCanceledException : The operation was canceled.

i.e. the healthy event arrived right as the 5-minute CTS tripped.

Root cause

WithDataShouldPersistStateBetweenUsages runs two full app lifecycles back to back (start surreal → wait healthy → write data → stop, then build a new app → start → wait healthy → read data). On a cold runner the first SurrealDB image pull + container start + healthy check eats most of the 5-minute budget, leaving no headroom for the second app. The other slow tests in this file (VerifyWaitForOnSurrealDbBlocksDependentResources, VerifyWaitForOnSurrealDbBlocksDependentResourcesUntilCancellation) already use FromMinutes(10) -- aligning these two with that.

What changes

Two-line change:

Test Before After
VerifySurrealDbResource FromMinutes(5) FromMinutes(10)
WithDataShouldPersistStateBetweenUsages FromMinutes(5) FromMinutes(10)

Leaves the [Fact(Skip = ...)] test (AddDatabaseCreatesDatabaseWithCustomScript) at 5 minutes since it doesn't run.

Aaron mentioned image caching is supposed to be in place; if it later proves to be working, the test will simply finish well under the new 10-minute ceiling -- this purely raises the upper bound, no behavior change.

cc @aaronpowell

…stStateBetweenUsages timeouts to 10 minutes

These two tests still used a 5-minute CancellationTokenSource while the
slower tests in the same class (VerifyWaitForOnSurrealDbBlocksDependentResources
and VerifyWaitForOnSurrealDbBlocksDependentResourcesUntilCancellation) already
use 10 minutes.

WithDataShouldPersistStateBetweenUsages does two full app lifecycles
back-to-back (start surreal -> wait healthy -> write -> stop -> start again ->
wait healthy -> read), so on a cold runner the first SurrealDB image pull plus
container start can consume most of the 5-minute budget. The post-merge .NET
main run for CommunityToolkit#1394 hit this: cancellation fired at 5m 03s with the resource
already reporting Current State: Running and Current Health: Healthy -- the
healthy event arrived just as the token tripped (run 28141532703, attempt 2).

Aligning these two tests with the existing 10-minute budget removes the race.
Copilot AI review requested due to automatic review settings June 25, 2026 07:21
@github-actions

Copy link
Copy Markdown
Contributor

🚀 Dogfood this PR with:

⚠️ WARNING: Do not do this without first carefully reviewing the code of this PR to satisfy yourself it is safe.

curl -fsSL https://raw.githubusercontent.com/CommunityToolkit/Aspire/main/eng/scripts/dogfood-pr.sh | bash -s -- 1431

Or

  • Run remotely in PowerShell:
iex "& { $(irm https://raw.githubusercontent.com/CommunityToolkit/Aspire/main/eng/scripts/dogfood-pr.ps1) } 1431"

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts SurrealDB functional test cancellation timeouts to reduce flakiness on cold CI runners where the container image pull and startup can consume most of the prior 5-minute budget, especially for tests that perform multiple full app lifecycles.

Changes:

  • Bump VerifySurrealDbResource timeout from 5 minutes to 10 minutes.
  • Bump WithDataShouldPersistStateBetweenUsages timeout from 5 minutes to 10 minutes (covers two back-to-back app lifecycles).

@aaronpowell

Copy link
Copy Markdown
Member

I've done some investigating into this more deeply and I think that there's a mistaken assumption on the test failure here being due to the timeout and not that there's an underlying problem.

Looking at sibling tests in the class that WithDataShouldPersistStateBetweenUsages is in, we can see they run in ~10s (VerifyWaitForOnSurrealDbBlocksDependentResources in this run has a duration of 00:00:09.8701816 per the TRX file. Given that, extending the timeline isn't going to resolve the problem, as we see in the test run of this PR.

With the above mentioned test run I have expanded the amount of logging that we do in these kinds of tests, and it looks like the root cause is that it fails to create the namespace because it's unable to connect to the remote server - the websocket connection fails. If the namespace isn't created because it can't connect to the server we have a cascade of problems which results in the resource never becoming healthy and eventually the test hits the timeout and is terminated.

Reviewing the tests in this test class, I actually don't believe we should have them in at all, the tests are really testing Aspire core behaviour, not really the behaviour of the integration - at least not in a way that isn't already covered by our integration test stack using the example app host. Let's take the method WithDataShouldPersistStateBetweenUsages for example, this test is verifying that the mounted container volume will be persisted or not by Aspire between runs, depending on whether we call WithDataVolume. This test is not something that we should have in our repo because the behaviour of WithDataVolume is just a wrapper around WithVolume from Aspire, and if WithVolume fails to persist a volume with the underlying container runtime, there's nothing that we can do in the Toolkit to resolve it. We should have unit tests that verify that we have the correct annotations set (which it doesn't look like we do have), but this test as it stands, and the others in the test class, shouldn't be in our repo.

@aaronpowell

Copy link
Copy Markdown
Member

Closing in favour of #1441

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants