Skip to content

Surrealdb test fix#1237

Merged
aaronpowell merged 3 commits intomainfrom
surrealdb-test-fix
Mar 27, 2026
Merged

Surrealdb test fix#1237
aaronpowell merged 3 commits intomainfrom
surrealdb-test-fix

Conversation

@aaronpowell
Copy link
Copy Markdown
Member

Closes #I was too lazy to log

SurrealDB's endpoint, when hit by HTTP, will direct to their website, and it doesn't like getting sent there from automated tests anymore, so updating how we assert.

PR Checklist

  • Created a feature/dev branch in your fork (vs. submitting directly from a commit on main)
  • Based off latest main branch of toolkit
  • PR doesn't include merge commits (always rebase on top of our main, if needed)
  • New integration
    • Docs are written
    • Added description of major feature to project description for NuGet package (4000 total character limit, so don't push entire description over that)
  • Tests for the changes have been added (for bug fixes / features) (if applicable)
  • Contains NO breaking changes
  • Every new API (including internal ones) has full XML docs
  • Code follows all style conventions

Other information

Copilot AI review requested due to automatic review settings March 27, 2026 04:13
@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 -- 1237

Or

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

@github-actions
Copy link
Copy Markdown
Contributor

Code Coverage

Package Line Rate Branch Rate Complexity Health
CommunityToolkit.Aspire.GoFeatureFlag 100% 100% 44
CommunityToolkit.Aspire.Hosting.ActiveMQ 88% 48% 95
CommunityToolkit.Aspire.Hosting.ActiveMQ.MassTransit 100% 100% 15
CommunityToolkit.Aspire.Hosting.Adminer 89% 70% 20
CommunityToolkit.Aspire.Hosting.Azure.Dapr 28% 5% 38
CommunityToolkit.Aspire.Hosting.Azure.Dapr.Redis 60% 50% 20
CommunityToolkit.Aspire.Hosting.Azure.DataApiBuilder 100% 100% 11
CommunityToolkit.Aspire.Hosting.Azure.Extensions 64% 30% 27
CommunityToolkit.Aspire.Hosting.Bun 96% 83% 14
CommunityToolkit.Aspire.Hosting.Dapr 47% 26% 557
CommunityToolkit.Aspire.Hosting.DbGate 96% 62% 12
CommunityToolkit.Aspire.Hosting.Deno 98% 85% 22
CommunityToolkit.Aspire.Hosting.Elasticsearch.Extensions 100% 94% 30
CommunityToolkit.Aspire.Hosting.Flagd 79% 100% 16
CommunityToolkit.Aspire.Hosting.Flyway 88% 100% 6
CommunityToolkit.Aspire.Hosting.GoFeatureFlag 98% 73% 18
CommunityToolkit.Aspire.Hosting.GoFeatureFlag.ApiService 100% 100% 3
CommunityToolkit.Aspire.Hosting.Golang 59% 46% 45
CommunityToolkit.Aspire.Hosting.Java 86% 75% 207
CommunityToolkit.Aspire.Hosting.Java.ApiApp 65% 50% 11
CommunityToolkit.Aspire.Hosting.Java.WebApp 25% 18% 59
CommunityToolkit.Aspire.Hosting.JavaScript.Extensions 97% 83% 158
CommunityToolkit.Aspire.Hosting.k6 70% 10% 8
CommunityToolkit.Aspire.Hosting.k6.ApiService 61% 67% 13
CommunityToolkit.Aspire.Hosting.Keycloak.Extensions 100% 100% 11
CommunityToolkit.Aspire.Hosting.KurrentDB 86% 88% 19
CommunityToolkit.Aspire.Hosting.LavinMQ 90% 83% 18
CommunityToolkit.Aspire.Hosting.LavinMQ.MassTransit 100% 100% 15
CommunityToolkit.Aspire.Hosting.MailPit 91% 100% 13
CommunityToolkit.Aspire.Hosting.McpInspector 88% 60% 99
CommunityToolkit.Aspire.Hosting.McpInspector.McpServer 89% 100% 2
CommunityToolkit.Aspire.Hosting.Meilisearch 95% 85% 30
CommunityToolkit.Aspire.Hosting.Meilisearch.ApiService 82% 100% 15
CommunityToolkit.Aspire.Hosting.Minio 99% 91% 32
CommunityToolkit.Aspire.Hosting.Minio.ApiService 98% 92% 15
CommunityToolkit.Aspire.Hosting.MongoDB.Extensions 95% 90% 10
CommunityToolkit.Aspire.Hosting.MySql.Extensions 98% 93% 37
CommunityToolkit.Aspire.Hosting.Ngrok 48% 32% 96
CommunityToolkit.Aspire.Hosting.Ollama 77% 67% 267
CommunityToolkit.Aspire.Hosting.OpenTelemetryCollector 79% 70% 42
CommunityToolkit.Aspire.Hosting.PapercutSmtp 100% 100% 9
CommunityToolkit.Aspire.Hosting.PostgreSQL.Extensions 98% 91% 43
CommunityToolkit.Aspire.Hosting.PowerShell 72% 53% 91
CommunityToolkit.Aspire.Hosting.Python.Extensions 46% 31% 44
CommunityToolkit.Aspire.Hosting.RavenDB 63% 46% 118
CommunityToolkit.Aspire.Hosting.RavenDB.ApiService 21% 33% 16
CommunityToolkit.Aspire.Hosting.Redis.Extensions 100% 71% 14
CommunityToolkit.Aspire.Hosting.Rust 94% 83% 8
CommunityToolkit.Aspire.Hosting.Sftp 86% 70% 16
CommunityToolkit.Aspire.Hosting.Sftp.ApiService 94% 100% 10
CommunityToolkit.Aspire.Hosting.Solr 88% 100% 19
CommunityToolkit.Aspire.Hosting.SqlDatabaseProjects 70% 62% 141
CommunityToolkit.Aspire.Hosting.Sqlite 90% 93% 24
CommunityToolkit.Aspire.Hosting.SqlServer.Extensions 98% 93% 37
CommunityToolkit.Aspire.Hosting.Stripe 50% 17% 119
CommunityToolkit.Aspire.Hosting.SurrealDb 70% 52% 210
CommunityToolkit.Aspire.Hosting.SurrealDb.ApiService 81% 52% 299
CommunityToolkit.Aspire.Hosting.Umami 98% 75% 9
CommunityToolkit.Aspire.Hosting.Zitadel 97% 86% 31
CommunityToolkit.Aspire.KurrentDB 97% 95% 33
CommunityToolkit.Aspire.MassTransit.RabbitMQ 100% 100% 24
CommunityToolkit.Aspire.Meilisearch 97% 96% 38
CommunityToolkit.Aspire.Microsoft.Data.Sqlite 94% 85% 26
CommunityToolkit.Aspire.Microsoft.EntityFrameworkCore.Sqlite 68% 67% 117
CommunityToolkit.Aspire.Minio.Client 93% 87% 67
CommunityToolkit.Aspire.OllamaSharp 78% 74% 76
CommunityToolkit.Aspire.RavenDB.Client 98% 78% 87
CommunityToolkit.Aspire.Sftp 90% 94% 54
CommunityToolkit.Aspire.Sqlite.Api 93% 90% 68
CommunityToolkit.Aspire.SurrealDb 99% 85% 39
Summary 75% (6833 / 9102) 58% (1934 / 3347) 4057

Minimum allowed line rate is 60%

@aaronpowell aaronpowell deployed to azure-artifacts March 27, 2026 04:38 — with GitHub Actions Active
@aaronpowell aaronpowell merged commit 54a81dd into main Mar 27, 2026
247 of 248 checks passed
@aaronpowell aaronpowell deleted the surrealdb-test-fix branch March 27, 2026 04:46
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Updates the SurrealDB hosting integration tests to avoid following SurrealDB’s HTTP redirect behavior, which now interferes with automated assertions.

Changes:

  • Capture the “resource healthy” event and add an assertion on the resource snapshot state.
  • Disable auto-redirects in the test HTTP client and assert redirect status + Location header for /.
  • Minor whitespace cleanup in the API service test.

await fixture.ResourceNotificationService.WaitForResourceHealthyAsync(resourceName).WaitAsync(TimeSpan.FromMinutes(1));
var evt = await fixture.ResourceNotificationService.WaitForResourceHealthyAsync(resourceName).WaitAsync(TimeSpan.FromMinutes(1));

Assert.Equal(KnownResourceStates.Running, evt.Snapshot.State);
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

evt.Snapshot.State is a ResourceStateSnapshot (see other tests using .State?.Text), so comparing it directly to KnownResourceStates.Running will never match (and may be a type mismatch depending on overload resolution). Compare against evt.Snapshot.State?.Text (or assert evt.Snapshot.HealthStatus is Healthy if that’s what you want to validate here).

Suggested change
Assert.Equal(KnownResourceStates.Running, evt.Snapshot.State);
Assert.Equal(KnownResourceStates.Running, evt.Snapshot.State?.Text);

Copilot uses AI. Check for mistakes.
Comment on lines +23 to 33
var handler = new HttpClientHandler
{
AllowAutoRedirect = false
};
var httpClient = new HttpClient(handler)
{
BaseAddress = baseUri
};

var response = await httpClient.GetAsync("/");

Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

The HttpClient (and its handler) isn’t disposed. In this repo some tests use using var httpClient (and using var response) to avoid socket/resource leaks during larger test runs. Consider disposing the client (and response) here as well.

Copilot uses AI. Check for mistakes.

Assert.Equal(HttpStatusCode.OK, response.StatusCode);
Assert.Equal(HttpStatusCode.RedirectKeepVerb, response.StatusCode);
Assert.Equal("https://surrealdb.com/surrealist", response.Headers.Location?.AbsoluteUri);
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

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

Asserting the exact redirect target (https://surrealdb.com/surrealist) makes the test brittle to upstream website changes (which is the root cause described in the PR). To keep the test stable, consider asserting only that the response is a redirect and that the Location header points to surrealdb.com (or is non-null), rather than matching the full absolute URI.

Suggested change
Assert.Equal("https://surrealdb.com/surrealist", response.Headers.Location?.AbsoluteUri);
var redirectLocation = response.Headers.Location;
Assert.NotNull(redirectLocation);
Assert.Equal("surrealdb.com", redirectLocation.Host);

Copilot uses AI. Check for mistakes.
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.

2 participants