You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error
Expected 9 to be greater or equal to: 10
Expected: True
Actual: False
Stacktrace
at Elastic.Apm.Tests.ApiTests.ConvenientApiTransactionTests.AssertWith1TransactionAsync(Func`2 func) in /var/lib/jenkins/workspace/tnet_apm-agent-dotnet-mbp_master/src/github.com/elastic/apm-agent-dotnet/test/Elastic.Apm.Tests/ApiTests/ConvenientApiTransactionTests.cs:line 487
at Elastic.Apm.Tests.ApiTests.ConvenientApiTransactionTests.AsyncTaskWithReturnType() in /var/lib/jenkins/workspace/tnet_apm-agent-dotnet-mbp_master/src/github.com/elastic/apm-agent-dotnet/test/Elastic.Apm.Tests/ApiTests/ConvenientApiTransactionTests.cs:line 265
--- End of stack trace from previous location where exception was thrown ---
This is the assert:
var duration = payloadSender.FirstTransaction.Duration;
Assert.True(duration >= SleepLength, $"Expected {duration} to be greater or equal to: {SleepLength}");
This is how we calculate the duration (very very bad!): if (!Duration.HasValue) Duration = (long)(DateTimeOffset.UtcNow - Start).TotalMilliseconds;
We have a little bit of a data type chaos here and we should heavily overthink this! - also we should see what datatypes other agents use for duration and probably stick with that, but each time we convert we should be more careful.
The text was updated successfully, but these errors were encountered:
The Duration on ITransaction is a long, but the Duration on the ISpan is a double. This was clearly not intentional. The java agent uses double and the .TotalMilliseconds is also a double, so we stick to double for duration in the .NET Agent.
The other problem is that we use 10ms for these tests, but that's probably lower than the resolution of the timer used by await Task.Delay(), so it's impossible to await exactly 10ms (it can be 9,5ms). https://stackoverflow.com/a/31742754/1783306To solve this I'll increase the waits to 20ms (I think 15ms is the resolution). Due to this inaccuracy we enable 10% error in the tests. More on Fix failing API tests - again #104
We have sometimes failing tests like this:
This is the assert:
This is how we calculate the duration (very very bad!):
if (!Duration.HasValue) Duration = (long)(DateTimeOffset.UtcNow - Start).TotalMilliseconds;
We have a little bit of a data type chaos here and we should heavily overthink this! - also we should see what datatypes other agents use for duration and probably stick with that, but each time we convert we should be more careful.
The text was updated successfully, but these errors were encountered: