Skip to content

Commit b9dd313

Browse files
authored
Make certain tests sequential to prevent conflicts (#3071)
1 parent bb01165 commit b9dd313

File tree

4 files changed

+19
-9
lines changed

4 files changed

+19
-9
lines changed

test/e2e/Tests/Constants.cs

+1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,5 @@ internal class Constants
1212
internal static readonly string FunctionsHostUrl = Configuration["FunctionAppUrl"] ?? "http://localhost:7071";
1313

1414
internal const string FunctionAppCollectionName = "DurableTestsCollection";
15+
internal const string FunctionAppCollectionSequentialName = "DurableTestsCollectionSequential";
1516
}

test/e2e/Tests/Fixtures/FunctionAppFixture.cs

+9
Original file line numberDiff line numberDiff line change
@@ -164,3 +164,12 @@ public class FunctionAppCollection : ICollectionFixture<FunctionAppFixture>
164164
// to be the place to apply [CollectionDefinition] and all the
165165
// ICollectionFixture<> interfaces.
166166
}
167+
168+
169+
[CollectionDefinition(Constants.FunctionAppCollectionSequentialName, DisableParallelization = true)]
170+
public class FunctionAppCollectionSequential : ICollectionFixture<FunctionAppFixture>
171+
{
172+
// This class has no code, and is never created. Its purpose is simply
173+
// to be the place to apply [CollectionDefinition] and all the
174+
// ICollectionFixture<> interfaces.
175+
}

test/e2e/Tests/Tests/OrchestrationQueryTests.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
namespace Microsoft.Azure.Durable.Tests.DotnetIsolatedE2E;
1010

11-
[Collection(Constants.FunctionAppCollectionName)]
11+
[Collection(Constants.FunctionAppCollectionSequentialName)]
1212
public class OrchestrationQueryTests
1313
{
1414
private readonly FunctionAppFixture _fixture;

test/e2e/Tests/Tests/PurgeInstancesTests.cs

+8-8
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
1-
using System;
2-
using System.Collections.Generic;
3-
using System.Linq;
4-
using System.Net;
5-
using System.Text;
6-
using System.Text.RegularExpressions;
7-
using System.Threading.Tasks;
1+
using System.Net;
82
using Xunit;
93
using Xunit.Abstractions;
104

115
namespace Microsoft.Azure.Durable.Tests.DotnetIsolatedE2E;
126

13-
[Collection(Constants.FunctionAppCollectionName)]
7+
[Collection(Constants.FunctionAppCollectionSequentialName)]
148
public class PurgeInstancesTests
159
{
1610
private readonly FunctionAppFixture _fixture;
@@ -95,6 +89,12 @@ public async Task PurgeOrchestrationHistoryAfterInvocation_Succeeds()
9589
[Trait("DTS", "Skip")] // Skip this test as there is a bug with current DTS backend, the createdTimeTo couldn't be null.
9690
public async Task PurgeAfterPurge_ZeroRows()
9791
{
92+
using HttpResponseMessage response = await HttpHelpers.InvokeHttpTrigger("HelloCities_HttpStart", "");
93+
Assert.Equal(HttpStatusCode.Accepted, response.StatusCode);
94+
string statusQueryGetUri = await DurableHelpers.ParseStatusQueryGetUriAsync(response);
95+
96+
await DurableHelpers.WaitForOrchestrationStateAsync(statusQueryGetUri, "Completed", 30);
97+
9898
DateTime purgeEndTime = DateTime.UtcNow + TimeSpan.FromMinutes(1);
9999
using HttpResponseMessage purgeResponse = await HttpHelpers.InvokeHttpTrigger("PurgeOrchestrationHistory", $"?purgeEndTime={purgeEndTime:o}");
100100
string purgeMessage = await purgeResponse.Content.ReadAsStringAsync();

0 commit comments

Comments
 (0)