Skip to content
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

Replace ADO tests with GitHub actions #2855

Merged
merged 42 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
c54a9f3
simple test
davidmrdavid Jun 18, 2024
727aff9
add this branch for tests
davidmrdavid Jun 18, 2024
aa04a2a
add test step
davidmrdavid Jun 18, 2024
7eb6c48
refactor services
davidmrdavid Jun 18, 2024
974ec95
add azurite step
davidmrdavid Jun 18, 2024
832d6d8
add .net core app 3.1
davidmrdavid Jun 18, 2024
f5af936
add .net core 2.1
davidmrdavid Jun 18, 2024
25deebd
change azurite to install via npm
davidmrdavid Jun 18, 2024
1765f80
add worker runtime
davidmrdavid Jun 18, 2024
0f762e9
add azstoragge env var
davidmrdavid Jun 18, 2024
17a69ae
speified queue port
davidmrdavid Jun 18, 2024
509f4e7
add azurite ports
davidmrdavid Jun 18, 2024
b43df47
start azurite and run tests
davidmrdavid Jun 18, 2024
975702b
install emulator
davidmrdavid Jun 18, 2024
7159630
install emulator early
davidmrdavid Jun 18, 2024
27fe08d
do not install emulator quietly
davidmrdavid Jun 18, 2024
4cebccd
filter tests more aggressively
davidmrdavid Jun 18, 2024
8e89a47
make azurite silent
davidmrdavid Jun 19, 2024
7749dc3
specify singular test
davidmrdavid Jun 19, 2024
4a3d39c
remove warnings, refine tests
davidmrdavid Jun 19, 2024
1a9b6e3
remove typo
davidmrdavid Jun 19, 2024
6e1a7f8
fix some issues
davidmrdavid Jun 19, 2024
4da2645
remove filter
davidmrdavid Jun 19, 2024
aa0a5d1
check clean entity test
davidmrdavid Jun 19, 2024
0e1bc4c
fix some tests, and warnings
davidmrdavid Jun 19, 2024
0fade5a
fix warnings, allow more tests
davidmrdavid Jun 19, 2024
6432f5d
run test
davidmrdavid Jun 19, 2024
585e4a6
stabilize tests
davidmrdavid Jun 19, 2024
124b252
remove write line
davidmrdavid Jun 19, 2024
cdfedd6
remove filter
davidmrdavid Jun 19, 2024
cd4420b
remove end to end tests, for now
davidmrdavid Jun 19, 2024
513b682
trying to fix e2e tests namespace
davidmrdavid Jun 19, 2024
709b97f
add parallel e2e tests
davidmrdavid Jun 19, 2024
b445671
fix filter
davidmrdavid Jun 19, 2024
d2fc409
remove clean entity storage test (for now)
davidmrdavid Jun 19, 2024
a6aedce
remove clean entity storage test (for now)
davidmrdavid Jun 19, 2024
c08bc71
clean up
davidmrdavid Jun 19, 2024
1009f6e
add analyzer tests and worker extension tests
davidmrdavid Jun 19, 2024
d4e5665
clean up
davidmrdavid Jun 19, 2024
2f63ea3
fix indentation
davidmrdavid Jun 19, 2024
5f04a9e
remove commented out
davidmrdavid Jun 19, 2024
3495f67
removing test branch
davidmrdavid Jun 19, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions .github/workflows/validate-build-analyzer.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Validate Build (analyzer)

on:
push:
branches:
- main
paths-ignore: [ '**.md' ]
pull_request:
branches:
- main
paths-ignore: [ '**.md' ]

env:
solution: WebJobs.Extensions.DurableTask.sln
config: Release
AzureWebJobsStorage: UseDevelopmentStorage=true

jobs:
build:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3
with:
submodules: true

- name: Setup .NET
uses: actions/setup-dotnet@v3

- name: Set up .NET Core 3.1
uses: actions/setup-dotnet@v3
with:
dotnet-version: '3.1.x'

- name: Set up .NET Core 2.1
uses: actions/setup-dotnet@v3
with:
dotnet-version: '2.1.x'

- name: Restore dependencies
run: dotnet restore $solution

- name: Build
run: dotnet build $solution

# Install Azurite
- name: Set up Node.js (needed for Azurite)
uses: actions/setup-node@v3
with:
node-version: '18.x' # Azurite requires at least Node 18

- name: Install Azurite
run: npm install -g azurite

# Run tests
- name: Run Analyzer tests
run: azurite --silent --blobPort 10000 --queuePort 10001 --tablePort 10002 & dotnet test ./test/WebJobs.Extensions.DurableTask.Analyzers.Test/WebJobs.Extensions.DurableTask.Analyzers.Test.csproj

60 changes: 60 additions & 0 deletions .github/workflows/validate-build-e2e.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Validate Build (E2E tests)

on:
push:
branches:
- main
paths-ignore: [ '**.md' ]
pull_request:
branches:
- main
paths-ignore: [ '**.md' ]

env:
solution: WebJobs.Extensions.DurableTask.sln
config: Release
AzureWebJobsStorage: UseDevelopmentStorage=true

jobs:
build:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3
with:
submodules: true

- name: Setup .NET
uses: actions/setup-dotnet@v3

- name: Set up .NET Core 3.1
uses: actions/setup-dotnet@v3
with:
dotnet-version: '3.1.x'

- name: Set up .NET Core 2.1
uses: actions/setup-dotnet@v3
with:
dotnet-version: '2.1.x'

- name: Restore dependencies
run: dotnet restore $solution

- name: Build
run: dotnet build $solution

# Install Azurite
- name: Set up Node.js (needed for Azurite)
uses: actions/setup-node@v3
with:
node-version: '18.x' # Azurite requires at least Node 18

- name: Install Azurite
run: npm install -g azurite

# Run tests
- name: Run FunctionsV2 tests (only DurableEntity_CleanEntityStorage test, which is flaky)
run: azurite --silent --blobPort 10000 --queuePort 10001 --tablePort 10002 & dotnet test ./test/FunctionsV2/WebJobs.Extensions.DurableTask.Tests.V2.csproj --filter "FullyQualifiedName~Microsoft.Azure.WebJobs.Extensions.DurableTask.Tests.DurableTaskEndToEndTests.DurableEntity_CleanEntityStorage"
bachuv marked this conversation as resolved.
Show resolved Hide resolved

- name: Run FunctionsV2 tests (all other E2E tests)
run: azurite --silent --blobPort 10000 --queuePort 10001 --tablePort 10002 & dotnet test ./test/FunctionsV2/WebJobs.Extensions.DurableTask.Tests.V2.csproj --filter "FullyQualifiedName~Microsoft.Azure.WebJobs.Extensions.DurableTask.Tests.DurableTaskEndToEndTests&FullyQualifiedName!~Microsoft.Azure.WebJobs.Extensions.DurableTask.Tests.DurableTaskEndToEndTests.DurableEntity_CleanEntityStorage"
61 changes: 61 additions & 0 deletions .github/workflows/validate-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Validate Build (except E2E tests)

on:
push:
branches:
- main
paths-ignore: [ '**.md' ]
pull_request:
branches:
- main
paths-ignore: [ '**.md' ]

env:
solution: WebJobs.Extensions.DurableTask.sln
config: Release
AzureWebJobsStorage: UseDevelopmentStorage=true

jobs:
build:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3
with:
submodules: true

- name: Setup .NET
uses: actions/setup-dotnet@v3

- name: Set up .NET Core 3.1
uses: actions/setup-dotnet@v3
with:
dotnet-version: '3.1.x'

- name: Set up .NET Core 2.1
uses: actions/setup-dotnet@v3
with:
dotnet-version: '2.1.x'

- name: Restore dependencies
run: dotnet restore $solution

- name: Build
run: dotnet build $solution

# Install Azurite
- name: Set up Node.js (needed for Azurite)
uses: actions/setup-node@v3
with:
node-version: '18.x' # Azurite requires at least Node 18

- name: Install Azurite
run: npm install -g azurite

# Run tests
- name: Run FunctionsV2 tests (except E2E tests)
run: azurite --silent --blobPort 10000 --queuePort 10001 --tablePort 10002 & dotnet test ./test/FunctionsV2/WebJobs.Extensions.DurableTask.Tests.V2.csproj --filter "FullyQualifiedName!~Microsoft.Azure.WebJobs.Extensions.DurableTask.Tests.DurableTaskEndToEndTests"

- name: Run Worker Extension tests
run: azurite --silent --blobPort 10000 --queuePort 10001 --tablePort 10002 & dotnet test ./test/Worker.Extensions.DurableTask.Tests/Worker.Extensions.DurableTask.Tests.csproj

Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<TargetFramework>netstandard2.0</TargetFramework>
<IncludeBuildOutput>false</IncludeBuildOutput>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<NoWarn>RS1026</NoWarn> <!-- Disable 'Enable concurrent execution' warning until we investigate if it's safe to enable-->
</PropertyGroup>

<PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
<Compile Include="**/*.cs" Exclude="Auth/*.cs;Correlation/*.cs;**/obj/**/*.cs" />
<!-- Don't increase below versions without significantly testing on Functions V1!
Increasing these versions increments some dependencies that have binding redirects in Functions V1. -->
<PackageReference Include="Azure.Identity" Version="1.1.1" />
<PackageReference Include="Azure.Identity" Version="1.1.1" NoWarn="NU1902,NU1903"/> <!-- Added NoWarn as this dependency cannot be dropped due to Functions V1-->
<PackageReference Include="Microsoft.Azure.WebJobs" Version="2.3.0" />
<PackageReference Include="Microsoft.Extensions.Options" Version="1.0.2" />
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="1.0.2" />
Expand Down
5 changes: 4 additions & 1 deletion test/Common/DurableTaskEndToEndTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -746,6 +746,9 @@ await TestHelpers.WaitUntilTrue(
conditionDescription: "Log file exists",
timeout: TimeSpan.FromSeconds(30));

// add a minute wait to ensure logs are fully written
await Task.Delay(TimeSpan.FromMinutes(1));

Comment on lines +749 to +751
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

more buffer time to account for GH action slowness

await TestHelpers.WaitUntilTrue(
predicate: () =>
{
Expand Down Expand Up @@ -4299,7 +4302,7 @@ public async Task DurableEntity_EntityProxy_NameResolve(bool extendedSessions)
}

/// <summary>
/// Test which validates that entity state deserialization
/// Test which validates that entity state deserialization.
/// </summary>
[Theory]
[InlineData(true)]
Expand Down
2 changes: 1 addition & 1 deletion test/Common/TestDurableClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public async Task<DurableOrchestrationStatus> WaitForCompletionAsync(
{
if (timeout == null)
{
timeout = Debugger.IsAttached ? TimeSpan.FromMinutes(5) : TimeSpan.FromSeconds(30);
timeout = Debugger.IsAttached ? TimeSpan.FromMinutes(5) : TimeSpan.FromMinutes(1);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

GitHub actions + Azurite seems to run tests more slowly, so I added more buffer time

}

Stopwatch sw = Stopwatch.StartNew();
Expand Down
2 changes: 1 addition & 1 deletion test/Common/TestHelpers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
using DurableTask.AzureStorage;
using Microsoft.ApplicationInsights.Channel;
#if !FUNCTIONS_V1
using Microsoft.Extensions.Hosting;
using Microsoft.Azure.WebJobs.Host.Scale;
using Microsoft.Extensions.Hosting;
#endif
using Microsoft.Azure.WebJobs.Host.TestCommon;
using Microsoft.Extensions.Logging;
Expand Down
14 changes: 3 additions & 11 deletions test/FunctionsV2/CorrelationEndToEndTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ internal async Task<Tuple<List<OperationTelemetry>, List<ExceptionTelemetry>>>
[InlineData(false, true, true)]
[InlineData(true, true, false)]
[InlineData(true, true, true)]
public async void TelemetryClientSetup_AppInsights_Warnings(bool instrumentationKeyIsSet, bool connStringIsSet, bool extendedSessions)
public void TelemetryClientSetup_AppInsights_Warnings(bool instrumentationKeyIsSet, bool connStringIsSet, bool extendedSessions)
{
TraceOptions traceOptions = new TraceOptions()
{
Expand All @@ -258,11 +258,11 @@ public async void TelemetryClientSetup_AppInsights_Warnings(bool instrumentation
}
else if (instrumentationKeyIsSet)
{
mockNameResolver = GetNameResolverMock(new[] { (instKeyEnvVarName, environmentVariableValue), (connStringEnvVarName, String.Empty) });
mockNameResolver = GetNameResolverMock(new[] { (instKeyEnvVarName, environmentVariableValue), (connStringEnvVarName, string.Empty) });
}
else if (connStringIsSet)
{
mockNameResolver = GetNameResolverMock(new[] { (instKeyEnvVarName, String.Empty), (connStringEnvVarName, connStringValue) });
mockNameResolver = GetNameResolverMock(new[] { (instKeyEnvVarName, string.Empty), (connStringEnvVarName, connStringValue) });
}

using (var host = TestHelpers.GetJobHost(
Expand Down Expand Up @@ -405,14 +405,6 @@ private static List<OperationTelemetry> GetCorrelationSortedList(OperationTeleme
var result = new List<OperationTelemetry>();
if (current.Count != 0)
{
foreach (var some in current)
{
if (parent.Id == some.Context.Operation.ParentId)
{
Console.WriteLine("match");
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

writing to console in GitHub actions is flakey and can cause runtime errors. So I removed this, which was only there for debugging purposes

}
}

IOrderedEnumerable<OperationTelemetry> nexts = current.Where(p => p.Context.Operation.ParentId == parent.Id).OrderBy(p => p.Timestamp.Ticks);
foreach (OperationTelemetry next in nexts)
{
Expand Down
3 changes: 3 additions & 0 deletions test/FunctionsV2/OutOfProcTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -342,6 +342,7 @@ public async Task TestLocalRcpEndpointRuntimeVersion(string runtimeVersion, bool
// Validate if we opened local RPC endpoint by looking at log statements.
var logger = this.loggerProvider.CreatedLoggers.Single(l => l.Category == TestHelpers.LogCategory);
var logMessages = logger.LogMessages.ToList();

bool enabledRpcEndpoint = logMessages.Any(msg => msg.Level == Microsoft.Extensions.Logging.LogLevel.Information && msg.FormattedMessage.StartsWith($"Opened local {expectedProtocol} endpoint:"));

Assert.Equal(enabledExpected, enabledRpcEndpoint);
Expand All @@ -363,13 +364,15 @@ public async Task InvokeLocalRpcEndpoint()
{
await host.StartAsync();

#pragma warning disable SYSLIB0014 // Type or member is obsolete
using (var client = new WebClient())
{
string jsonString = client.DownloadString("http://localhost:17071/durabletask/instances");

// The result is expected to be an empty array
JArray array = JArray.Parse(jsonString);
}
#pragma warning restore SYSLIB0014 // Type or member is obsolete

await host.StopAsync();
}
Expand Down
3 changes: 2 additions & 1 deletion test/FunctionsV2/PlatformSpecificHelpers.FunctionsV2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,6 @@ private static IWebJobsBuilder AddEmulatorDurableTask(this IWebJobsBuilder build

internal class FunctionsV2HostWrapper : ITestHost
{
internal readonly IHost InnerHost;
private readonly JobHost innerWebJobsHost;
private readonly DurableTaskOptions options;
private readonly INameResolver nameResolver;
Expand All @@ -255,6 +254,8 @@ internal FunctionsV2HostWrapper(
this.options = options.Value;
}

internal IHost InnerHost { get; private set; }

Comment on lines +257 to +258
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this resolves a build warning

public Task CallAsync(string methodName, IDictionary<string, object> args)
=> this.innerWebJobsHost.CallAsync(methodName, args);

Expand Down
1 change: 0 additions & 1 deletion test/SmokeTests/SmokeTestsV1/VSSampleV1.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
<ItemGroup>
<PackageReference Include="Microsoft.NET.Sdk.Functions" Version="1.0.30" />
<PackageReference Include="Microsoft.Azure.WebJobs" Version="2.3.0" />
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

inherited from WebJobs project

</ItemGroup>
<ItemGroup>
<None Update="host.json">
Expand Down
Loading