Closed aspnet-hello closed 5 years ago
This comment was made automatically. If there is a problem contact ryanbrandenburg.
Please use this workflow to address this flaky test issue, including checking applicable checkboxes and filling in the applicable "TODO" entries:
Is this actually a flaky test?
Is this test failure caused by product code flakiness? (Either this product, or another product this test depends on.)
Is it that the test itself is flaky? This includes external transient problems (e.g. remote server problems, file system race condition, etc.)
This comment was made automatically. If there is a problem contact ryanbrandenburg.
There were 1 failures with about the same error on master at 1:50:55 PM:
There were 2 failures with about the same error on master at 1:50:55 PM:
There were 2 failures with about the same error on master at 1:50:55 PM:
There were 2 failures with about the same error on master at 1:51:12 PM:
This comment was made automatically. If there is a problem contact ryanbrandenburg.
There were 2 failures with about the same error on master at 1:50:55 PM:
There were 2 failures with about the same error on master at 1:50:54 PM:
There were 2 failures with about the same error on master at 1:50:54 PM:
There were 2 failures with about the same error on master at 4:29:07 PM:
There were 2 failures with about the same error on master at 4:29:05 PM:
There were 2 failures with about the same error on master at 3:38:37 PM:
There were 2 failures with about the same error on master at 4:29:54 PM:
There were 2 failures with about the same error on master at 4:52:01 PM:
There were 2 failures with about the same error on master at 4:59:15 PM:
There were 2 failures with about the same error on master at 4:57:20 PM:
There were 2 failures with about the same error on master at 12:21:33 PM:
There were 2 failures with about the same error on master at 12:21:33 PM:
There were 2 failures with about the same error on master at 2:07:13 PM:
There were 2 failures with about the same error on master at 12:21:26 PM:
There were 2 failures with about the same error on master at 2:07:16 PM:
There were 2 failures with about the same error on master at 12:21:30 PM:
There were 2 failures with about the same error on master at 12:21:31 PM:
There were 2 failures with about the same error on master at 12:21:31 PM:
There were 2 failures with about the same error on master at 2:07:10 PM:
@HaoK please investigate.
Weird this isn't failing for me locally in master, but its definitely failing on all ci builds right now, @ajcvickers has anything changed in EF recently? The submodules updated before these tests started failing were:
EntityFrameworkCore => 647aed13836f1f4f0d3c3d7f6a9a0165826e3e6a
Logging => cc90113f450182d472ae155767ff388fc92698e8
Mvc => 13cf754425c6120ac0b062dd51da2b89ac161dc2
Razor => 4d44639a51643223d5eb4ca317e201845c79d0c3
Okay so something has regressed that has caused the logging mocks to fail @BrennanConroy has something changed in logging recently?
This mock logger code hasn't changed since 1.0 probably, but it appears to no longer get called from a log warning:
// Actual log code which is indeed getting hit:
Logger.LogWarning(3, "User {userId} is currently locked out.", await UserManager.GetUserIdAsync(user));
// Mock code which is no longer getting invoked which is recording calls to a string
public static Mock<ILogger<T>> MockILogger<T>(StringBuilder logStore = null) where T : class
{
logStore = logStore ?? LogMessage;
var logger = new Mock<ILogger<T>>();
logger.Setup(x => x.Log(It.IsAny<LogLevel>(), It.IsAny<EventId>(), It.IsAny<object>(),
It.IsAny<Exception>(), It.IsAny<Func<object, Exception, string>>()))
.Callback((LogLevel logLevel, EventId eventId, object state, Exception exception, Func<object, Exception, string> formatter) =>
{
if (formatter == null)
{
logStore.Append(state.ToString());
}
else
{
logStore.Append(formatter(state, exception));
}
logStore.Append(" ");
});
logger.Setup(x => x.BeginScope(It.IsAny<object>())).Callback((object state) =>
{
logStore.Append(state.ToString());
logStore.Append(" ");
});
logger.Setup(x => x.IsEnabled(LogLevel.Debug)).Returns(true);
logger.Setup(x => x.IsEnabled(LogLevel.Warning)).Returns(true);
return logger;
}
We started using structs as TState in ILogger.Log() and logger.Setup(x => x.Log(It.IsAny<LogLevel>(), It.IsAny<EventId>(), It.IsAny<object>(),
doesn't get invoked when T
is struct.
I've fixed this for kestrel: https://github.com/aspnet/KestrelHttpServer/pull/3066
@pakrym Isn't this a breaking change?
In what way?
@ajcvickers are you ok if I just remove this mocking entirely? There is limited value in verifying these log messages, we already have tests verifying that the proper results are being returned, and we are only checking it in 5 tests anyways
There is a great alternative to mocking - LoggedTest
base class that not only provides TestSink with the list of all messages logged but also forwards them to xunit test output.
For example this is how kestrel asserts log messages: https://github.com/aspnet/KestrelHttpServer/blob/d29e410b035a3fe7db0d4625ee37cd6cb76e40d3/test/Kestrel.Transport.FunctionalTests/RequestTests.cs#L684
@HaoK I'm fine with that. I was just concerned the production code consuming logs might be assuming that TState is not a struct and breaking in the same way. If that's not a worry, then no problem.
It's somewhat possible, but it was the entire purpose of having TState was to be able to pass structs without boxing. Seems like an safe enough change for 3.0 milestone.
cc @Eilon
Oh, if this if for 3.0 then no problem at all. :-)
This comment was made automatically. If there is a problem contact ryanbrandenburg.
There were 2 failures with about the same error on master at 3:03:03 PM:
There were 2 failures with about the same error on master at 3:24:32 PM:
There were 2 failures with about the same error on master at 3:32:40 PM:
There were 2 failures with about the same error on master at 3:29:02 PM:
This issue was made automatically. If there is a problem contact ryanbrandenburg.
This test failed with the following error:
Other tests within that build may have failed with a similar message, but they are not listed here. Check the link above for more info.
This test failed on master.
CC Eilon