-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Storage] Parallelize live tests. (#17454)
Fixes: #6905 In this PR: - introduce LiveParallizable attribute. - changed scope of DiagosticScopeInterceptor as it's not thread safe, see: - https://dev.azure.com/azure-sdk/internal/_build/results?buildId=649697&view=results - https://dev.azure.com/azure-sdk/internal/_build/results?buildId=649767&view=results
- Loading branch information
1 parent
fa69c26
commit 1041c99
Showing
8 changed files
with
177 additions
and
149 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
sdk/core/Azure.Core.TestFramework/src/LiveParallelizableAttribute.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using System; | ||
using NUnit.Framework; | ||
|
||
namespace Azure.Core.TestFramework | ||
{ | ||
/// <summary> | ||
/// Attribute on test assemblies, classes, or methods that defines parallelization behavior when tests are run in <see cref="RecordedTestMode.Live"/> mode. | ||
/// In other modes it will enforce no parallelization. | ||
/// </summary> | ||
[AttributeUsage( AttributeTargets.Assembly | AttributeTargets.Class | AttributeTargets.Method, AllowMultiple=false, Inherited=true )] | ||
public class LiveParallelizableAttribute : ParallelizableAttribute | ||
{ | ||
public LiveParallelizableAttribute(ParallelScope scope) : base(ApplyModeToParallelScope(scope)) | ||
{ | ||
} | ||
|
||
private static ParallelScope ApplyModeToParallelScope(ParallelScope scope) | ||
{ | ||
RecordedTestMode mode = RecordedTestUtilities.GetModeFromEnvironment(); | ||
return mode == RecordedTestMode.Live ? scope : ParallelScope.None; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
140 changes: 69 additions & 71 deletions
140
...Storage.Blobs/tests/SessionRecords/BlockBlobClientTests/SyncUploadFromUriAsync_Lease.json
Large diffs are not rendered by default.
Oops, something went wrong.
140 changes: 69 additions & 71 deletions
140
...ge.Blobs/tests/SessionRecords/BlockBlobClientTests/SyncUploadFromUriAsync_LeaseAsync.json
Large diffs are not rendered by default.
Oops, something went wrong.
5 changes: 2 additions & 3 deletions
5
sdk/storage/Azure.Storage.Common/tests/Shared/AssemblyInfo.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
// Copyright (c) Microsoft Corporation. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using Azure.Core.TestFramework; | ||
using NUnit.Framework; | ||
|
||
// TODO: Look into writing a custom Parallelizable attribute that will run | ||
// sequentially for record/playback but let us run in parallel for live tests. | ||
// [assembly: Parallelizable(ParallelScope.Children)] | ||
[assembly: LiveParallelizable(ParallelScope.Fixtures)] | ||
|
||
// Set per-test timeout to 20 minutes to prevent a single test from hanging the whole suite | ||
[assembly: NUnit.Framework.Timeout(20 * 60 * 1000)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters