Skip to content
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

Checking to see if these tests pass #7235

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 17 additions & 48 deletions tests/Aspire.Hosting.Tests/DistributedApplicationTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.

using System.Globalization;
using System.Text.Json;
using System.Text.RegularExpressions;
using System.Threading.Channels;
using Aspire.Components.Common.Tests;
Expand Down Expand Up @@ -147,7 +148,7 @@ public void TryAddWillNotAddTheSameLifecycleHook()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/aspire/issues/4651", typeof(PlatformDetection), nameof(PlatformDetection.IsRunningOnCI))]

public async Task AllocatedPortsAssignedAfterHookRuns()
{
using var testProgram = CreateTestProgram();
Expand Down Expand Up @@ -180,7 +181,6 @@ public Task AfterEndpointsAllocatedAsync(DistributedApplicationModel appModel, C
}

[Fact]
[ActiveIssue("https://github.com/dotnet/aspire/issues/4651", typeof(PlatformDetection), nameof(PlatformDetection.IsRunningOnCI))]
public async Task TestServicesWithMultipleReplicas()
{
var replicaCount = 3;
Expand Down Expand Up @@ -237,7 +237,6 @@ public async Task TestServicesWithMultipleReplicas()

[Fact]
[RequiresDocker]
[ActiveIssue("https://github.com/dotnet/aspire/issues/4651", typeof(PlatformDetection), nameof(PlatformDetection.IsRunningOnCI))]
public async Task VerifyDockerAppWorks()
{
using var testProgram = CreateTestProgram();
Expand Down Expand Up @@ -267,7 +266,6 @@ public async Task VerifyDockerAppWorks()

[Fact]
[RequiresDocker]
[ActiveIssue("https://github.com/dotnet/aspire/issues/4651", typeof(PlatformDetection), nameof(PlatformDetection.IsRunningOnCI))]
public async Task VerifyContainerStopStartWorks()
{
using var testProgram = CreateTestProgram(randomizePorts: false);
Expand Down Expand Up @@ -319,7 +317,6 @@ public async Task VerifyContainerStopStartWorks()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/aspire/issues/4651", typeof(PlatformDetection), nameof(PlatformDetection.IsRunningOnCI))]
public async Task VerifyExecutableStopStartWorks()
{
using var testProgram = CreateTestProgram(randomizePorts: false);
Expand Down Expand Up @@ -353,7 +350,6 @@ public async Task VerifyExecutableStopStartWorks()

[Fact]
[RequiresDocker]
[ActiveIssue("https://github.com/dotnet/aspire/issues/4651", typeof(PlatformDetection), nameof(PlatformDetection.IsRunningOnCI))]
public async Task SpecifyingEnvPortInEndpointFlowsToEnv()
{
using var testProgram = CreateTestProgram(randomizePorts: false);
Expand Down Expand Up @@ -409,7 +405,6 @@ public async Task SpecifyingEnvPortInEndpointFlowsToEnv()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/aspire/issues/4651", typeof(PlatformDetection), nameof(PlatformDetection.IsRunningOnCI))]
public async Task StartAsync_DashboardAuthConfig_PassedToDashboardProcess()
{
var browserToken = "ThisIsATestToken";
Expand Down Expand Up @@ -449,7 +444,6 @@ public async Task StartAsync_DashboardAuthConfig_PassedToDashboardProcess()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/aspire/issues/4651", typeof(PlatformDetection), nameof(PlatformDetection.IsRunningOnCI))]
public async Task StartAsync_UnsecuredAllowAnonymous_PassedToDashboardProcess()
{
var args = new string[] {
Expand Down Expand Up @@ -485,7 +479,6 @@ public async Task StartAsync_UnsecuredAllowAnonymous_PassedToDashboardProcess()

[Fact]
[RequiresDocker]
[ActiveIssue("https://github.com/dotnet/aspire/issues/4651", typeof(PlatformDetection), nameof(PlatformDetection.IsRunningOnCI))]
public async Task VerifyDockerWithEntrypointWorks()
{
using var testProgram = CreateTestProgram();
Expand Down Expand Up @@ -513,7 +506,6 @@ public async Task VerifyDockerWithEntrypointWorks()

[Fact]
[RequiresDocker]
[ActiveIssue("https://github.com/dotnet/aspire/issues/4651", typeof(PlatformDetection), nameof(PlatformDetection.IsRunningOnCI))]
public async Task VerifyDockerWithBindMountWorksWithAbsolutePaths()
{
using var testProgram = CreateTestProgram();
Expand Down Expand Up @@ -543,7 +535,6 @@ public async Task VerifyDockerWithBindMountWorksWithAbsolutePaths()

[Fact]
[RequiresDocker]
[ActiveIssue("https://github.com/dotnet/aspire/issues/4651", typeof(PlatformDetection), nameof(PlatformDetection.IsRunningOnCI))]
public async Task VerifyDockerWithBindMountWorksWithRelativePaths()
{
using var testProgram = CreateTestProgram();
Expand Down Expand Up @@ -573,7 +564,6 @@ public async Task VerifyDockerWithBindMountWorksWithRelativePaths()

[Fact]
[RequiresDocker]
[ActiveIssue("https://github.com/dotnet/aspire/issues/4651", typeof(PlatformDetection), nameof(PlatformDetection.IsRunningOnCI))]
public async Task VerifyDockerWithVolumeWorksWithName()
{
using var testProgram = CreateTestProgram();
Expand Down Expand Up @@ -602,7 +592,6 @@ public async Task VerifyDockerWithVolumeWorksWithName()

[Fact]
[RequiresDocker]
[ActiveIssue("https://github.com/dotnet/aspire/issues/4651", typeof(PlatformDetection), nameof(PlatformDetection.IsRunningOnCI))]
public async Task KubernetesHasResourceNameForContainersAndExes()
{
using var testProgram = CreateTestProgram(includeIntegrationServices: true);
Expand Down Expand Up @@ -659,7 +648,6 @@ public async Task KubernetesHasResourceNameForContainersAndExes()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/aspire/issues/4651", typeof(PlatformDetection), nameof(PlatformDetection.IsRunningOnCI))]
public async Task ReplicasAndProxylessEndpointThrows()
{
using var testProgram = CreateTestProgram();
Expand All @@ -677,7 +665,6 @@ public async Task ReplicasAndProxylessEndpointThrows()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/aspire/issues/4651", typeof(PlatformDetection), nameof(PlatformDetection.IsRunningOnCI))]
public async Task ProxylessEndpointWithoutPortThrows()
{
using var testProgram = CreateTestProgram();
Expand All @@ -696,7 +683,6 @@ public async Task ProxylessEndpointWithoutPortThrows()
}

[Fact]
[ActiveIssue("https://github.com/dotnet/aspire/issues/4651", typeof(PlatformDetection), nameof(PlatformDetection.IsRunningOnCI))]
public async Task ProxylessEndpointWorks()
{
using var testProgram = CreateTestProgram();
Expand Down Expand Up @@ -731,7 +717,6 @@ await Assert.ThrowsAnyAsync<Exception>(async () =>
}

[Fact]
[ActiveIssue("https://github.com/dotnet/aspire/issues/4599", typeof(PlatformDetection), nameof(PlatformDetection.IsRunningOnCI))]
public async Task ProxylessAndProxiedEndpointBothWorkOnSameResource()
{
using var testProgram = CreateTestProgram();
Expand All @@ -751,54 +736,39 @@ public async Task ProxylessAndProxiedEndpointBothWorkOnSameResource()

testProgram.AppBuilder.Services.AddLogging(b => b.AddXunit(_testOutputHelper));

testProgram.ServiceABuilder.WithHttpHealthCheck();
testProgram.ServiceABuilder.WithHttpsHealthCheck();

await using var app = testProgram.Build();

var rns = app.Services.GetRequiredService<ResourceNotificationService>();

await app.StartAsync().DefaultTimeout(TestConstants.DefaultOrchestratorTestTimeout);

using var cts = AsyncTestHelpers.CreateDefaultTimeoutTokenSource(TestConstants.LongTimeoutDuration);
var token = cts.Token;

var urls = string.Empty;
await rns.WaitForResourceHealthyAsync(testProgram.ServiceABuilder.Resource.Name, cts.Token);

var httpEndPoint = app.GetEndpoint(testProgram.ServiceABuilder.Resource.Name, endpointName: "http");
while (true)
{
try
{
using var client = new HttpClient();
urls = await client.GetStringAsync($"{httpEndPoint}urls", token);
break;
}
catch
{
await Task.Delay(100, token);
}
}
using var client = new HttpClient();
var urls = await client.GetStringAsync($"{httpEndPoint}urls", token);

var urlsData = JsonSerializer.Deserialize<string[]>(urls)!;
Assert.Equal(2, urlsData.Length);

Assert.Contains(httpEndPoint.ToString().Trim('/'), urls);

// https endpoint is proxied so app won't have this specific endpoint
var httpsEndpoint = app.GetEndpoint(testProgram.ServiceABuilder.Resource.Name, endpointName: "https");
Assert.DoesNotContain(httpsEndpoint.ToString().Trim('/'), urls);

while (true)
{
try
{
using var client = new HttpClient();
var value = await client.GetStringAsync($"{httpsEndpoint}urls", token).DefaultTimeout();
Assert.Equal(urls, value);
break;
}
catch (Exception ex) when (ex is not EqualException)
{
await Task.Delay(100, token);
}
}
var value = await client.GetStringAsync($"{httpsEndpoint}urls", token).DefaultTimeout();
Assert.Equal(urls, value);
}

[Fact]
[RequiresDocker]
[ActiveIssue("https://github.com/dotnet/aspire/issues/4651", typeof(PlatformDetection), nameof(PlatformDetection.IsRunningOnCI))]
public async Task ProxylessContainerCanBeReferenced()
{
using var builder = TestDistributedApplicationBuilder.Create();
Expand Down Expand Up @@ -837,7 +807,7 @@ public async Task ProxylessContainerCanBeReferenced()
Assert.Equal("localhost:1234", env.Value);

var list = await s.ListAsync<Container>().DefaultTimeout();
var redisContainer = Assert.Single(list.Where(c => Regex.IsMatch(c.Name(),$"redis-{ReplicaIdRegex}-{suffix}"))) ;
var redisContainer = Assert.Single(list.Where(c => Regex.IsMatch(c.Name(), $"redis-{ReplicaIdRegex}-{suffix}")));
Assert.Equal(1234, Assert.Single(redisContainer.Spec.Ports!).HostPort);

var otherRedisEnv = Assert.Single(service.Spec.Env!.Where(e => e.Name == "ConnectionStrings__redisNoPort"));
Expand All @@ -851,7 +821,6 @@ public async Task ProxylessContainerCanBeReferenced()

[Fact]
[RequiresDocker]
[ActiveIssue("https://github.com/dotnet/aspire/issues/4651", typeof(PlatformDetection), nameof(PlatformDetection.IsRunningOnCI))]
public async Task ProxylessContainerWithoutPortThrows()
{
using var builder = TestDistributedApplicationBuilder.Create();
Expand Down
Loading