Skip to content

Commit 6b043f3

Browse files
committed
2 parents 083c4c9 + 3bb0445 commit 6b043f3

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

test/OpenTelemetry.Instrumentation.StackExchangeRedis.Tests/Implementation/RedisProfilerEntryToActivityConverterTests.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ public void ProfilerCommandToActivity_UsesIpEndPointAsEndPoint()
131131
var activity = new Activity("redis-profiler");
132132
IPEndPoint ipLocalEndPoint = new IPEndPoint(address, port);
133133
var profiledCommand = new Mock<IProfiledCommand>();
134+
profiledCommand.Setup(m => m.CommandCreated).Returns(DateTime.UtcNow);
134135
profiledCommand.Setup(m => m.EndPoint).Returns(ipLocalEndPoint);
135136

136137
var result = RedisProfilerEntryToActivityConverter.ProfilerCommandToActivity(activity, profiledCommand.Object);
@@ -148,6 +149,7 @@ public void ProfilerCommandToActivity_UsesDnsEndPointAsEndPoint()
148149

149150
var activity = new Activity("redis-profiler");
150151
var profiledCommand = new Mock<IProfiledCommand>();
152+
profiledCommand.Setup(m => m.CommandCreated).Returns(DateTime.UtcNow);
151153
profiledCommand.Setup(m => m.EndPoint).Returns(dnsEndPoint);
152154

153155
var result = RedisProfilerEntryToActivityConverter.ProfilerCommandToActivity(activity, profiledCommand.Object);
@@ -165,6 +167,7 @@ public void ProfilerCommandToActivity_UsesOtherEndPointAsEndPoint()
165167
var unixEndPoint = new UnixDomainSocketEndPoint("https://opentelemetry.io/");
166168
var activity = new Activity("redis-profiler");
167169
var profiledCommand = new Mock<IProfiledCommand>();
170+
profiledCommand.Setup(m => m.CommandCreated).Returns(DateTime.UtcNow);
168171
profiledCommand.Setup(m => m.EndPoint).Returns(unixEndPoint);
169172

170173
var result = RedisProfilerEntryToActivityConverter.ProfilerCommandToActivity(activity, profiledCommand.Object);

test/OpenTelemetry.Tests/Logs/LogRecordTest.cs

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
using System;
2222
using System.Collections.Generic;
2323
using System.Diagnostics;
24+
using System.Globalization;
2425
using System.Linq;
2526
using Microsoft.Extensions.Logging;
2627
using OpenTelemetry.Exporter;
@@ -213,7 +214,16 @@ public void CheckStateForStrucutredLogWithGeneralType()
213214
Assert.Contains(state, item => item.Key == "{OriginalFormat}");
214215
Assert.Equal("{food}", state.First(item => item.Key == "{OriginalFormat}").Value);
215216

216-
Assert.Equal("[Name, truffle], [Price, 299.99]", state.ToString());
217+
var prevCulture = CultureInfo.CurrentCulture;
218+
CultureInfo.CurrentCulture = CultureInfo.InvariantCulture;
219+
try
220+
{
221+
Assert.Equal("[Name, truffle], [Price, 299.99]", state.ToString());
222+
}
223+
finally
224+
{
225+
CultureInfo.CurrentCulture = prevCulture;
226+
}
217227
}
218228

219229
[Fact]

0 commit comments

Comments
 (0)