Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ejsmith committed Dec 17, 2024
1 parent 4794fc8 commit 213332f
Show file tree
Hide file tree
Showing 9 changed files with 101 additions and 116 deletions.
6 changes: 3 additions & 3 deletions src/Exceptionless.Insulation/Exceptionless.Insulation.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@
<PackageReference Include="Microsoft.Extensions.DependencyModel" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="9.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="9.0.0" />
<PackageReference Include="MailKit" Version="4.8.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="8.0.0" />
<PackageReference Include="MailKit" Version="4.9.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="9.0.0" />
<PackageReference Include="Serilog.Formatting.Compact" Version="3.0.0" />
<PackageReference Include="Serilog.Settings.Configuration" Version="8.0.4" />
<PackageReference Include="Serilog.Settings.Configuration" Version="9.0.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="6.0.0" />
<PackageReference Include="Serilog.Sinks.ExceptionLess" Version="5.0.0" />
<PackageReference Include="YamlDotNet" Version="16.2.1" />
Expand Down
8 changes: 4 additions & 4 deletions src/Exceptionless.Job/Exceptionless.Job.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@
<PackageReference Include="Exceptionless.AspNetCore" Version="6.0.4" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks" Version="9.0.0" />
<PackageReference Include="App.Metrics.AspNetCore" Version="4.3.0" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.3" />
<PackageReference Include="Serilog.AspNetCore" Version="9.0.0" />
<PackageReference Include="Serilog.Enrichers.Span" Version="3.1.0" />
<PackageReference Include="Serilog.Enrichers.Environment" Version="3.0.1" />

<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.10.0" />
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.10.0" />
<PackageReference Include="OpenTelemetry.Exporter.Prometheus.AspNetCore" Version="1.10.0-beta.1" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.10.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.10.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.10.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.StackExchangeRedis" Version="1.9.0-beta.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.StackExchangeRedis" Version="1.10.0-beta.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.ElasticsearchClient" Version="1.0.0-beta.5" />
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.10.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.Process" Version="0.5.0-beta.7" />
<PackageReference Include="OpenTelemetry.Instrumentation.Process" Version="1.10.0-beta.1" />
</ItemGroup>

<ItemGroup Label="Transitive dependency updates to resolve vulnerability warnings">
Expand Down
12 changes: 6 additions & 6 deletions src/Exceptionless.Web/Exceptionless.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,22 @@
<PackageReference Include="MiniValidation" Version="0.9.1" />
<PackageReference Include="NEST.JsonNetSerializer" Version="7.17.5" />
<PackageReference Include="OAuth2" Version="0.10.3" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.1.0" />
<PackageReference Include="Serilog.AspNetCore" Version="8.0.3" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="7.2.0" />
<PackageReference Include="Serilog.AspNetCore" Version="9.0.0" />
<PackageReference Include="Serilog.Enrichers.Span" Version="3.1.0" />
<PackageReference Include="Serilog.Enrichers.Environment" Version="3.0.1" />

<PackageReference Include="OpenTelemetry.Exporter.OpenTelemetryProtocol" Version="1.10.0" />
<PackageReference Include="OpenTelemetry.Exporter.Console" Version="1.10.0" />
<PackageReference Include="OpenTelemetry.Exporter.Prometheus.AspNetCore" Version="1.10.0-beta.1" />
<PackageReference Include="OpenTelemetry.Extensions.Hosting" Version="1.10.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.9.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.AspNetCore" Version="1.10.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.Http" Version="1.10.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.StackExchangeRedis" Version="1.9.0-beta.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.StackExchangeRedis" Version="1.10.0-beta.1" />
<PackageReference Include="OpenTelemetry.Instrumentation.ElasticsearchClient" Version="1.0.0-beta.5" />
<PackageReference Include="OpenTelemetry.Instrumentation.Runtime" Version="1.10.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.Process" Version="0.5.0-beta.7" />
<PackageReference Include="Swashbuckle.AspNetCore.Newtonsoft" Version="7.1.0" />
<PackageReference Include="OpenTelemetry.Instrumentation.Process" Version="1.10.0-beta.1" />
<PackageReference Include="Swashbuckle.AspNetCore.Newtonsoft" Version="7.2.0" />
<PackageReference Include="Unchase.Swashbuckle.AspNetCore.Extensions" Version="2.7.1" />
</ItemGroup>
<ItemGroup Label="Transitive dependency updates to resolve vulnerability warnings">
Expand Down
3 changes: 2 additions & 1 deletion src/Exceptionless.Web/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,8 @@ ApplicationException applicationException when applicationException.Message.Cont
{
o.EnrichDiagnosticContext = (context, httpContext) =>
{
context.Set("ActivityId", Activity.Current?.Id);
if (Activity.Current?.Id is not null)
context.Set("ActivityId", Activity.Current.Id);
};
o.MessageTemplate = "{ActivityId} HTTP {RequestMethod} {RequestPath} responded {StatusCode} in {Elapsed:0.0000} ms";
o.GetLevel = (context, duration, ex) =>
Expand Down
23 changes: 7 additions & 16 deletions tests/Exceptionless.Tests/AspireWebHostFactory.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using Aspire.Hosting;
using Aspire.Hosting.ApplicationModel;
using Aspire.Hosting.Testing;
using Exceptionless.Insulation.Configuration;
using Exceptionless.Web;
using Microsoft.AspNetCore.Mvc.Testing;
Expand All @@ -15,30 +14,22 @@ public class AspireWebHostFactory : WebApplicationFactory<Startup>, IAsyncLifeti

public DistributedApplication App => _app ?? throw new InvalidOperationException("The application is not initialized");

public string? ElasticsearchConnectionString { get; private set; }
public string? RedisConnectionString { get; private set; }

public async Task InitializeAsync()
public Task InitializeAsync()
{
var options = new DistributedApplicationOptions { AssemblyName = typeof(ElasticsearchResource).Assembly.FullName, DisableDashboard = true };
var builder = DistributedApplication.CreateBuilder(options);

builder.AddElasticsearch("Elasticsearch")
.WithContainerName("Exceptionless-Elasticsearch-Test")
// don't use random ports for tests
builder.Configuration["DcpPublisher:RandomizePorts"] = "false";

builder.AddElasticsearch("Elasticsearch", port: 9200)
.WithContainerName("Exceptionless-Elasticsearch")
.WithImageTag("8.17.0")
.WithLifetime(ContainerLifetime.Persistent);

builder.AddRedis("Redis")
.WithContainerName("Exceptionless-Redis-Test")
.WithImageTag("7.4")
.WithLifetime(ContainerLifetime.Persistent);;

_app = builder.Build();

await _app.StartAsync();

ElasticsearchConnectionString = await _app.GetConnectionStringAsync("Elasticsearch");
RedisConnectionString = await _app.GetConnectionStringAsync("Redis");
return _app.StartAsync();
}

protected override void ConfigureWebHost(IWebHostBuilder builder)
Expand Down
Loading

0 comments on commit 213332f

Please sign in to comment.