Repository navigation
Surrealdb test fix #1237
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Surrealdb test fix #1237
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -14,9 +14,23 @@ public class AppHostTests(AspireIntegrationTestFixture<Projects.CommunityToolkit | |||||||||||||
| public async Task SurrealResourceStartsAndRespondsOk() | ||||||||||||||
| { | ||||||||||||||
| const string resourceName = "surreal"; | ||||||||||||||
| var evt = await fixture.ResourceNotificationService.WaitForResourceHealthyAsync(resourceName).WaitAsync(TimeSpan.FromMinutes(1)); | ||||||||||||||
| await fixture.ResourceNotificationService.WaitForResourceHealthyAsync(resourceName).WaitAsync(TimeSpan.FromMinutes(1)); | ||||||||||||||
|
|
||||||||||||||
| Assert.Equal(KnownResourceStates.Running, evt.Snapshot.State); | ||||||||||||||
| var tcpUri = fixture.GetEndpoint(resourceName, "tcp"); | ||||||||||||||
| var baseUri = new Uri(tcpUri.AbsoluteUri.Replace("tcp://", "http://")); | ||||||||||||||
| var handler = new HttpClientHandler | ||||||||||||||
| { | ||||||||||||||
| AllowAutoRedirect = false | ||||||||||||||
| }; | ||||||||||||||
| var httpClient = new HttpClient(handler) | ||||||||||||||
| { | ||||||||||||||
| BaseAddress = baseUri | ||||||||||||||
| }; | ||||||||||||||
|
|
||||||||||||||
| var response = await httpClient.GetAsync("/"); | ||||||||||||||
|
|
||||||||||||||
| Assert.Equal(HttpStatusCode.RedirectKeepVerb, response.StatusCode); | ||||||||||||||
| Assert.Equal("https://surrealdb.com/surrealist", response.Headers.Location?.AbsoluteUri); | ||||||||||||||
|
||||||||||||||
| Assert.Equal("https://surrealdb.com/surrealist", response.Headers.Location?.AbsoluteUri); | |
| var redirectLocation = response.Headers.Location; | |
| Assert.NotNull(redirectLocation); | |
| Assert.Equal("surrealdb.com", redirectLocation.Host); |
There was a problem hiding this comment.
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 useusing var httpClient(andusing var response) to avoid socket/resource leaks during larger test runs. Consider disposing the client (and response) here as well.