mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-02-18 08:17:43 +01:00
* Update aspire to 13.1 (examples + code) Allows usage of aspire CLI which is very useful for dev in codespaces (for my next PR). * Add OTEL support * Initial PR feedback * PR feedback * PR feedback * PR feedback * Cleanup. * Cleanup * Fix * Fix * Rename stuff around to be more accurate * PR feedback * Update WireMock.Net.OpenTelemetry.csproj Update <Authors> * PR feedback parser * PR feedback package versions * Status code feedback. * Update preprocessor directives to to Activity Tracing instead of OpenTelemetry. Is more descriptive. * Add tests * Improve tests --------- Co-authored-by: Stef Heyenrath <Stef.Heyenrath@gmail.com>
43 lines
1.1 KiB
C#
43 lines
1.1 KiB
C#
// Copyright © WireMock.Net
|
|
|
|
#if NET6_0_OR_GREATER
|
|
using System;
|
|
using FluentAssertions;
|
|
using WireMock.OpenTelemetry;
|
|
using Xunit;
|
|
|
|
namespace WireMock.Net.Tests.OpenTelemetry;
|
|
|
|
public class OpenTelemetryOptionsParserTests
|
|
{
|
|
[Fact]
|
|
public void TryParseArguments_Enabled_ShouldReturnOptions()
|
|
{
|
|
// Act
|
|
var result = OpenTelemetryOptionsParser.TryParseArguments(new[]
|
|
{
|
|
"--OpenTelemetryEnabled", "true",
|
|
"--OpenTelemetryExcludeAdminRequests", "false",
|
|
"--OpenTelemetryOtlpExporterEndpoint", "http://localhost:4317"
|
|
}, null, out var options);
|
|
|
|
// Assert
|
|
result.Should().BeTrue();
|
|
options.Should().NotBeNull();
|
|
options!.ExcludeAdminRequests.Should().BeFalse();
|
|
options.OtlpExporterEndpoint.Should().Be("http://localhost:4317");
|
|
}
|
|
|
|
[Fact]
|
|
public void TryParseArguments_NotEnabled_ShouldReturnNull()
|
|
{
|
|
// Act
|
|
var result = OpenTelemetryOptionsParser.TryParseArguments(Array.Empty<string>(), null, out var options);
|
|
|
|
// Assert
|
|
result.Should().BeTrue();
|
|
options.Should().BeNull();
|
|
}
|
|
}
|
|
#endif
|