-
Notifications
You must be signed in to change notification settings - Fork 297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add 1ES CI for DTFx.AS v2 #1139
Changes from 9 commits
6807f98
7bbfb20
5341508
dd49cf6
4bc59ce
b2bd2f9
bc9a5ea
aa77bd5
56984ce
eef1d03
b45e013
5b7b1d8
aa060c2
941decc
1e1275d
15f44df
1c0c4d2
b1eec32
345fc27
e791819
01ba1b2
896fcc5
5df3df2
dd7c604
f1b0f72
de3761a
4bf3039
2e7d199
1dda1ab
be16e51
cb72151
1f56a2d
bd915ec
4d4dda0
275b3dd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,6 +39,7 @@ | |
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="2.2.0" /> | ||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> | ||
<PackageReference Include="System.Diagnostics.DiagnosticSource" Version="5.0.1" /> | ||
<PackageReference Include="System.Runtime.CompilerServices.Unsafe" Version="6.0.0" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If we are going v3 with DTFx, I think we should try and just upgrade some packages here:
See if that fixes your problem There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, maybe that's it. I'll try to diagnostics source change first, that could be it There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No luck with just upgrading DiagnosticsSource -> https://dev.azure.com/azfunc/public/_build/results?buildId=173059&view=ms.vss-test-web.build-test-results-tab . Let me try to rev the logging abstractions package as well next There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Still no luck that failed too -> https://dev.azure.com/azfunc/public/_build/results?buildId=173069&view=ms.vss-test-web.build-test-results-tab I'll keep the packages on the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I increased the |
||
<PackageReference Include="System.Reactive.Core" Version="4.4.1" /> | ||
<PackageReference Include="System.Reactive.Compatibility" Version="4.4.1" /> | ||
<PackageReference Include="Castle.Core" Version="5.0.0" /> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2252,6 +2252,7 @@ await Task.WhenAll( | |
/// End-to-end test which validates a simple orchestrator function that calls an activity function | ||
/// and checks the OpenTelemetry trace information | ||
/// </summary> | ||
[TestCategory("DisabledInCI")] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. these disabled tests have not been running for a long time, and they're failing in the main branch as well. They weren't running because they're conditionally compiled not to run in NET462, and our previous testing task in ADO was configured to run tests found in the Now, the test task does discover these tests, but I've disabled them as they aren't passing. @bachuv can you please add this as a To-Fix before Dist. Tracing GA? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I'll add this task to the list. |
||
[DataTestMethod] | ||
[DataRow(true)] | ||
[DataRow(false)] | ||
|
@@ -2344,6 +2345,7 @@ public async Task OpenTelemetry_SayHelloWithActivity(bool enableExtendedSessions | |
/// End-to-end test which validates a simple orchestrator function that waits for an external event | ||
/// raised through the RaiseEvent API and checks the OpenTelemetry trace information | ||
/// </summary> | ||
[TestCategory("DisabledInCI")] | ||
[DataTestMethod] | ||
[DataRow(true)] | ||
[DataRow(false)] | ||
|
@@ -2445,6 +2447,7 @@ public async Task OpenTelemetry_ExternalEvent_RaiseEvent(bool enableExtendedSess | |
/// End-to-end test which validates a simple orchestrator function that waits for an external event | ||
/// raised by calling SendEvent and checks the OpenTelemetry trace information | ||
/// </summary> | ||
[TestCategory("DisabledInCI")] | ||
[DataTestMethod] | ||
[DataRow(true)] | ||
[DataRow(false)] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,28 +5,31 @@ | |
<TargetFrameworks>netcoreapp3.1;net462</TargetFrameworks> | ||
</PropertyGroup> | ||
|
||
|
||
<ItemGroup Condition="'$(TargetFramework)' == 'net462'"> | ||
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.2.0" /> | ||
<PackageReference Include="Microsoft.WindowsAzure.ConfigurationManager" version="3.2.1" /> | ||
<PackageReference Include="WindowsAzure.Storage" version="8.7.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup Condition="'$(TargetFramework)' != 'net462'"> | ||
<PackageReference Include="Azure.Monitor.OpenTelemetry.Exporter" Version="1.0.0-beta.3" /> | ||
<PackageReference Include="Microsoft.Extensions.Logging" Version="3.1.6" /> | ||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. newtonsoft.json is inherited by the DTFx.Core project |
||
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.5.0" /> | ||
<PackageReference Include="WindowsAzure.Storage" version="9.3.3" /> | ||
</ItemGroup> | ||
|
||
<!-- Common package dependencies --> | ||
<ItemGroup> | ||
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.2.0" /> | ||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.2.0" /> | ||
Comment on lines
+21
to
+22
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 2.2.0 is quite old. Can we standardize to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I had some issues getting the code to build on 1ES with more recent versions. I'm open to upgrading, but since this is the test project, I'd like to push that to be a separate PR. |
||
<PackageReference Include="Microsoft.ApplicationInsights.DependencyCollector" Version="2.12.0" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.10.0" /> | ||
<PackageReference Include="MSTest.TestAdapter" Version="1.4.0" /> | ||
<PackageReference Include="MSTest.TestFramework" Version="1.4.0" /> | ||
<PackageReference Include="Moq" Version="4.10.0" /> | ||
|
||
<!-- We don't really make use of these dependencies, but 1ES somehow detects them in our test project and flags them for update. | ||
Since this is just a test project, and to prevent "warning fatigue" so real CVEs stand out, we choose to upgrade the dependency explicitly to remove the false alarm.--> | ||
<PackageReference Include="System.Data.SqlClient" Version="4.8.6" /> <!-- Version 4.3.1 was detected by default--> | ||
<PackageReference Include="Microsoft.Data.Services.Client" Version="5.8.4" /> <!-- Without this, we resolve Microsoft.Data.OData 5.8.2, which is flagged--> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
|
@@ -48,9 +51,6 @@ | |
<None Update="large.jpeg"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</None> | ||
<None Update="testhost.dll.config" Condition="'$(TargetFramework)' == 'netcoreapp2.1'"> | ||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> | ||
</None> | ||
Comment on lines
-51
to
-53
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we don't have a netcoreapp2.1 TFM |
||
</ItemGroup> | ||
|
||
</Project> |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,8 @@ public static TestOrchestrationHost GetTestOrchestrationHost( | |
{ | ||
string storageConnectionString = GetTestStorageAccountConnectionString(); | ||
|
||
// TODO: update Microsoft.Extensions.Logging to avoid the following warning suppression | ||
#pragma warning disable CS0618 // Type or member is obsolete | ||
var settings = new AzureStorageOrchestrationServiceSettings | ||
{ | ||
ExtendedSessionIdleTimeout = TimeSpan.FromSeconds(extendedSessionTimeoutInSeconds), | ||
|
@@ -40,9 +42,9 @@ public static TestOrchestrationHost GetTestOrchestrationHost( | |
TaskHubName = GetTestTaskHubName(), | ||
|
||
// Setting up a logger factory to enable the new DurableTask.Core logs | ||
// TODO: Add a logger provider so we can collect these logs in memory. | ||
LoggerFactory = new LoggerFactory(), | ||
LoggerFactory = new LoggerFactory().AddConsole(LogLevel.Trace), | ||
}; | ||
#pragma warning restore CS0618 // Type or member is obsolete | ||
Comment on lines
-43
to
+47
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. as mentioned, I've added logging to STDOUT on our tests to facilitate debugging. The current logging library we use is pretty old, which is why we have to disable the warning here. I tried using a newer library, but then had issues with the NET462 TFM. For speed, I decided to use the old library instead, which works. |
||
|
||
// Give the caller a chance to make test-specific changes to the settings | ||
modifySettingsAction?.Invoke(settings); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,8 @@ namespace DurableTask.Core.Tests | |
using DurableTask.Core.History; | ||
using DurableTask.Emulator; | ||
using DurableTask.Test.Orchestrations; | ||
using Microsoft.Extensions.Logging; | ||
using Microsoft.Extensions.Logging.Console; | ||
using Microsoft.VisualStudio.TestTools.UnitTesting; | ||
|
||
[TestClass] | ||
|
@@ -36,10 +38,17 @@ public class DispatcherMiddlewareTests | |
TaskHubClient client = null!; | ||
|
||
[TestInitialize] | ||
public async Task Initialize() | ||
public async Task InitializeTests() | ||
{ | ||
// configure logging so traces are emitted during tests. | ||
// This facilitates debugging when tests fail. | ||
|
||
// TODO: update Microsoft.Extensions.Logging to avoid the following warning suppression | ||
#pragma warning disable CS0618 // Type or member is obsolete | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we add comments here with reminders to update these dependencies? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, just did here -> bc9a5ea |
||
var loggerFactory = new LoggerFactory().AddConsole(LogLevel.Trace); | ||
#pragma warning restore CS0618 // Type or member is obsolete | ||
var service = new LocalOrchestrationService(); | ||
this.worker = new TaskHubWorker(service); | ||
this.worker = new TaskHubWorker(service, loggerFactory); | ||
|
||
await this.worker | ||
.AddTaskOrchestrations(typeof(SimplestGreetingsOrchestration), typeof(ParentWorkflow), typeof(ChildWorkflow)) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,19 +5,13 @@ | |
<TargetFrameworks>netcoreapp3.1;net462</TargetFrameworks> | ||
</PropertyGroup> | ||
|
||
<ItemGroup Condition="'$(TargetFramework)' == 'net462'"> | ||
<PackageReference Include="EnterpriseLibrary.SemanticLogging.EventSourceAnalyzer" Version="2.0.1406.1" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" /> | ||
<PackageReference Include="MSTest.TestAdapter" Version="1.4.0" /> | ||
<PackageReference Include="MSTest.TestFramework" Version="1.4.0" /> | ||
</ItemGroup> | ||
|
||
Comment on lines
-8
to
-14
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there was no reason for separate dependencies anymore |
||
<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp3.1'"> | ||
<ItemGroup> | ||
<PackageReference Include="EnterpriseLibrary.SemanticLogging.EventSourceAnalyzer.NetCore" Version="2.0.1406.4" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.9.0" /> | ||
<PackageReference Include="MSTest.TestAdapter" Version="1.4.0" /> | ||
<PackageReference Include="MSTest.TestFramework" Version="1.4.0" /> | ||
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" /> | ||
<PackageReference Include="Microsoft.Extensions.Logging" Version="2.2.0" /> | ||
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="2.2.0" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,7 @@ public async Task Invoke_WithFailingRetryCall_ShouldThrowCorrectException() | |
await Assert.ThrowsExceptionAsync<IOException>(Invoke, "Interceptor should throw the original exception after exceeding max retry attempts."); | ||
} | ||
|
||
[TestMethod] | ||
[DataTestMethod] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this was throwing a warning. |
||
[DataRow(1)] | ||
[DataRow(2)] | ||
[DataRow(3)] | ||
|
@@ -59,7 +59,7 @@ public async Task Invoke_WithFailingRetryCall_ShouldHaveCorrectNumberOfCalls(int | |
Assert.AreEqual(maxAttempts, callCount, 0, $"There should be {maxAttempts} function calls for {maxAttempts} max attempts."); | ||
} | ||
|
||
[TestMethod] | ||
[DataTestMethod] | ||
[DataRow(1)] | ||
[DataRow(2)] | ||
[DataRow(3)] | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,8 +7,8 @@ | |
|
||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.7.1" /> | ||
<PackageReference Include="MSTest.TestAdapter" Version="3.1.1" /> | ||
<PackageReference Include="MSTest.TestFramework" Version="3.1.1" /> | ||
<PackageReference Include="MSTest.TestAdapter" Version="1.4.0" /> | ||
<PackageReference Include="MSTest.TestFramework" Version="1.4.0" /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We have an inconsistent use of MSTest, some use version 1.4.0 and others use versoin 3.1.1. The use of different frameworks led to warnings. I've downgraded to the common denominator, as I encountered issues upgrading them all to 3.1.1 (can't remember which unfortunately). |
||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
|
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -409,6 +409,11 @@ public async override Task<string> RunTask(OrchestrationContext context, bool us | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
responderOrchestration = Task.FromResult("Herkimer is done"); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// before sending the event, wait a few seconds to ensure the sub-orchestrator exists | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// otherwise, we risk a race condition where the event is dicarded because the instances table | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// does not yet have the sub-orchestrator instance in it. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
await context.CreateTimer<object>(context.CurrentUtcDateTime.AddSeconds(10), state: null); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+412
to
+416
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this test suddenly became flaky. So added this to make it less flakey There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the right thing to do given the timeline we're working with, but I'm curious to better understand why this particular pattern isn't working reliably. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think I know the root cause - if the ExternalEvent arrives before the ExecutionStarted event, then the durabletask/src/DurableTask.AzureStorage/AzureStorageOrchestrationService.cs Lines 1038 to 1060 in d4b98d4
So we return "no such instance" as seen above, and we end up discarding the message as it is for an instanceID that never existed. That code is here: durabletask/src/DurableTask.AzureStorage/AzureStorageOrchestrationService.cs Lines 782 to 836 in d4b98d4
To be clear, the piece where we end up sending external events to the discard list is this particular section: durabletask/src/DurableTask.AzureStorage/AzureStorageOrchestrationService.cs Lines 801 to 810 in d4b98d4
So it's an ordering issue. In theory, I think we could be more conservative and not discard events immediately, but that can creating poison messages. Please let me know if I'm missing something. |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// send the id of this orchestration to the responder | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
var responderInstance = new OrchestrationInstance() { InstanceId = responderId }; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
context.SendEvent(responderInstance, channelName, context.OrchestrationInstance.InstanceId); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain the changes that were made in this file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. So previously I had:
As you can see, everything below
testAssemblyVer2
is at the same level indentation. That's an issue, sincetestFiltercriteria
and the params below are not an input totestAssemblyVer2
, instead they're properties that are supposed to be at the same level. So I've indented them back/out so that they're properly parsed by 1ES.So now I have something equivalent to this (notice the indent)