Skip to content
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

<ItemGroup>
<PackageReference Include="JetBrains.Annotations" Version="2025.2.4" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="10.0.103" PrivateAssets="All" />
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="10.0.300" PrivateAssets="All" />
</ItemGroup>

<ItemGroup Condition=" '$(TargetFramework)' == 'net8.0' ">
Expand Down
4 changes: 2 additions & 2 deletions examples-Aspire/AspireApp1.AppHost/AspireApp1.AppHost.csproj
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">

<Sdk Name="Aspire.AppHost.Sdk" Version="13.1.0" />
<Sdk Name="Aspire.AppHost.Sdk" Version="13.4.0" />

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand All @@ -18,7 +18,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Aspire.Hosting.AppHost" Version="13.1.0" />
<PackageReference Include="Aspire.Hosting.AppHost" Version="13.4.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">

<Sdk Name="Aspire.AppHost.Sdk" Version="13.1.0" />
<Sdk Name="Aspire.AppHost.Sdk" Version="13.4.0" />

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand All @@ -15,7 +15,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Aspire.Hosting.AppHost" Version="13.1.0" />
<PackageReference Include="Aspire.Hosting.AppHost" Version="13.4.0" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/WireMock.Net.Aspire/WireMock.Net.Aspire.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Aspire.Hosting" Version="13.1.0" />
<PackageReference Include="Aspire.Hosting" Version="13.4.0" />
</ItemGroup>

<ItemGroup>
Expand Down
7 changes: 1 addition & 6 deletions src/WireMock.Net.Aspire/WireMockHealthCheck.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,6 @@ public async Task<HealthCheckResult> CheckHealthAsync(HealthCheckContext context
return HealthCheckResult.Unhealthy("WireMock.Net is not healthy");
}

if (resource.ApiMappingState == WireMockMappingState.NotSubmitted)
{
return HealthCheckResult.Unhealthy("WireMock.Net has not received mappings");
}

return HealthCheckResult.Healthy();
}

Expand All @@ -41,4 +36,4 @@ private static async Task<bool> IsHealthyAsync(IWireMockAdminApi adminApi, Cance
return false;
}
}
}
}
6 changes: 6 additions & 0 deletions src/WireMock.Net.Aspire/WireMockLifecycleSubscriber.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,13 @@ public Task SubscribeAsync(IDistributedApplicationEventing eventing, Distributed

var endpoint = wireMockServerResource.GetEndpoint();
Debug.Assert(endpoint.IsAllocated);
}
});

eventing.Subscribe<ResourceReadyEvent>(async (@event, ct) =>
{
if (@event.Resource is WireMockServerResource wireMockServerResource)
{
await wireMockServerResource.WaitForHealthAsync(ct);

await wireMockServerResource.CallAddProtoDefinitionsAsync(ct);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public static async Task WaitForHealthAsync(this IWireMockAdminApi adminApi, int
waitTime = (int)(InitialWaitingTimeInMilliSeconds * Math.Pow(2, retries));
await Task.Delay(waitTime, cancellationToken);
isHealthy = await IsHealthyAsync(adminApi, cancellationToken);

retries++;
totalWaitTime += waitTime;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project Sdk="Microsoft.NET.Sdk">

<Sdk Name="Aspire.AppHost.Sdk" Version="13.1.0" />
<Sdk Name="Aspire.AppHost.Sdk" Version="13.4.0" />

<PropertyGroup>
<OutputType>Exe</OutputType>
Expand All @@ -19,7 +19,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="Aspire.Hosting.AppHost" Version="13.1.1" />
<PackageReference Include="Aspire.Hosting.AppHost" Version="13.4.0" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Aspire.Hosting.Testing" Version="13.1.1" />
<PackageReference Include="Aspire.Hosting.Testing" Version="13.4.0" />
<PackageReference Include="Codecov" Version="1.13.0" />
<PackageReference Include="coverlet.msbuild" Version="6.0.4">
<PrivateAssets>all</PrivateAssets>
Expand All @@ -25,7 +25,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="AwesomeAssertions" Version="9.4.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.3.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="18.6.0" />
<PackageReference Include="Moq" Version="4.20.72" />
<PackageReference Include="xunit.v3" Version="3.2.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="3.1.5">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,17 +92,11 @@ public void AddWireMockWithPort()
Tag = "latest"
});

var endpointAnnotation = wiremock.Resource.Annotations.OfType<EndpointAnnotation>().FirstOrDefault();
endpointAnnotation.Should().BeEquivalentTo(new EndpointAnnotation(
protocol: ProtocolType.Tcp,
uriScheme: "http",
transport: null,
name: null,
port: port,
targetPort: 80,
isExternal: null,
isProxied: true
));
var endpointAnnotation = wiremock.Resource.Annotations.OfType<EndpointAnnotation>().First();
endpointAnnotation.Protocol.Should().Be(ProtocolType.Tcp);
endpointAnnotation.UriScheme.Should().Be("http");
endpointAnnotation.Port.Should().Be(port);
endpointAnnotation.TargetPort.Should().Be(80);

wiremock.Resource.Annotations.OfType<EnvironmentCallbackAnnotation>().FirstOrDefault().Should().NotBeNull();
wiremock.Resource.Annotations.OfType<CommandLineArgsCallbackAnnotation>().FirstOrDefault().Should().NotBeNull();
Expand Down Expand Up @@ -153,39 +147,24 @@ public void AddWireMockWithAdditionalUrls()
endpointAnnotations.Should().HaveCount(3);

var endpointAnnotationForHttp80 = endpointAnnotations[0];
endpointAnnotationForHttp80.Should().BeEquivalentTo(new EndpointAnnotation(
protocol: ProtocolType.Tcp,
uriScheme: "http",
transport: null,
name: null,
port: null,
targetPort: 80,
isExternal: null,
isProxied: true
));
endpointAnnotationForHttp80.Protocol.Should().Be(ProtocolType.Tcp);
endpointAnnotationForHttp80.UriScheme.Should().Be("http");
endpointAnnotationForHttp80.Port.Should().BeNull();
endpointAnnotationForHttp80.TargetPort.Should().Be(80);

var endpointAnnotationForHttpFreePort = endpointAnnotations[1];
endpointAnnotationForHttpFreePort.Should().BeEquivalentTo(new EndpointAnnotation(
protocol: ProtocolType.Tcp,
uriScheme: "http",
transport: null,
name: $"http-{freePorts[0]}",
port: freePorts[0],
targetPort: freePorts[0],
isExternal: null,
isProxied: true
));
endpointAnnotationForHttpFreePort.Protocol.Should().Be(ProtocolType.Tcp);
endpointAnnotationForHttpFreePort.UriScheme.Should().Be("http");
endpointAnnotationForHttpFreePort.Name.Should().Be($"http-{freePorts[0]}");
endpointAnnotationForHttpFreePort.Port.Should().Be(freePorts[0]);
endpointAnnotationForHttpFreePort.TargetPort.Should().Be(freePorts[0]);

var endpointAnnotationForGrpcFreePort = endpointAnnotations[2];
endpointAnnotationForGrpcFreePort.Should().BeEquivalentTo(new EndpointAnnotation(
protocol: ProtocolType.Tcp,
uriScheme: "grpc",
transport: null,
name: $"grpc-{freePorts[1]}",
port: freePorts[1],
targetPort: freePorts[1],
isExternal: null,
isProxied: true
));
endpointAnnotationForGrpcFreePort.Protocol.Should().Be(ProtocolType.Tcp);
endpointAnnotationForGrpcFreePort.UriScheme.Should().Be("grpc");
endpointAnnotationForGrpcFreePort.Name.Should().Be($"grpc-{freePorts[1]}");
endpointAnnotationForGrpcFreePort.Port.Should().Be(freePorts[1]);
endpointAnnotationForGrpcFreePort.TargetPort.Should().Be(freePorts[1]);

wiremock.Resource.Annotations.OfType<EnvironmentCallbackAnnotation>().FirstOrDefault().Should().NotBeNull();
wiremock.Resource.Annotations.OfType<CommandLineArgsCallbackAnnotation>().FirstOrDefault().Should().NotBeNull();
Expand Down
Loading