diff --git a/common/ManagementTestShared/Redesign/AddDeleteAfterTagPolicy.cs b/common/ManagementTestShared/Redesign/AddDeleteAfterTagPolicy.cs index 2bb784ce6be1b..de90854531c7b 100644 --- a/common/ManagementTestShared/Redesign/AddDeleteAfterTagPolicy.cs +++ b/common/ManagementTestShared/Redesign/AddDeleteAfterTagPolicy.cs @@ -10,6 +10,8 @@ using System.Text.Json; using System.Text.RegularExpressions; +#nullable disable + namespace Azure.ResourceManager.TestFramework { public class AddDeleteAfterTagPolicy : HttpPipelineSynchronousPolicy diff --git a/common/ManagementTestShared/Redesign/InheritanceCheckTests.cs b/common/ManagementTestShared/Redesign/InheritanceCheckTests.cs index f694b15b64ca5..f0f5bf6d02008 100644 --- a/common/ManagementTestShared/Redesign/InheritanceCheckTests.cs +++ b/common/ManagementTestShared/Redesign/InheritanceCheckTests.cs @@ -7,6 +7,8 @@ using System.Linq; using System.Reflection; +#nullable disable + namespace Azure.ResourceManager.TestFramework { public partial class InheritanceCheckTests diff --git a/common/ManagementTestShared/Redesign/ManagementMockingPatternTests.cs b/common/ManagementTestShared/Redesign/ManagementMockingPatternTests.cs index 16a918130d4a7..2508d5c3441c3 100644 --- a/common/ManagementTestShared/Redesign/ManagementMockingPatternTests.cs +++ b/common/ManagementTestShared/Redesign/ManagementMockingPatternTests.cs @@ -13,6 +13,8 @@ using System.Runtime.CompilerServices; using System.Threading.Tasks; +#nullable disable + namespace Azure.ResourceManager.TestFramework { public sealed class ManagementMockingPatternTests diff --git a/common/ManagementTestShared/Redesign/ManagementRecordedTestBase.cs b/common/ManagementTestShared/Redesign/ManagementRecordedTestBase.cs index fd41f5c64a2fa..595fa61d08660 100644 --- a/common/ManagementTestShared/Redesign/ManagementRecordedTestBase.cs +++ b/common/ManagementTestShared/Redesign/ManagementRecordedTestBase.cs @@ -13,6 +13,8 @@ using System.Reflection; using System.Threading.Tasks; +#nullable disable + namespace Azure.ResourceManager.TestFramework { public abstract class ManagementRecordedTestBase : RecordedTestBase diff --git a/common/ManagementTestShared/Redesign/MockTestEnvironment.cs b/common/ManagementTestShared/Redesign/MockTestEnvironment.cs index 30940a0ce2d61..32c8c993da543 100644 --- a/common/ManagementTestShared/Redesign/MockTestEnvironment.cs +++ b/common/ManagementTestShared/Redesign/MockTestEnvironment.cs @@ -5,6 +5,8 @@ using Azure.Core.TestFramework; using System; +#nullable disable + namespace Azure.ResourceManager.TestFramework { public class MockTestEnvironment : TestEnvironment diff --git a/common/ManagementTestShared/Redesign/ResponseNullFilterPolicy.cs b/common/ManagementTestShared/Redesign/ResponseNullFilterPolicy.cs index 308b13cbf3318..8d72b23ad97fb 100644 --- a/common/ManagementTestShared/Redesign/ResponseNullFilterPolicy.cs +++ b/common/ManagementTestShared/Redesign/ResponseNullFilterPolicy.cs @@ -7,6 +7,8 @@ using System.Text.Json; using System.Text.RegularExpressions; +#nullable disable + namespace Azure.ResourceManager.TestFramework { public class ResponseNullFilterPolicy : HttpPipelineSynchronousPolicy diff --git a/sdk/core/Azure.Core.TestFramework/src/Shared/TestClient.cs b/sdk/core/Azure.Core.TestFramework/src/Shared/TestClient.cs index 4d29b1715fd11..c20de1d9de0da 100644 --- a/sdk/core/Azure.Core.TestFramework/src/Shared/TestClient.cs +++ b/sdk/core/Azure.Core.TestFramework/src/Shared/TestClient.cs @@ -1,6 +1,8 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +#nullable disable + using System; using System.Threading; using System.Threading.Tasks; diff --git a/sdk/core/Azure.Core.TestFramework/src/TestEnvironment.cs b/sdk/core/Azure.Core.TestFramework/src/TestEnvironment.cs index 2d8606da5fd88..cde5e119a219b 100644 --- a/sdk/core/Azure.Core.TestFramework/src/TestEnvironment.cs +++ b/sdk/core/Azure.Core.TestFramework/src/TestEnvironment.cs @@ -206,7 +206,7 @@ public virtual TokenCredential Credential } else { - var clientSecret = ClientSecret; + var clientSecret = GetOptionalVariable("CLIENT_SECRET"); if (string.IsNullOrWhiteSpace(clientSecret)) { _credential = new DefaultAzureCredential( diff --git a/sdk/provisioning/Azure.Provisioning/assets.json b/sdk/provisioning/Azure.Provisioning/assets.json new file mode 100644 index 0000000000000..959e1dddc646b --- /dev/null +++ b/sdk/provisioning/Azure.Provisioning/assets.json @@ -0,0 +1,6 @@ +{ + "AssetsRepo": "Azure/azure-sdk-assets", + "AssetsRepoPrefixPath": "net", + "TagPrefix": "net/provisioning/Azure.Provisioning", + "Tag": "net/provisioning/Azure.Provisioning_bd30657e9a" +} \ No newline at end of file diff --git a/sdk/provisioning/Azure.Provisioning/tests/Azure.Provisioning.Tests.csproj b/sdk/provisioning/Azure.Provisioning/tests/Azure.Provisioning.Tests.csproj index 961469ea67ecb..014275f8ab5d6 100644 --- a/sdk/provisioning/Azure.Provisioning/tests/Azure.Provisioning.Tests.csproj +++ b/sdk/provisioning/Azure.Provisioning/tests/Azure.Provisioning.Tests.csproj @@ -3,18 +3,17 @@ $(RequiredTargetFrameworks) enable + true + true - - - - + + - - + diff --git a/sdk/provisioning/Azure.Provisioning/tests/ProvisioningTestEnvironment.cs b/sdk/provisioning/Azure.Provisioning/tests/ProvisioningTestEnvironment.cs new file mode 100644 index 0000000000000..2cf431aad539c --- /dev/null +++ b/sdk/provisioning/Azure.Provisioning/tests/ProvisioningTestEnvironment.cs @@ -0,0 +1,11 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core.TestFramework; + +namespace Azure.Provisioning.Tests +{ + public class ProvisioningTestEnvironment : TestEnvironment + { + } +} diff --git a/sdk/provisioning/Azure.Provisioning/tests/ProvisioningTests.cs b/sdk/provisioning/Azure.Provisioning/tests/ProvisioningTests.cs index fbd7aede04def..8c2d91ab0b1bc 100644 --- a/sdk/provisioning/Azure.Provisioning/tests/ProvisioningTests.cs +++ b/sdk/provisioning/Azure.Provisioning/tests/ProvisioningTests.cs @@ -24,14 +24,21 @@ using Azure.ResourceManager.Resources; using Azure.ResourceManager.Resources.Models; using Azure.ResourceManager.Storage.Models; +using Azure.ResourceManager.TestFramework; +using CoreTestEnvironment = Azure.Core.TestFramework.TestEnvironment; namespace Azure.Provisioning.Tests { - public class ProvisioningTests + [AsyncOnly] + public class ProvisioningTests : ManagementRecordedTestBase { + public ProvisioningTests(bool async) : base(async) + { + } + private static readonly string _infrastructureRoot = Path.Combine(GetGitRoot(), "sdk", "provisioning", "Azure.Provisioning", "tests", "Infrastructure"); - [Test] + [RecordedTest] public async Task WebSiteUsingL1() { var infra = new TestInfrastructure(); @@ -106,7 +113,7 @@ await ValidateBicepAsync(BinaryData.FromObjectAsJson( })); } - [Test] + [RecordedTest] public async Task ResourceGroupOnly() { TestInfrastructure infrastructure = new TestInfrastructure(); @@ -116,7 +123,7 @@ public async Task ResourceGroupOnly() await ValidateBicepAsync(); } - [Test] + [RecordedTest] public async Task SqlServerUsingAdminPassword() { TestInfrastructure infrastructure = new TestInfrastructure(configuration: new Configuration { UseInteractiveMode = true }); @@ -138,7 +145,7 @@ await ValidateBicepAsync( interactiveMode: true); } - [Test] + [RecordedTest] public async Task SqlServerUsingIdentity() { TestInfrastructure infrastructure = new TestInfrastructure(configuration: new Configuration { UseInteractiveMode = true }); @@ -165,7 +172,7 @@ await ValidateBicepAsync( interactiveMode: true); } - [Test] + [RecordedTest] public async Task SqlServerUsingHybrid() { TestInfrastructure infrastructure = new TestInfrastructure(configuration: new Configuration { UseInteractiveMode = true }); @@ -197,7 +204,7 @@ await ValidateBicepAsync( interactiveMode: true); } - [Test] + [RecordedTest] public async Task WebSiteUsingL2() { var infra = new TestInfrastructure(); @@ -219,7 +226,7 @@ await ValidateBicepAsync(BinaryData.FromObjectAsJson( })); } - [Test] + [RecordedTest] public async Task WebSiteUsingL3() { var infra = new TestInfrastructure(); @@ -243,7 +250,7 @@ await ValidateBicepAsync(BinaryData.FromObjectAsJson( })); } - [Test] + [RecordedTest] public async Task WebSiteUsingL3SpecificSubscription() { var infra = new TestInfrastructure(); @@ -266,7 +273,7 @@ await ValidateBicepAsync(BinaryData.FromObjectAsJson( })); } - [Test] + [RecordedTest] public async Task WebSiteUsingL3ResourceGroupScope() { var infra = new TestInfrastructure(scope: ConstructScope.ResourceGroup, configuration: new Configuration { UseInteractiveMode = true }); @@ -291,7 +298,7 @@ await ValidateBicepAsync(BinaryData.FromObjectAsJson( }), interactiveMode: true); } - [Test] + [RecordedTest] public async Task StorageBlobDefaults() { var infra = new TestInfrastructure(); @@ -302,7 +309,7 @@ public async Task StorageBlobDefaults() await ValidateBicepAsync(); } - [Test] + [RecordedTest] public async Task RoleAssignmentWithParameter() { var infra = new TestInfrastructure(configuration: new Configuration { UseInteractiveMode = true }); @@ -316,7 +323,7 @@ public async Task RoleAssignmentWithParameter() await ValidateBicepAsync(BinaryData.FromObjectAsJson(new { principalId = new { value = Guid.Empty }}), interactiveMode: true); } - [Test] + [RecordedTest] public async Task RoleAssignmentWithoutParameter() { var infra = new TestInfrastructure(); @@ -330,7 +337,7 @@ public async Task RoleAssignmentWithoutParameter() await ValidateBicepAsync(); } - [Test] + [RecordedTest] public async Task RoleAssignmentWithoutParameterInteractiveMode() { var infra = new TestInfrastructure(configuration: new Configuration { UseInteractiveMode = true }); @@ -344,7 +351,7 @@ public async Task RoleAssignmentWithoutParameterInteractiveMode() await ValidateBicepAsync(interactiveMode: true); } - [Test] + [RecordedTest] public void RoleAssignmentPrincipalMustBeSuppliedInNonInteractiveMode() { var infra = new TestInfrastructure(); @@ -354,7 +361,7 @@ public void RoleAssignmentPrincipalMustBeSuppliedInNonInteractiveMode() Assert.Throws(() => storageAccount.AssignRole(RoleDefinition.StorageBlobDataContributor)); } - [Test] + [RecordedTest] public async Task StorageBlobDefaultsInPromptMode() { var infra = new TestInfrastructure(configuration: new Configuration { UseInteractiveMode = true }); @@ -365,7 +372,7 @@ public async Task StorageBlobDefaultsInPromptMode() await ValidateBicepAsync(interactiveMode: true); } - [Test] + [RecordedTest] public async Task CanAddCustomLocationParameterInInteractiveMode() { var infra = new TestInfrastructure(configuration: new Configuration { UseInteractiveMode = true }); @@ -382,7 +389,7 @@ await ValidateBicepAsync(BinaryData.FromObjectAsJson( interactiveMode: true); } - [Test] + [RecordedTest] public async Task CanAssignParameterToMultipleResources() { var infra = new TestInfrastructure(); @@ -412,7 +419,7 @@ await ValidateBicepAsync(BinaryData.FromObjectAsJson( })); } - [Test] + [RecordedTest] public async Task StorageBlobDropDown() { var infra = new TestInfrastructure(); @@ -427,7 +434,7 @@ public async Task StorageBlobDropDown() await ValidateBicepAsync(); } - [Test] + [RecordedTest] public async Task AppConfiguration() { var infra = new TestInfrastructure(); @@ -437,7 +444,7 @@ public async Task AppConfiguration() await ValidateBicepAsync(); } - [Test] + [RecordedTest] public void MultipleSubscriptions() { // ensure deterministic subscription names and directories @@ -453,7 +460,7 @@ public void MultipleSubscriptions() // await ValidateBicepAsync(); } - [Test] + [RecordedTest] public async Task OutputsSpanningModules() { var infra = new TestInfrastructure(); @@ -487,22 +494,22 @@ public async Task OutputsSpanningModules() public async Task ValidateBicepAsync(BinaryData? parameters = null, bool interactiveMode = false) { - if (TestEnvironment.GlobalIsRunningInCI) + if (CoreTestEnvironment.GlobalIsRunningInCI) { return; } var testPath = Path.Combine(_infrastructureRoot, TestContext.CurrentContext.Test.Name); - var client = new ArmClient(new DefaultAzureCredential()); + var client = GetArmClient(); ResourceGroupResource? rg = null; - SubscriptionResource subscription = await client.GetSubscriptions().GetAsync(Environment.GetEnvironmentVariable("SUBSCRIPTION_ID")); + SubscriptionResource subscription = await client.GetSubscriptions().GetAsync(TestEnvironment.SubscriptionId); try { var bicepPath = Path.Combine(testPath, "main.bicep"); var args = Path.Combine( - TestEnvironment.RepositoryRoot, + CoreTestEnvironment.RepositoryRoot, "eng", "scripts", $"Validate-Bicep.ps1 {bicepPath}");