mirror of
https://github.com/wiremock/WireMock.Net.git
synced 2026-04-23 17:28:55 +02:00
Add OTEL tracing support for Wiremock + automatic OTEL for Aspire integration (#1418)
* 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>
This commit is contained in:
@@ -112,6 +112,23 @@ public class SimpleSettingsParserTests
|
||||
Check.That(value3).IsEqualTo(true);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SimpleCommandLineParser_Parse_GetBoolWithDefault()
|
||||
{
|
||||
// Assign
|
||||
_parser.Parse(new[] { "--test1", "true", "--test2", "false" });
|
||||
|
||||
// Act
|
||||
bool value1 = _parser.GetBoolWithDefault("test1", "test1_fallback", defaultValue: false);
|
||||
bool value2 = _parser.GetBoolWithDefault("missing", "test2", defaultValue: true);
|
||||
bool value3 = _parser.GetBoolWithDefault("missing1", "missing2", defaultValue: true);
|
||||
|
||||
// Assert
|
||||
Check.That(value1).IsEqualTo(true);
|
||||
Check.That(value2).IsEqualTo(false);
|
||||
Check.That(value3).IsEqualTo(true);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SimpleCommandLineParser_Parse_Environment_GetBoolValue()
|
||||
{
|
||||
|
||||
@@ -34,4 +34,26 @@ public class WireMockServerSettingsParserTests
|
||||
settings.Should().NotBeNull();
|
||||
settings!.AdminPath.Should().Be("/__admin");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void TryParseArguments_With_ActivityTracingEnabled_ShouldParseOptions()
|
||||
{
|
||||
// Act
|
||||
var result = WireMockServerSettingsParser.TryParseArguments(new[]
|
||||
{
|
||||
"--ActivityTracingEnabled", "true",
|
||||
"--ActivityTracingExcludeAdminRequests", "false",
|
||||
"--ActivityTracingRecordRequestBody", "true",
|
||||
"--ActivityTracingRecordResponseBody", "true"
|
||||
}, null, out var settings);
|
||||
|
||||
// Assert
|
||||
result.Should().BeTrue();
|
||||
settings.Should().NotBeNull();
|
||||
settings!.ActivityTracingOptions.Should().NotBeNull();
|
||||
settings.ActivityTracingOptions!.ExcludeAdminRequests.Should().BeFalse();
|
||||
settings.ActivityTracingOptions.RecordRequestBody.Should().BeTrue();
|
||||
settings.ActivityTracingOptions.RecordResponseBody.Should().BeTrue();
|
||||
settings.ActivityTracingOptions.RecordMatchDetails.Should().BeTrue();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user