diff --git a/src/Synapse/Synapse.Test/ScenarioTests/ADOnlyAuthenticationTests.cs b/src/Synapse/Synapse.Test/ScenarioTests/ADOnlyAuthenticationTests.cs index 9f9721134b41..3b4e062dc3cb 100644 --- a/src/Synapse/Synapse.Test/ScenarioTests/ADOnlyAuthenticationTests.cs +++ b/src/Synapse/Synapse.Test/ScenarioTests/ADOnlyAuthenticationTests.cs @@ -15,35 +15,25 @@ namespace Microsoft.Azure.Commands.Synapse.Test.ScenarioTests { using Microsoft.WindowsAzure.Commands.ScenarioTest; - using ServiceManagement.Common.Models; using Xunit; - public class ADOnlyAuthenticationTests : SynapseTestBase + public class ADOnlyAuthenticationTests : SynapseTestRunner { - public XunitTracingInterceptor _logger; - - public ADOnlyAuthenticationTests(Xunit.Abstractions.ITestOutputHelper output) + public ADOnlyAuthenticationTests(Xunit.Abstractions.ITestOutputHelper output) : base(output) { - _logger = new XunitTracingInterceptor(output); - XunitTracingInterceptor.AddToContext(_logger); } [Fact] [Trait(Category.AcceptanceType, Category.All)] public void TestEnableSynapseADOnlyAuthentication() { - SynapseTestBase.NewInstance.RunPsTest( - _logger, - "Test-EnableSynapseADOnlyAuthentication"); + TestRunner.RunTestScript("Test-EnableSynapseADOnlyAuthentication"); } [Fact] public void TestDisableSynapseADOnlyAuthentication() { - SynapseTestBase.NewInstance.RunPsTest( - _logger, - "Test-DisableSynapseADOnlyAuthentication"); + TestRunner.RunTestScript("Test-DisableSynapseADOnlyAuthentication"); } } } - \ No newline at end of file diff --git a/src/Synapse/Synapse.Test/ScenarioTests/AuditTests.cs b/src/Synapse/Synapse.Test/ScenarioTests/AuditTests.cs index f64a84a94209..ab12afc91c4f 100644 --- a/src/Synapse/Synapse.Test/ScenarioTests/AuditTests.cs +++ b/src/Synapse/Synapse.Test/ScenarioTests/AuditTests.cs @@ -12,173 +12,134 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.ServiceManagement.Common.Models; using Microsoft.WindowsAzure.Commands.ScenarioTest; using Xunit; namespace Microsoft.Azure.Commands.Synapse.Test.ScenarioTests { - public class AuditTests : SynapseTestBase + public class AuditTests : SynapseTestRunner { - public XunitTracingInterceptor _logger; - - public AuditTests(Xunit.Abstractions.ITestOutputHelper output) + public AuditTests(Xunit.Abstractions.ITestOutputHelper output) : base(output) { - _logger = new XunitTracingInterceptor(output); - XunitTracingInterceptor.AddToContext(_logger); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestBlobAuditSqlPoolUpdatePolicyWithStorage() { - NewInstance.RunPsTest( - _logger, - "Test-BlobAuditSqlPoolUpdatePolicyWithStorage"); + TestRunner.RunTestScript("Test-BlobAuditSqlPoolUpdatePolicyWithStorage"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestBlobAuditWorkspaceUpdatePolicyWithStorage() { - NewInstance.RunPsTest( - _logger, - "Test-BlobAuditWorkspaceUpdatePolicyWithStorage"); + TestRunner.RunTestScript("Test-BlobAuditWorkspaceUpdatePolicyWithStorage"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestBlobAuditDisableSqlPoolAudit() { - NewInstance.RunPsTest( - _logger, - "Test-BlobAuditDisableSqlPoolAudit"); + TestRunner.RunTestScript("Test-BlobAuditDisableSqlPoolAudit"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestBlobAuditDisableWorkspaceAudit() { - NewInstance.RunPsTest( - _logger, - "Test-BlobAuditDisableWorkspaceAudit"); + TestRunner.RunTestScript("Test-BlobAuditDisableWorkspaceAudit"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestBlobAuditSqlPoolUpdatePolicyKeepPreviousStorage() { - NewInstance.RunPsTest( - _logger, - "Test-BlobAuditSqlPoolUpdatePolicyKeepPreviousStorage"); + TestRunner.RunTestScript("Test-BlobAuditSqlPoolUpdatePolicyKeepPreviousStorage"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestBlobAuditWorkspaceUpdatePolicyKeepPreviousStorage() { - NewInstance.RunPsTest( - _logger, - "Test-BlobAuditWorkspaceUpdatePolicyKeepPreviousStorage"); + TestRunner.RunTestScript("Test-BlobAuditWorkspaceUpdatePolicyKeepPreviousStorage"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestBlobAuditFailWithBadSqlPoolIndentity() { - NewInstance.RunPsTest( - _logger, - "Test-BlobAuditFailWithBadSqlPoolIndentity"); + TestRunner.RunTestScript("Test-BlobAuditFailWithBadSqlPoolIndentity"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestBlobAuditFailWithBadWorkspaceIndentity() { - NewInstance.RunPsTest( - _logger, - "Test-BlobAuditFailWithBadWorkspaceIndentity"); + TestRunner.RunTestScript("Test-BlobAuditFailWithBadWorkspaceIndentity"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestBlobAuditSqlPoolStorageKeyRotation() { - NewInstance.RunPsTest( - _logger, - "Test-BlobAuditSqlPoolStorageKeyRotation"); + TestRunner.RunTestScript("Test-BlobAuditSqlPoolStorageKeyRotation"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestBlobAuditWorkspaceStorageKeyRotation() { - NewInstance.RunPsTest( - _logger, - "Test-BlobAuditWorkspaceStorageKeyRotation"); + TestRunner.RunTestScript("Test-BlobAuditWorkspaceStorageKeyRotation"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestBlobAuditWorkspaceRetentionKeepProperties() { - NewInstance.RunPsTest( - _logger, - "Test-BlobAuditWorkspaceRetentionKeepProperties"); + TestRunner.RunTestScript("Test-BlobAuditWorkspaceRetentionKeepProperties"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestBlobAuditSqlPoolRetentionKeepProperties() { - NewInstance.RunPsTest( - _logger, - "Test-BlobAuditSqlPoolRetentionKeepProperties"); + TestRunner.RunTestScript("Test-BlobAuditSqlPoolRetentionKeepProperties"); } [Fact(Skip = "SQL Data Warehouse audit doesn’t support audit actions.")] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestBlobAuditOnSqlPool() { - NewInstance.RunPsTest( - _logger, - "Test-BlobAuditOnSqlPool"); + TestRunner.RunTestScript("Test-BlobAuditOnSqlPool"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestBlobAuditOnWorkspace() { - NewInstance.RunPsTest( - _logger, - "Test-BlobAuditOnWorkspace"); + TestRunner.RunTestScript("Test-BlobAuditOnWorkspace"); } [Fact(Skip = "SQL Data Warehouse audit doesn’t support other audit groups.")] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestBlobAuditWithAuditActionGroups() { - NewInstance.RunPsTest( - _logger, - "Test-BlobAuditWithAuditActionGroups"); + TestRunner.RunTestScript("Test-BlobAuditWithAuditActionGroups"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestExtendedAuditOnSqlPool() { - NewInstance.RunPsTest( - _logger, - "Test-ExtendedAuditOnSqlPool"); + TestRunner.RunTestScript("Test-ExtendedAuditOnSqlPool"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestExtendedAuditOnWorkspace() { - NewInstance.RunPsTest( - _logger, - "Test-ExtendedAuditOnWorkspace"); + TestRunner.RunTestScript("Test-ExtendedAuditOnWorkspace"); } [Fact] @@ -186,9 +147,7 @@ public void TestExtendedAuditOnWorkspace() [Trait(Category.RunType, Category.LiveOnly)] public void TestAuditOnSqlPool() { - NewInstance.RunPsTest( - _logger, - "Test-AuditOnSqlPool"); + TestRunner.RunTestScript("Test-AuditOnSqlPool"); } [Fact] @@ -196,63 +155,49 @@ public void TestAuditOnSqlPool() [Trait(Category.RunType, Category.LiveOnly)] public void TestAuditOnWorkspace() { - NewInstance.RunPsTest( - _logger, - "Test-AuditOnWorkspace"); + TestRunner.RunTestScript("Test-AuditOnWorkspace"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestNewSqlPoolAuditDiagnosticsAreCreatedOnNeed() { - NewInstance.RunPsTest( - _logger, - "Test-NewSqlPoolAuditDiagnosticsAreCreatedOnNeed"); + TestRunner.RunTestScript("Test-NewSqlPoolAuditDiagnosticsAreCreatedOnNeed"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestNewWorkspaceAuditDiagnosticsAreCreatedOnNeed() { - NewInstance.RunPsTest( - _logger, - "Test-NewWorkspaceAuditDiagnosticsAreCreatedOnNeed"); + TestRunner.RunTestScript("Test-NewWorkspaceAuditDiagnosticsAreCreatedOnNeed"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestRemoveAuditOnWorkspace() { - NewInstance.RunPsTest( - _logger, - "Test-RemoveAuditOnWorkspace"); + TestRunner.RunTestScript("Test-RemoveAuditOnWorkspace"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestRemoveAuditOnSqlPool() { - NewInstance.RunPsTest( - _logger, - "Test-RemoveAuditOnSqlPool"); + TestRunner.RunTestScript("Test-RemoveAuditOnSqlPool"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestRemoveSqlPoolAuditingSettingsMultipleDiagnosticSettings() { - NewInstance.RunPsTest( - _logger, - "Test-RemoveSqlPoolAuditingSettingsMultipleDiagnosticSettings"); + TestRunner.RunTestScript("Test-RemoveSqlPoolAuditingSettingsMultipleDiagnosticSettings"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestRemoveWorkspaceAuditingSettingsMultipleDiagnosticSettings() { - NewInstance.RunPsTest( - _logger, - "Test-RemoveWorkspaceAuditingSettingsMultipleDiagnosticSettings"); + TestRunner.RunTestScript("Test-RemoveWorkspaceAuditingSettingsMultipleDiagnosticSettings"); } } } diff --git a/src/Synapse/Synapse.Test/ScenarioTests/DataClassificationTests.cs b/src/Synapse/Synapse.Test/ScenarioTests/DataClassificationTests.cs index e301df1ec466..18e9b10d0d0b 100644 --- a/src/Synapse/Synapse.Test/ScenarioTests/DataClassificationTests.cs +++ b/src/Synapse/Synapse.Test/ScenarioTests/DataClassificationTests.cs @@ -12,38 +12,29 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.ServiceManagement.Common.Models; using Microsoft.WindowsAzure.Commands.ScenarioTest; using Xunit; namespace Microsoft.Azure.Commands.Synapse.Test.ScenarioTests { - public class DataClassificationTests : SynapseTestBase + public class DataClassificationTests : SynapseTestRunner { - public XunitTracingInterceptor _logger; - - public DataClassificationTests(Xunit.Abstractions.ITestOutputHelper output) + public DataClassificationTests(Xunit.Abstractions.ITestOutputHelper output) : base(output) { - _logger = new XunitTracingInterceptor(output); - XunitTracingInterceptor.AddToContext(_logger); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestDataClassificationOnSqlPool() { - NewInstance.RunPsTest( - _logger, - "Test-DataClassificationOnSqlPool"); + TestRunner.RunTestScript("Test-DataClassificationOnSqlPool"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestEnableDisableRecommendationsOnSqlPool() { - NewInstance.RunPsTest( - _logger, - "Test-EnableDisableRecommendationsOnSqlPool"); + TestRunner.RunTestScript("Test-EnableDisableRecommendationsOnSqlPool"); } } } diff --git a/src/Synapse/Synapse.Test/ScenarioTests/FirewallTests.cs b/src/Synapse/Synapse.Test/ScenarioTests/FirewallTests.cs index 7878bb481bdd..98e57845c3b1 100644 --- a/src/Synapse/Synapse.Test/ScenarioTests/FirewallTests.cs +++ b/src/Synapse/Synapse.Test/ScenarioTests/FirewallTests.cs @@ -15,26 +15,19 @@ namespace Microsoft.Azure.Commands.Synapse.Test.ScenarioTests { using Microsoft.WindowsAzure.Commands.ScenarioTest; - using ServiceManagement.Common.Models; using Xunit; - public class FirewallTests : SynapseTestBase + public class FirewallTests : SynapseTestRunner { - public XunitTracingInterceptor _logger; - - public FirewallTests(Xunit.Abstractions.ITestOutputHelper output) + public FirewallTests(Xunit.Abstractions.ITestOutputHelper output) : base(output) { - _logger = new XunitTracingInterceptor(output); - XunitTracingInterceptor.AddToContext(_logger); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestSynapseFirewall() { - SynapseTestBase.NewInstance.RunPsTest( - _logger, - "Test-SynapseFirewall"); + TestRunner.RunTestScript("Test-SynapseFirewall"); } } } diff --git a/src/Synapse/Synapse.Test/ScenarioTests/IntegrationRuntimeTests.cs b/src/Synapse/Synapse.Test/ScenarioTests/IntegrationRuntimeTests.cs index 82526bd2bd7b..860c1e0539ff 100644 --- a/src/Synapse/Synapse.Test/ScenarioTests/IntegrationRuntimeTests.cs +++ b/src/Synapse/Synapse.Test/ScenarioTests/IntegrationRuntimeTests.cs @@ -15,92 +15,43 @@ namespace Microsoft.Azure.Commands.Synapse.Test.ScenarioTests { using Microsoft.WindowsAzure.Commands.ScenarioTest; - using ServiceManagement.Common.Models; using Xunit; - public class IntegrationRuntimeTests : SynapseTestBase + public class IntegrationRuntimeTests : SynapseTestRunner { - public XunitTracingInterceptor _logger; - - public IntegrationRuntimeTests(Xunit.Abstractions.ITestOutputHelper output) + public IntegrationRuntimeTests(Xunit.Abstractions.ITestOutputHelper output) : base(output) { - _logger = new XunitTracingInterceptor(output); - XunitTracingInterceptor.AddToContext(_logger); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestSelfHostedIntegrationRuntime() { - SynapseTestBase.NewInstance.RunPsTest( - _logger, - "Test-SelfHosted-IntegrationRuntime"); + TestRunner.RunTestScript("Test-SelfHosted-IntegrationRuntime"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestAzureIntegrationRuntime() { - string testResourceGroupName = SynapseTestBase.TestResourceGroupName; - if (string.IsNullOrEmpty(testResourceGroupName)) - { - testResourceGroupName = nameof(TestResourceGroupName); - } - - string testWorkspaceName = SynapseTestBase.TestWorkspaceName; - if (string.IsNullOrEmpty(testWorkspaceName)) - { - testWorkspaceName = nameof(TestWorkspaceName); - } - - SynapseTestBase.NewInstance.RunPsTest( - _logger, - "Test-Azure-IntegrationRuntime"); + TestRunner.RunTestScript("Test-Azure-IntegrationRuntime"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestIntegrationRuntimePiping() { - string testResourceGroupName = SynapseTestBase.TestResourceGroupName; - if (string.IsNullOrEmpty(testResourceGroupName)) - { - testResourceGroupName = nameof(TestResourceGroupName); - } - - string testWorkspaceName = SynapseTestBase.TestWorkspaceName; - if (string.IsNullOrEmpty(testWorkspaceName)) - { - testWorkspaceName = nameof(TestWorkspaceName); - } - - SynapseTestBase.NewInstance.RunPsTest( - _logger, - string.Format( + TestRunner.RunTestScript(string.Format( "Test-IntegrationRuntime-Piping -resourceGroupName '{0}' -workspaceName '{1}'", - testResourceGroupName, - testWorkspaceName)); + TestResourceGroupName, + TestWorkspaceName)); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestAzureSSISIntegrationRuntime() { - string testResourceGroupName = SynapseTestBase.TestResourceGroupName; - if (string.IsNullOrEmpty(testResourceGroupName)) - { - testResourceGroupName = nameof(TestResourceGroupName); - } - - string testWorkspaceName = SynapseTestBase.TestWorkspaceName; - if (string.IsNullOrEmpty(testWorkspaceName)) - { - testWorkspaceName = nameof(TestWorkspaceName); - } - - SynapseTestBase.NewInstance.RunPsTest( - _logger, - "Test-AzureSSIS-IntegrationRuntime"); + TestRunner.RunTestScript("Test-AzureSSIS-IntegrationRuntime"); } } } diff --git a/src/Synapse/Synapse.Test/ScenarioTests/SparkJobTests.cs b/src/Synapse/Synapse.Test/ScenarioTests/SparkJobTests.cs index b9f8c3c3023e..1e1e1ba0b7f2 100644 --- a/src/Synapse/Synapse.Test/ScenarioTests/SparkJobTests.cs +++ b/src/Synapse/Synapse.Test/ScenarioTests/SparkJobTests.cs @@ -15,26 +15,21 @@ namespace Microsoft.Azure.Commands.Synapse.Test.ScenarioTests { using Microsoft.WindowsAzure.Commands.ScenarioTest; - using ServiceManagement.Common.Models; using Xunit; - public class SparkJobTests : SynapseTestBase + public class SparkJobTests : SynapseTestRunner { - public XunitTracingInterceptor _logger; - - public SparkJobTests(Xunit.Abstractions.ITestOutputHelper output) + public SparkJobTests(Xunit.Abstractions.ITestOutputHelper output) : base(output) { - _logger = new XunitTracingInterceptor(output); - XunitTracingInterceptor.AddToContext(_logger); } [Fact(Skip = "Job submission through Service Principal has not been supported.")] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestSynapseSparkJob() { - string resourceGroupName = SynapseTestBase.TestResourceGroupName; - string testWorkspaceName = SynapseTestBase.TestWorkspaceName; - string testSparkPoolName = SynapseTestBase.TestSparkPoolName; + string resourceGroupName = SynapseTestRunner.TestResourceGroupName; + string testWorkspaceName = SynapseTestRunner.TestWorkspaceName; + string testSparkPoolName = SynapseTestRunner.TestSparkPoolName; if (string.IsNullOrEmpty(resourceGroupName) || string.IsNullOrEmpty(testWorkspaceName) || string.IsNullOrEmpty(testSparkPoolName)) { resourceGroupName = nameof(TestResourceGroupName); @@ -42,8 +37,7 @@ public void TestSynapseSparkJob() testSparkPoolName = nameof(TestSparkPoolName); } - SynapseTestBase.NewInstance.RunPsTest( - _logger, + TestRunner.RunTestScript( string.Format( "Test-SynapseSparkJob -resourceGroupname '{0}' -workspaceName '{1}' -sparkPoolName {2}", resourceGroupName, diff --git a/src/Synapse/Synapse.Test/ScenarioTests/SparkPoolTests.cs b/src/Synapse/Synapse.Test/ScenarioTests/SparkPoolTests.cs index 215ce019e459..c0d941f221ec 100644 --- a/src/Synapse/Synapse.Test/ScenarioTests/SparkPoolTests.cs +++ b/src/Synapse/Synapse.Test/ScenarioTests/SparkPoolTests.cs @@ -15,26 +15,19 @@ namespace Microsoft.Azure.Commands.Synapse.Test.ScenarioTests { using Microsoft.WindowsAzure.Commands.ScenarioTest; - using ServiceManagement.Common.Models; using Xunit; - public class SparkPoolTests : SynapseTestBase + public class SparkPoolTests : SynapseTestRunner { - public XunitTracingInterceptor _logger; - - public SparkPoolTests(Xunit.Abstractions.ITestOutputHelper output) + public SparkPoolTests(Xunit.Abstractions.ITestOutputHelper output) : base(output) { - _logger = new XunitTracingInterceptor(output); - XunitTracingInterceptor.AddToContext(_logger); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestSynapseSparkPool() { - SynapseTestBase.NewInstance.RunPsTest( - _logger, - "Test-SynapseSparkPool"); + TestRunner.RunTestScript("Test-SynapseSparkPool"); } } } diff --git a/src/Synapse/Synapse.Test/ScenarioTests/SqlDatabaseTests.cs b/src/Synapse/Synapse.Test/ScenarioTests/SqlDatabaseTests.cs index 3745d48d75d2..36254712a17f 100644 --- a/src/Synapse/Synapse.Test/ScenarioTests/SqlDatabaseTests.cs +++ b/src/Synapse/Synapse.Test/ScenarioTests/SqlDatabaseTests.cs @@ -15,26 +15,19 @@ namespace Microsoft.Azure.Commands.Synapse.Test.ScenarioTests { using Microsoft.WindowsAzure.Commands.ScenarioTest; - using ServiceManagement.Common.Models; using Xunit; - public class SqlDatabaseTests : SynapseTestBase + public class SqlDatabaseTests : SynapseTestRunner { - public XunitTracingInterceptor _logger; - - public SqlDatabaseTests(Xunit.Abstractions.ITestOutputHelper output) + public SqlDatabaseTests(Xunit.Abstractions.ITestOutputHelper output) : base(output) { - _logger = new XunitTracingInterceptor(output); - XunitTracingInterceptor.AddToContext(_logger); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestSynapseSqlDatabase() { - SynapseTestBase.NewInstance.RunPsTest( - _logger, - "Test-SynapseSqlDatabase"); + TestRunner.RunTestScript("Test-SynapseSqlDatabase"); } } } diff --git a/src/Synapse/Synapse.Test/ScenarioTests/SqlPoolBackupTests.cs b/src/Synapse/Synapse.Test/ScenarioTests/SqlPoolBackupTests.cs index fe50de687eb4..86de2ebdd1ca 100644 --- a/src/Synapse/Synapse.Test/ScenarioTests/SqlPoolBackupTests.cs +++ b/src/Synapse/Synapse.Test/ScenarioTests/SqlPoolBackupTests.cs @@ -1,72 +1,52 @@ -using Microsoft.Azure.ServiceManagement.Common.Models; -using Microsoft.WindowsAzure.Commands.ScenarioTest; -using System; -using System.Collections.Generic; -using System.Text; +using Microsoft.WindowsAzure.Commands.ScenarioTest; using Xunit; namespace Microsoft.Azure.Commands.Synapse.Test.ScenarioTests { - public class SqlPoolBackupTests: SynapseTestBase + public class SqlPoolBackupTests: SynapseTestRunner { - public XunitTracingInterceptor _logger; - - public SqlPoolBackupTests(Xunit.Abstractions.ITestOutputHelper output) + public SqlPoolBackupTests(Xunit.Abstractions.ITestOutputHelper output) : base(output) { - _logger = new XunitTracingInterceptor(output); - XunitTracingInterceptor.AddToContext(_logger); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestSqlPoolRestorePoint(){ - NewInstance.RunPsTest( - _logger, - "Test-SqlPoolRestorePoint"); + TestRunner.RunTestScript("Test-SqlPoolRestorePoint"); } [Fact(Skip = "Not recordable. Geo backup requires one day to complete.")] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestSqlPoolGeoBackup() { - NewInstance.RunPsTest( - _logger, - "Test-SqlPoolGeoBackup"); + TestRunner.RunTestScript("Test-SqlPoolGeoBackup"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestDroppedSqlPool() { - NewInstance.RunPsTest( - _logger, - "Test-DroppedSqlPool"); + TestRunner.RunTestScript("Test-DroppedSqlPool"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestRestoreFromRestorePoint() { - NewInstance.RunPsTest( - _logger, - "Test-RestoreFromRestorePoint"); + TestRunner.RunTestScript("Test-RestoreFromRestorePoint"); } [Fact(Skip = "Currently the test case cannot pass due to some backend issues.")] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestRestoreFromBackup(){ - NewInstance.RunPsTest( - _logger, - "Test-RestoreFromBackup"); + TestRunner.RunTestScript("Test-RestoreFromBackup"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestRestoreFromDroppedSqlPool() { - NewInstance.RunPsTest( - _logger, - "Test-RestoreFromDroppedSqlPool"); + TestRunner.RunTestScript("Test-RestoreFromDroppedSqlPool"); } } } diff --git a/src/Synapse/Synapse.Test/ScenarioTests/SqlPoolTests.cs b/src/Synapse/Synapse.Test/ScenarioTests/SqlPoolTests.cs index 1a2119f76263..5772e7b9a00f 100644 --- a/src/Synapse/Synapse.Test/ScenarioTests/SqlPoolTests.cs +++ b/src/Synapse/Synapse.Test/ScenarioTests/SqlPoolTests.cs @@ -15,35 +15,26 @@ namespace Microsoft.Azure.Commands.Synapse.Test.ScenarioTests { using Microsoft.WindowsAzure.Commands.ScenarioTest; - using ServiceManagement.Common.Models; using Xunit; - public class SqlPoolTests : SynapseTestBase + public class SqlPoolTests : SynapseTestRunner { - public XunitTracingInterceptor _logger; - - public SqlPoolTests(Xunit.Abstractions.ITestOutputHelper output) + public SqlPoolTests(Xunit.Abstractions.ITestOutputHelper output) : base(output) { - _logger = new XunitTracingInterceptor(output); - XunitTracingInterceptor.AddToContext(_logger); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestSynapseSqlPool() { - SynapseTestBase.NewInstance.RunPsTest( - _logger, - "Test-SynapseSqlPool"); + TestRunner.RunTestScript("Test-SynapseSqlPool"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestSynapseSqlPoolSecurity() { - SynapseTestBase.NewInstance.RunPsTest( - _logger, - "Test-SynapseSqlPool-Security"); + TestRunner.RunTestScript("Test-SynapseSqlPool-Security"); } } } diff --git a/src/Synapse/Synapse.Test/ScenarioTests/SqlPoolV3Tests.cs b/src/Synapse/Synapse.Test/ScenarioTests/SqlPoolV3Tests.cs index ca4df1d2d629..f5c0b841ec5d 100644 --- a/src/Synapse/Synapse.Test/ScenarioTests/SqlPoolV3Tests.cs +++ b/src/Synapse/Synapse.Test/ScenarioTests/SqlPoolV3Tests.cs @@ -15,26 +15,19 @@ namespace Microsoft.Azure.Commands.Synapse.Test.ScenarioTests { using Microsoft.WindowsAzure.Commands.ScenarioTest; - using ServiceManagement.Common.Models; using Xunit; - public class SqlPoolV3Tests : SynapseTestBase + public class SqlPoolV3Tests : SynapseTestRunner { - public XunitTracingInterceptor _logger; - - public SqlPoolV3Tests(Xunit.Abstractions.ITestOutputHelper output) + public SqlPoolV3Tests(Xunit.Abstractions.ITestOutputHelper output) : base(output) { - _logger = new XunitTracingInterceptor(output); - XunitTracingInterceptor.AddToContext(_logger); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestSynapseSqlPoolV3() { - SynapseTestBase.NewInstance.RunPsTest( - _logger, - "Test-SynapseSqlPoolV3"); + TestRunner.RunTestScript("Test-SynapseSqlPoolV3"); } } } diff --git a/src/Synapse/Synapse.Test/ScenarioTests/SynapseTestBase.cs b/src/Synapse/Synapse.Test/ScenarioTests/SynapseTestBase.cs deleted file mode 100644 index 276d2f0413e9..000000000000 --- a/src/Synapse/Synapse.Test/ScenarioTests/SynapseTestBase.cs +++ /dev/null @@ -1,255 +0,0 @@ -// ---------------------------------------------------------------------------------- -// -// Copyright Microsoft Corporation -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// ---------------------------------------------------------------------------------- - - -using Microsoft.Azure.Test.HttpRecorder; -using Microsoft.Rest.ClientRuntime.Azure.TestFramework; -using Microsoft.WindowsAzure.Commands.ScenarioTest; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using NewResourceManagementClient = Microsoft.Azure.Management.Internal.Resources.ResourceManagementClient; -using Microsoft.WindowsAzure.Commands.Test.Utilities.Common; -using System.IO; -using Microsoft.Azure.ServiceManagement.Common.Models; -using Microsoft.Azure.Management.Synapse; -using Microsoft.Azure.Synapse; -using Microsoft.Azure.Commands.Common.Authentication; -using Microsoft.IdentityModel.Clients.ActiveDirectory; -using Microsoft.Rest; -using NewStorageManagementClient = Microsoft.Azure.Management.Storage.Version2017_10_01.StorageManagementClient; -using Microsoft.Azure.Management.Storage; -using SDKMonitor = Microsoft.Azure.Management.Monitor; -using CommonMonitor = Microsoft.Azure.Management.Monitor.Version2018_09_01; -using Microsoft.Azure.Management.OperationalInsights; -using Microsoft.Azure.Management.EventHub; - -namespace Microsoft.Azure.Commands.Synapse.Test.ScenarioTests -{ - public class SynapseTestBase : RMTestBase - { - internal string ResourceGroupName { get; set; } - internal const string ResourceGroupLocation = "northeurope"; - - protected readonly EnvironmentSetupHelper _helper; - - public NewResourceManagementClient NewResourceManagementClient { get; private set; } - - public SynapseManagementClient SynapseManagementClient { get; private set; } - - public SynapseSqlV3ManagementClient SynapseSqlV3ManagementClient { get; private set; } - - public SynapseClient SynapseClient { get; private set; } - - public StorageManagementClient StorageManagementClient { get; private set; } - - public CommonMonitor.MonitorManagementClient CommonMonitorManagementClient { get; private set; } - - public SDKMonitor.MonitorManagementClient SDKMonitorManagementClient { get; private set; } - - public OperationalInsightsManagementClient OperationalInsightsManagementClient { get; private set; } - - public EventHubManagementClient EventHubManagementClient { get; private set; } - - public static SynapseTestBase NewInstance => new SynapseTestBase(); - - protected static string TestResourceGroupName; - - protected static string TestWorkspaceName; - - protected static string TestSparkPoolName; - - protected SynapseTestBase() - { - _helper = new EnvironmentSetupHelper(); - } - - public void RunPsTest(XunitTracingInterceptor logger, params string[] scripts) - { - _helper.TracingInterceptor = logger; - var sf = new StackTrace().GetFrame(1); - var callingClassType = sf.GetMethod().ReflectedType?.ToString(); - var mockName = sf.GetMethod().Name; - - RunPsTestWorkflow( - () => scripts, - // no custom cleanup - null, - callingClassType, - mockName); - } - - - public void RunPsTestWorkflow( - Func scriptBuilder, - Action cleanup, - string callingClassType, - string mockName) - { - var d = new Dictionary - { - {"Microsoft.Resources", null}, - {"Microsoft.Features", null}, - {"Microsoft.Authorization", null}, - {"Microsoft.EventHub", null}, - {"Microsoft.Insights", null}, - {"Microsoft.OperationalInsights", null} - }; - var providersToIgnore = new Dictionary - { - {"Microsoft.Azure.Management.Resources.ResourceManagementClient", "2016-02-01"}, - {"Microsoft.Azure.Management.ResourceManager.ResourceManagementClient", "2017-05-10"} - }; - HttpMockServer.Matcher = new PermissiveRecordMatcherWithApiExclusion(true, d, providersToIgnore); - HttpMockServer.RecordsDirectory = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "SessionRecords"); - using (var context = MockContext.Start(callingClassType, mockName)) - { - SetupManagementClients(context); - - var callingClassName = callingClassType.Split(new[] { "." }, StringSplitOptions.RemoveEmptyEntries).Last(); - _helper.SetupModules( - AzureModule.AzureResourceManager, - "ScenarioTests\\Common.ps1", - "ScenarioTests\\" + callingClassName + ".ps1", - _helper.RMProfileModule, - _helper.GetRMModulePath(@"Az.Synapse.psd1"), - "AzureRM.Resources.ps1", - _helper.GetRMModulePath(@"Az.Storage.psd1"), - _helper.RMOperationalInsightsModule, - _helper.RMEventHubModule, - _helper.RMMonitorModule); - - try - { - var psScripts = scriptBuilder?.Invoke(); - - if (psScripts == null) return; - _helper.RunPowerShellTest(psScripts); - } - finally - { - cleanup?.Invoke(); - } - } - } - - protected void SetupManagementClients(MockContext context) - { - SynapseManagementClient = GetSynapseManagementClient(context); - SynapseSqlV3ManagementClient = GetSynapseSqlV3ManagementClient(context); - SynapseClient = GetSynapseClient(context); - StorageManagementClient = GetStorageManagementClient(context); - NewResourceManagementClient = GetResourceManagementClient(context); - CommonMonitorManagementClient = GetCommonMonitorManagementClient(context); - SDKMonitorManagementClient = GetMonitorManagementClient(context); - OperationalInsightsManagementClient = GetOperationalInsightsManagementClient(context); - EventHubManagementClient = GetEventHubManagementClient(context); - _helper.SetupManagementClients( - SynapseManagementClient, - SynapseSqlV3ManagementClient, - SynapseClient, - StorageManagementClient, - NewResourceManagementClient, - CommonMonitorManagementClient, - SDKMonitorManagementClient, - OperationalInsightsManagementClient, - EventHubManagementClient, - GetNewSynapseManagementClient(context) - ); - - // register the namespace. - _helper.SetupEnvironment(AzureModule.AzureResourceManager); - } - - private void SetupDataPlaneClient(MockContext context) - { - _helper.SetupManagementClients( - GetResourceManagementClient(context), - GetSynapseManagementClient(context), - GetSynapseClient(context) - ); - } - - #region client creation helpers - protected static NewResourceManagementClient GetResourceManagementClient(MockContext context) - { - return context.GetServiceClient(TestEnvironmentFactory.GetTestEnvironment()); - } - - protected static StorageManagementClient GetStorageManagementClient(MockContext context) - { - return context.GetServiceClient(TestEnvironmentFactory.GetTestEnvironment()); - } - - protected static NewStorageManagementClient GetNewSynapseManagementClient(MockContext context) - { - return context.GetServiceClient(TestEnvironmentFactory.GetTestEnvironment()); - } - - protected static SynapseManagementClient GetSynapseManagementClient(MockContext context) - { - return context.GetServiceClient(TestEnvironmentFactory.GetTestEnvironment()); - } - - protected static SynapseSqlV3ManagementClient GetSynapseSqlV3ManagementClient(MockContext context) - { - return context.GetServiceClient(TestEnvironmentFactory.GetTestEnvironment()); - } - - protected static CommonMonitor.MonitorManagementClient GetCommonMonitorManagementClient(MockContext context) - { - return context.GetServiceClient(TestEnvironmentFactory.GetTestEnvironment()); - } - - protected static SDKMonitor.MonitorManagementClient GetMonitorManagementClient(MockContext context) - { - return context.GetServiceClient(TestEnvironmentFactory.GetTestEnvironment()); - } - - protected static OperationalInsightsManagementClient GetOperationalInsightsManagementClient(MockContext context) - { - return context.GetServiceClient(TestEnvironmentFactory.GetTestEnvironment()); - } - - protected static EventHubManagementClient GetEventHubManagementClient(MockContext context) - { - return context.GetServiceClient(TestEnvironmentFactory.GetTestEnvironment()); - } - - protected static SynapseClient GetSynapseClient(MockContext context) - { - string environmentConnectionString = Environment.GetEnvironmentVariable("TEST_CSM_ORGID_AUTHENTICATION"); - string accessToken = "fakefakefake"; - - // When recording, we should have a connection string passed into the code from the environment - if (!string.IsNullOrEmpty(environmentConnectionString)) - { - // Gather test client credential information from the environment - var connectionInfo = new ConnectionString(Environment.GetEnvironmentVariable("TEST_CSM_ORGID_AUTHENTICATION")); - string servicePrincipal = connectionInfo.GetValue(ConnectionStringKeys.ServicePrincipalKey); - string servicePrincipalSecret = connectionInfo.GetValue(ConnectionStringKeys.ServicePrincipalSecretKey); - string aadTenant = connectionInfo.GetValue(ConnectionStringKeys.AADTenantKey); - - // Create credentials - var clientCredentials = new ClientCredential(servicePrincipal, servicePrincipalSecret); - var authContext = new AuthenticationContext($"https://login.windows.net/{aadTenant}", TokenCache.DefaultShared); - accessToken = authContext.AcquireTokenAsync("https://dev.azuresynapse.net", clientCredentials).Result.AccessToken; - } - - return new SynapseClient(new TokenCredentials(accessToken), HttpMockServer.CreateInstance()); - } - #endregion - } -} diff --git a/src/Synapse/Synapse.Test/ScenarioTests/SynapseTestRunner.cs b/src/Synapse/Synapse.Test/ScenarioTests/SynapseTestRunner.cs new file mode 100644 index 000000000000..1cfa9ed21f2a --- /dev/null +++ b/src/Synapse/Synapse.Test/ScenarioTests/SynapseTestRunner.cs @@ -0,0 +1,168 @@ +// ---------------------------------------------------------------------------------- +// +// Copyright Microsoft Corporation +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// http://www.apache.org/licenses/LICENSE-2.0 +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// ---------------------------------------------------------------------------------- + + +using Microsoft.Azure.Test.HttpRecorder; +using Microsoft.Rest.ClientRuntime.Azure.TestFramework; +using System; +using System.Collections.Generic; +using NewResourceManagementClient = Microsoft.Azure.Management.Internal.Resources.ResourceManagementClient; +using Microsoft.Azure.Management.Synapse; +using Microsoft.Azure.Synapse; +using Microsoft.IdentityModel.Clients.ActiveDirectory; +using Microsoft.Rest; +using NewStorageManagementClient = Microsoft.Azure.Management.Storage.Version2017_10_01.StorageManagementClient; +using Microsoft.Azure.Management.Storage; +using SDKMonitor = Microsoft.Azure.Management.Monitor; +using CommonMonitor = Microsoft.Azure.Management.Monitor.Version2018_09_01; +using Microsoft.Azure.Management.OperationalInsights; +using Microsoft.Azure.Management.EventHub; +using Microsoft.Azure.Commands.TestFx; +using Xunit.Abstractions; + +namespace Microsoft.Azure.Commands.Synapse.Test.ScenarioTests +{ + public class SynapseTestRunner + { + internal string ResourceGroupName { get; set; } + internal const string ResourceGroupLocation = "northeurope"; + + protected static string TestResourceGroupName; + + protected static string TestWorkspaceName; + + protected static string TestSparkPoolName; + + protected readonly ITestRunner TestRunner; + + protected SynapseTestRunner(ITestOutputHelper output) + { + TestRunner = TestManager.CreateInstance(output) + .WithNewPsScriptFilename($"{GetType().Name}.ps1") + .WithProjectSubfolderForTests("ScenarioTests") + .WithCommonPsScripts(new[] + { + @"Common.ps1", + @"../AzureRM.Resources.ps1" + }) + .WithNewRmModules(helper => new[] + { + helper.RMProfileModule, + helper.GetRMModulePath("Az.Synapse.psd1"), + helper.GetRMModulePath("Az.Storage.psd1"), + helper.RMOperationalInsightsModule, + helper.RMEventHubModule, + helper.RMMonitorModule + }) + .WithNewRecordMatcherArguments( + userAgentsToIgnore: new Dictionary + { + {"Microsoft.Azure.Management.Resources.ResourceManagementClient", "2016-02-01"}, + {"Microsoft.Azure.Management.ResourceManager.ResourceManagementClient", "2017-05-10"} + }, + resourceProviders: new Dictionary + { + {"Microsoft.Resources", null}, + {"Microsoft.Features", null}, + {"Microsoft.Authorization", null}, + {"Microsoft.EventHub", null}, + {"Microsoft.Insights", null}, + {"Microsoft.OperationalInsights", null} + } + ).WithManagementClients( + GetResourceManagementClient, + GetStorageManagementClient, + GetNewSynapseManagementClient, + GetSynapseManagementClient, + GetSynapseSqlV3ManagementClient, + GetCommonMonitorManagementClient, + GetMonitorManagementClient, + GetOperationalInsightsManagementClient, + GetEventHubManagementClient, + GetSynapseClient + ) + .Build(); + } + + #region client creation helpers + protected static NewResourceManagementClient GetResourceManagementClient(MockContext context) + { + return context.GetServiceClient(TestEnvironmentFactory.GetTestEnvironment()); + } + + protected static StorageManagementClient GetStorageManagementClient(MockContext context) + { + return context.GetServiceClient(TestEnvironmentFactory.GetTestEnvironment()); + } + + protected static NewStorageManagementClient GetNewSynapseManagementClient(MockContext context) + { + return context.GetServiceClient(TestEnvironmentFactory.GetTestEnvironment()); + } + + protected static SynapseManagementClient GetSynapseManagementClient(MockContext context) + { + return context.GetServiceClient(TestEnvironmentFactory.GetTestEnvironment()); + } + + protected static SynapseSqlV3ManagementClient GetSynapseSqlV3ManagementClient(MockContext context) + { + return context.GetServiceClient(TestEnvironmentFactory.GetTestEnvironment()); + } + + protected static CommonMonitor.MonitorManagementClient GetCommonMonitorManagementClient(MockContext context) + { + return context.GetServiceClient(TestEnvironmentFactory.GetTestEnvironment()); + } + + protected static SDKMonitor.MonitorManagementClient GetMonitorManagementClient(MockContext context) + { + return context.GetServiceClient(TestEnvironmentFactory.GetTestEnvironment()); + } + + protected static OperationalInsightsManagementClient GetOperationalInsightsManagementClient(MockContext context) + { + return context.GetServiceClient(TestEnvironmentFactory.GetTestEnvironment()); + } + + protected static EventHubManagementClient GetEventHubManagementClient(MockContext context) + { + return context.GetServiceClient(TestEnvironmentFactory.GetTestEnvironment()); + } + + protected static SynapseClient GetSynapseClient(MockContext context) + { + string environmentConnectionString = Environment.GetEnvironmentVariable("TEST_CSM_ORGID_AUTHENTICATION"); + string accessToken = "fakefakefake"; + + // When recording, we should have a connection string passed into the code from the environment + if (!string.IsNullOrEmpty(environmentConnectionString)) + { + // Gather test client credential information from the environment + var connectionInfo = new ConnectionString(Environment.GetEnvironmentVariable("TEST_CSM_ORGID_AUTHENTICATION")); + string servicePrincipal = connectionInfo.GetValue(ConnectionStringKeys.ServicePrincipalKey); + string servicePrincipalSecret = connectionInfo.GetValue(ConnectionStringKeys.ServicePrincipalSecretKey); + string aadTenant = connectionInfo.GetValue(ConnectionStringKeys.AADTenantKey); + + // Create credentials + var clientCredentials = new ClientCredential(servicePrincipal, servicePrincipalSecret); + var authContext = new AuthenticationContext($"https://login.windows.net/{aadTenant}", TokenCache.DefaultShared); + accessToken = authContext.AcquireTokenAsync("https://dev.azuresynapse.net", clientCredentials).Result.AccessToken; + } + + return new SynapseClient(new TokenCredentials(accessToken), HttpMockServer.CreateInstance()); + } + #endregion + } +} diff --git a/src/Synapse/Synapse.Test/ScenarioTests/VulnerabilityAssessmentTests.cs b/src/Synapse/Synapse.Test/ScenarioTests/VulnerabilityAssessmentTests.cs index 78a87da74062..1b54057f1470 100644 --- a/src/Synapse/Synapse.Test/ScenarioTests/VulnerabilityAssessmentTests.cs +++ b/src/Synapse/Synapse.Test/ScenarioTests/VulnerabilityAssessmentTests.cs @@ -12,46 +12,35 @@ // limitations under the License. // ---------------------------------------------------------------------------------- -using Microsoft.Azure.ServiceManagement.Common.Models; using Microsoft.WindowsAzure.Commands.ScenarioTest; using Xunit; namespace Microsoft.Azure.Commands.Synapse.Test.ScenarioTests { - public class VulnerabilityAssessmentTests : SynapseTestBase + public class VulnerabilityAssessmentTests : SynapseTestRunner { - public XunitTracingInterceptor _logger; - - public VulnerabilityAssessmentTests(Xunit.Abstractions.ITestOutputHelper output) + public VulnerabilityAssessmentTests(Xunit.Abstractions.ITestOutputHelper output) : base(output) { - _logger = new XunitTracingInterceptor(output); - XunitTracingInterceptor.AddToContext(_logger); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestVulnerabilityAssessmentBaseline(){ - NewInstance.RunPsTest( - _logger, - "Test-VulnerabilityAssessmentBaseline"); + TestRunner.RunTestScript("Test-VulnerabilityAssessmentBaseline"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestVulnerabilityAssessmentScanRecordGetListTest() { - NewInstance.RunPsTest( - _logger, - "Test-VulnerabilityAssessmentScanRecordGetListTest"); + TestRunner.RunTestScript("Test-VulnerabilityAssessmentScanRecordGetListTest"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestVulnerabilityAssessmentScanConvertTest() { - NewInstance.RunPsTest( - _logger, - "Test-VulnerabilityAssessmentScanConvertTest"); + TestRunner.RunTestScript("Test-VulnerabilityAssessmentScanConvertTest"); } } } diff --git a/src/Synapse/Synapse.Test/ScenarioTests/WorkspaceTests.cs b/src/Synapse/Synapse.Test/ScenarioTests/WorkspaceTests.cs index 720c8b8018da..dd137a4d8a25 100644 --- a/src/Synapse/Synapse.Test/ScenarioTests/WorkspaceTests.cs +++ b/src/Synapse/Synapse.Test/ScenarioTests/WorkspaceTests.cs @@ -15,60 +15,47 @@ namespace Microsoft.Azure.Commands.Synapse.Test.ScenarioTests { using Microsoft.WindowsAzure.Commands.ScenarioTest; - using ServiceManagement.Common.Models; using Xunit; - public class WorkspaceTests : SynapseTestBase + public class WorkspaceTests : SynapseTestRunner { - public XunitTracingInterceptor _logger; - - public WorkspaceTests(Xunit.Abstractions.ITestOutputHelper output) + public WorkspaceTests(Xunit.Abstractions.ITestOutputHelper output) : base(output) { - _logger = new XunitTracingInterceptor(output); - XunitTracingInterceptor.AddToContext(_logger); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestSynapseWorkspace() { - SynapseTestBase.NewInstance.RunPsTest(_logger, "Test-SynapseWorkspace"); + TestRunner.RunTestScript("Test-SynapseWorkspace"); } [Fact(Skip = "Can't call Graph API through Service Principal.")] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestSynapseWorkspaceActiveDirectoryAdministrator() { - SynapseTestBase.NewInstance.RunPsTest( - _logger, - "Test-SynapseWorkspaceActiveDirectoryAdministrator"); + TestRunner.RunTestScript("Test-SynapseWorkspaceActiveDirectoryAdministrator"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestSynapseWorkspaceSecurity() { - SynapseTestBase.NewInstance.RunPsTest( - _logger, - "Test-SynapseWorkspaceSecurity"); + TestRunner.RunTestScript("Test-SynapseWorkspaceSecurity"); } [Fact] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestSynapseManagedIdentitySqlControlSetting() { - SynapseTestBase.NewInstance.RunPsTest( - _logger, - "Test-SynapseManagedIdentitySqlControlSetting"); + TestRunner.RunTestScript("Test-SynapseManagedIdentitySqlControlSetting"); } [Fact(Skip = "This test requires to create KeyVault beforehand and calls Graph API.")] [Trait(Category.AcceptanceType, Category.CheckIn)] public void TestSynapseWorkspaceKey() { - SynapseTestBase.NewInstance.RunPsTest( - _logger, - "Test-SynapseWorkspaceKey"); + TestRunner.RunTestScript("Test-SynapseWorkspaceKey"); } } }