Skip to content

Commit

Permalink
[repo] Bump test dependencies (#1872)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kielek authored Jun 12, 2024
1 parent e456b23 commit cfda172
Show file tree
Hide file tree
Showing 42 changed files with 142 additions and 167 deletions.
6 changes: 3 additions & 3 deletions build/Common.nonprod.props
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@
<OpenTelemetryExporterInMemoryPkgVer>$(OpenTelemetryCoreLatestVersion)</OpenTelemetryExporterInMemoryPkgVer>
<OpenTelemetryExporterInMemoryLatestPreReleasePkgVer>$(OpenTelemetryCoreLatestPrereleaseVersion)</OpenTelemetryExporterInMemoryLatestPreReleasePkgVer>
<SupportedNetTargets>net8.0;net7.0;net6.0</SupportedNetTargets>
<XUnitRunnerVisualStudioPkgVer>[2.5.0,3.0)</XUnitRunnerVisualStudioPkgVer>
<XUnitPkgVer>[2.5.0,3.0)</XUnitPkgVer>
<WiremockNetPkgVer>[1.5.48,2.0)</WiremockNetPkgVer>
<XUnitRunnerVisualStudioPkgVer>[2.8.1,3.0)</XUnitRunnerVisualStudioPkgVer>
<XUnitPkgVer>[2.8.1,3.0)</XUnitPkgVer>
<WiremockNetPkgVer>[1.5.58,2.0)</WiremockNetPkgVer>
</PropertyGroup>

<ItemGroup Condition="'$(IsTestProject)' == 'true'">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public class HangfireInstrumentationOptions

/// <summary>
/// Gets or sets a filter function that determines whether or not to
/// collect telemetry about the the <see cref="BackgroundJob"/> being executed.
/// collect telemetry about the <see cref="BackgroundJob"/> being executed.
/// </summary>
/// <remarks>
/// <b>Notes:</b>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ public class ActivityInstrumentationHelperTest
[Theory]
[InlineData("TestActivitySource", null)]
[InlineData("TestActivitySource", "1.0.0")]
public void SetActivitySource(string name, string version)
public void SetActivitySource(string name, string? version)
{
using var activity = new Activity("Test");
using var activitySource = new ActivitySource(name, version);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1520,8 +1520,8 @@ private void AssertFluentdForwardModeForLogRecord(GenevaExporterOptions exporter
}
else
{
_ = mapping.TryGetValue("env_properties", out object envProprties);
var envPropertiesMapping = envProprties as IDictionary<object, object>;
_ = mapping.TryGetValue("env_properties", out object envProperties);
var envPropertiesMapping = envProperties as IDictionary<object, object>;

foreach (var item in stateKeyValuePairList)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public void CannotUseReservedDimensionsInPrepopulatedFields()
}

[Fact]
public void SuccessfulExportOnLinux()
public async Task SuccessfulExportOnLinux()
{
if (!RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
Expand Down Expand Up @@ -198,7 +198,7 @@ public void SuccessfulExportOnLinux()
out _);

// Wait a little more than the ExportInterval for the exporter to export the data.
Task.Delay(5500).Wait();
await Task.Delay(5500);

// Read the data sent via socket.
var receivedData = new byte[1024];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -686,8 +686,8 @@ private void AssertFluentdForwardModeForActivity(GenevaExporterOptions exporterO
#endregion

#region Assert Activity Tags
_ = mapping.TryGetValue("env_properties", out object envProprties);
var envPropertiesMapping = envProprties as IDictionary<object, object>;
_ = mapping.TryGetValue("env_properties", out object envProperties);
var envPropertiesMapping = envProperties as IDictionary<object, object>;
foreach (var tag in activity.TagObjects)
{
if (CS40_PART_B_MAPPING.TryGetValue(tag.Key, out string replacementKey))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public async Task AddTraceEnricherOfTRegistersEnricher()
.AddTraceEnricher<MyTraceEnricher2>())
.Build();

await host.StartAsync().ConfigureAwait(false);
await host.StartAsync();

var enrichers = host.Services.GetServices<TraceEnricher>().ToArray();
Assert.NotNull(enrichers);
Expand Down Expand Up @@ -61,7 +61,7 @@ public async Task AddTraceEnricherOfTRegistersEnricher()
Assert.Equal(1, tagObject2.Single().Value);
}

await host.StopAsync().ConfigureAwait(false);
await host.StopAsync();
}

[Fact]
Expand All @@ -80,7 +80,7 @@ public async Task AddTraceEnricherRegistersEnricher()
.AddTraceEnricher(new MyTraceEnricher2()))
.Build();

await host.StartAsync().ConfigureAwait(false);
await host.StartAsync();

var enrichers = host.Services.GetServices<TraceEnricher>().ToArray();
Assert.NotNull(enrichers);
Expand All @@ -102,7 +102,7 @@ public async Task AddTraceEnricherRegistersEnricher()
Assert.Equal(1, tagObject2.Single().Value);
}

await host.StopAsync().ConfigureAwait(false);
await host.StopAsync();
}

[Fact]
Expand All @@ -126,7 +126,7 @@ public async Task AddTraceEnricherActionRegistersEnricher()
.AddTraceEnricher(bag => bag.Add(testKey2, testValue2)))
.Build();

await host.StartAsync().ConfigureAwait(false);
await host.StartAsync();

using var source1 = new ActivitySource(SourceName);

Expand Down Expand Up @@ -162,7 +162,7 @@ public async Task AddTraceEnricherFactoryRegistersEnricher()
.AddTraceEnricher(sp => new MyTraceEnricher2()))
.Build();

await host.StartAsync().ConfigureAwait(false);
await host.StartAsync();

var enrichers = host.Services.GetServices<TraceEnricher>().ToArray();
Assert.NotNull(enrichers);
Expand All @@ -184,6 +184,6 @@ public async Task AddTraceEnricherFactoryRegistersEnricher()
Assert.Equal(1, tagObject2.Single().Value);
}

await host.StopAsync().ConfigureAwait(false);
await host.StopAsync();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@ namespace OpenTelemetry.Instrumentation.AWS.Tests;
public class TestAWSClientInstrumentation
{
[Fact]
#if NETFRAMEWORK
public void TestDDBScanSuccessful()
#else
public async Task TestDDBScanSuccessful()
#endif
{
var exportedItems = new List<Activity>();

Expand All @@ -46,7 +50,7 @@ public void TestDDBScanSuccessful()
#if NETFRAMEWORK
ddb.Scan(scan_request);
#else
ddb.ScanAsync(scan_request).Wait();
await ddb.ScanAsync(scan_request);
#endif
Assert.Single(exportedItems);

Expand All @@ -61,7 +65,11 @@ public void TestDDBScanSuccessful()
}

[Fact]
#if NETFRAMEWORK
public void TestDDBSubtypeScanSuccessful()
#else
public async Task TestDDBSubtypeScanSuccessful()
#endif
{
var exportedItems = new List<Activity>();

Expand All @@ -85,7 +93,7 @@ public void TestDDBSubtypeScanSuccessful()
#if NETFRAMEWORK
ddb.Scan(scan_request);
#else
ddb.ScanAsync(scan_request).Wait();
await ddb.ScanAsync(scan_request);
#endif
Assert.Single(exportedItems);

Expand Down Expand Up @@ -154,7 +162,11 @@ public async Task TestDDBScanUnsuccessful()
}

[Fact]
#if NETFRAMEWORK
public void TestSQSSendMessageSuccessful()
#else
public async Task TestSQSSendMessageSuccessful()
#endif
{
var exportedItems = new List<Activity>();

Expand All @@ -178,7 +190,7 @@ public void TestSQSSendMessageSuccessful()
#if NETFRAMEWORK
sqs.SendMessage(send_msg_req);
#else
sqs.SendMessageAsync(send_msg_req).Wait();
await sqs.SendMessageAsync(send_msg_req);
#endif
Assert.Single(exportedItems);
Activity awssdk_activity = exportedItems[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public void SetHttpTagsFromResult_APIGatewayHttpApiV2ProxyResponse_SetsCorrectTa
[InlineData(null, "localhost", "localhost", null)]
[InlineData("http", "localhost", "localhost", 80)]
[InlineData("https", "localhost", "localhost", 443)]
public void GetHostAndPort_HostHeader_ReturnsCorrectHostAndPort(string httpSchema, string hostHeader, string expectedHost, int? expectedPort)
public void GetHostAndPort_HostHeader_ReturnsCorrectHostAndPort(string? httpSchema, string? hostHeader, string? expectedHost, int? expectedPort)
{
(var host, var port) = AWSLambdaHttpUtils.GetHostAndPort(httpSchema, hostHeader);

Expand All @@ -244,7 +244,7 @@ public void GetHostAndPort_HostHeader_ReturnsCorrectHostAndPort(string httpSchem
[InlineData(new[] { "value 1" }, "?name=value+1")]
[InlineData(new[] { "value1", "value2" }, "?name=value1&name=value2")]
#pragma warning restore CA1861 // Avoid constant arrays as arguments
public void GetQueryString_APIGatewayProxyRequest_CorrectQueryString(IList<string> values, string expectedQueryString)
public void GetQueryString_APIGatewayProxyRequest_CorrectQueryString(IList<string>? values, string expectedQueryString)
{
var request = new APIGatewayProxyRequest();
if (values != null)
Expand All @@ -265,7 +265,7 @@ public void GetQueryString_APIGatewayProxyRequest_CorrectQueryString(IList<strin
[InlineData("", "")]
[InlineData("name=value1", "?name=value1")]
[InlineData("sdckj9_+", "?sdckj9_+")]
public void GetQueryString_APIGatewayHttpApiV2ProxyRequest_CorrectQueryString(string rawQueryString, string expectedQueryString)
public void GetQueryString_APIGatewayHttpApiV2ProxyRequest_CorrectQueryString(string? rawQueryString, string expectedQueryString)
{
var request = new APIGatewayHttpApiV2ProxyRequest
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class CommonExtensionsTests
[InlineData("test")]
[InlineData(443)]
[InlineData(null)]
public void AddTagIfNotNull_Tag_CorrectTagsList(object tag)
public void AddTagIfNotNull_Tag_CorrectTagsList(object? tag)
{
var tags = new List<KeyValuePair<string, object>>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public async Task Can_Restore_Activity()
});
}

await testTask.ConfigureAwait(false);
await testTask;
}

[Fact(Skip = "Temporarily disable until stable.")]
Expand Down Expand Up @@ -120,7 +120,7 @@ public async Task Can_Restore_Baggage()
});
}

await testTask.ConfigureAwait(false);
await testTask;
}

[Fact]
Expand Down Expand Up @@ -401,7 +401,7 @@ public void Can_Create_RootActivity_And_Start_Activity()
using var rootActivity = ActivityHelper.StartAspNetActivity(this.noopTextMapPropagator, context, null);

Assert.NotNull(rootActivity);
Assert.True(!string.IsNullOrEmpty(rootActivity.Id));
Assert.False(string.IsNullOrEmpty(rootActivity.Id));
}

[Fact]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void AspNetRequestsAreCollectedSuccessfully(
string url,
string expectedUrlScheme,
string expectedUrlPath,
string expectedUrlQuery,
string? expectedUrlQuery,
bool disableQueryRedaction,
string expectedHost,
int expectedPort,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,11 @@ public class HttpInMetricsListenerTests
public void AspNetMetricTagsAreCollectedSuccessfully(
string url,
int routeType,
string routeTemplate,
string enrichMode,
string? routeTemplate,
string? enrichMode,
string expectedScheme,
string? expectedHost,
string expectedRoute,
string? expectedRoute,
int? expectedPort,
int expectedStatus,
bool enableServerAttributesForRequestDuration = true)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -646,7 +646,7 @@ void ConfigureTestServices(IServiceCollection services)
[InlineData("POST", "POST", null, "POST")]
[InlineData("TRACE", "TRACE", null, "TRACE")]
[InlineData("CUSTOM", "_OTHER", "CUSTOM", "HTTP")]
public async Task HttpRequestMethodAndActivityDisplayIsSetAsPerSpec(string originalMethod, string expectedMethod, string expectedOriginalMethod, string expectedDisplayName)
public async Task HttpRequestMethodAndActivityDisplayIsSetAsPerSpec(string originalMethod, string expectedMethod, string? expectedOriginalMethod, string expectedDisplayName)
{
var exportedItems = new List<Activity>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public DependencyInjectionConfigTests(WebApplicationFactory<Program> factory)
[Theory]
[InlineData(null)]
[InlineData("CustomName")]
public void TestTracingOptionsDIConfig(string name)
public void TestTracingOptionsDIConfig(string? name)
{
name ??= Options.DefaultName;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ public IncomingRequestsCollectionsIsAccordingToTheSpecTests(WebApplicationFactor
[InlineData("/api/exception", null, null, 503, true)]
public async Task SuccessfulTemplateControllerCallGeneratesASpan_New(
string urlPath,
string query,
string userAgent,
string? query,
string? userAgent,
int statusCode,
bool recordException = false)
{
Expand Down Expand Up @@ -130,7 +130,7 @@ public async Task SuccessfulTemplateControllerCallGeneratesASpan_New(
activity.Dispose();
}

private static void ValidateTagValue(Activity activity, string attribute, string expectedValue)
private static void ValidateTagValue(Activity activity, string attribute, string? expectedValue)
{
if (string.IsNullOrEmpty(expectedValue))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ void ConfigureTestServices(IServiceCollection services)
[Theory]
[InlineData("/api/values/2", "api/Values/{id}", null, 200)]
[InlineData("/api/Error", "api/Error", "System.Exception", 500)]
public async Task RequestMetricIsCaptured(string api, string expectedRoute, string expectedErrorType, int expectedStatusCode)
public async Task RequestMetricIsCaptured(string api, string expectedRoute, string? expectedErrorType, int expectedStatusCode)
{
var metricItems = new List<Metric>();

Expand Down Expand Up @@ -312,7 +312,7 @@ public void Dispose()
private static List<MetricPoint> GetMetricPoints(Metric metric)
{
Assert.NotNull(metric);
Assert.True(metric.MetricType == MetricType.Histogram);
Assert.Equal(MetricType.Histogram, metric.MetricType);
var metricPoints = new List<MetricPoint>();
foreach (var p in metric.GetMetricPoints())
{
Expand All @@ -325,7 +325,7 @@ private static List<MetricPoint> GetMetricPoints(Metric metric)
private static void AssertMetricPoints(
List<MetricPoint> metricPoints,
List<string> expectedRoutes,
string expectedErrorType,
string? expectedErrorType,
int expectedStatusCode,
int expectedTagsCount)
{
Expand Down Expand Up @@ -360,7 +360,7 @@ private static void AssertMetricPoint(
MetricPoint metricPoint,
int expectedStatusCode,
string expectedRoute,
string expectedErrorType,
string? expectedErrorType,
int expectedTagsCount)
{
var count = metricPoint.GetHistogramCount();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public class DependencyInjectionConfigTests
[Theory]
[InlineData(null)]
[InlineData("CustomName")]
public async Task TestTracingOptionsDiConfig(string name)
public async Task TestTracingOptionsDiConfig(string? name)
{
bool optionsPickedFromDi = false;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ public void EventSourceNameShortening(string sourceName, string eventName, strin
}

[Fact(Skip = "This test should properly validate no metrics are exported from event counters with invalid names (too long)")]
public void InstrumentNameTooLong()
public async Task InstrumentNameTooLong()
{
// Arrange
List<Metric> metricItems = new();
Expand All @@ -190,7 +190,7 @@ public void InstrumentNameTooLong()
// Act
connections.Increment(1);

Task.Delay(1800).Wait();
await Task.Delay(1800);
meterProvider.ForceFlush();

// Assert
Expand Down
Loading

0 comments on commit cfda172

Please sign in to comment.