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

Add NetAppFilesTestRunner and replace TestController #18175

Merged
merged 1 commit into from
May 16, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 5 additions & 9 deletions src/NetAppFiles/NetAppFiles.Test/ScenarioTests/AccountTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,35 +17,31 @@

namespace Microsoft.Azure.Commands.NetAppFiles.Test.ScenarioTests.ScenarioTest
{
public class AccountTests
public class AccountTests : NetAppFilesTestRunner
{
private ServiceManagement.Common.Models.XunitTracingInterceptor _logger;

public AccountTests(Xunit.Abstractions.ITestOutputHelper output)
public AccountTests(Xunit.Abstractions.ITestOutputHelper output) : base(output)
{
_logger = new ServiceManagement.Common.Models.XunitTracingInterceptor(output);
ServiceManagement.Common.Models.XunitTracingInterceptor.AddToContext(_logger);
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestAccountCrud()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-AccountCrud");
TestRunner.RunTestScript("Test-AccountCrud");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestAccountActiveDirectory()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-AccountActiveDirectory");
TestRunner.RunTestScript("Test-AccountActiveDirectory");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestAccountPipelines()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-AccountPipelines");
TestRunner.RunTestScript("Test-AccountPipelines");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,24 @@

namespace Microsoft.Azure.Commands.NetAppFiles.Test.ScenarioTests.ScenarioTest
{
public class ActiveDirectoryTests
public class ActiveDirectoryTests : NetAppFilesTestRunner
{
private ServiceManagement.Common.Models.XunitTracingInterceptor _logger;

public ActiveDirectoryTests(Xunit.Abstractions.ITestOutputHelper output)
public ActiveDirectoryTests(Xunit.Abstractions.ITestOutputHelper output) : base(output)
{
_logger = new ServiceManagement.Common.Models.XunitTracingInterceptor(output);
ServiceManagement.Common.Models.XunitTracingInterceptor.AddToContext(_logger);
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestActiveDirectoryCrud()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-ActiveDirectoryCrud");
TestRunner.RunTestScript("Test-ActiveDirectoryCrud");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestActiveDirectoryPipelines()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-ActiveDirectoryPipelines");
TestRunner.RunTestScript("Test-ActiveDirectoryPipelines");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,24 @@

namespace Microsoft.Azure.Commands.NetAppFiles.Test.ScenarioTests.ScenarioTest
{
public class BackupPolicyTests
public class BackupPolicyTests : NetAppFilesTestRunner
{
private ServiceManagement.Common.Models.XunitTracingInterceptor _logger;

public BackupPolicyTests(Xunit.Abstractions.ITestOutputHelper output)
public BackupPolicyTests(Xunit.Abstractions.ITestOutputHelper output) : base(output)
{
_logger = new ServiceManagement.Common.Models.XunitTracingInterceptor(output);
ServiceManagement.Common.Models.XunitTracingInterceptor.AddToContext(_logger);
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestBackupPolicyCrud()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-BackupPolicyCrud");
TestRunner.RunTestScript("Test-BackupPolicyCrud");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestBackupPolicyPipelines()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-BackupPolicyPipelines");
TestRunner.RunTestScript("Test-BackupPolicyPipelines");
}
}
}
14 changes: 5 additions & 9 deletions src/NetAppFiles/NetAppFiles.Test/ScenarioTests/BackupTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,35 +17,31 @@

namespace Microsoft.Azure.Commands.NetAppFiles.Test.ScenarioTests.ScenarioTest
{
public class BackupTests
public class BackupTests : NetAppFilesTestRunner
{
private ServiceManagement.Common.Models.XunitTracingInterceptor _logger;

public BackupTests(Xunit.Abstractions.ITestOutputHelper output)
public BackupTests(Xunit.Abstractions.ITestOutputHelper output) : base(output)
{
_logger = new ServiceManagement.Common.Models.XunitTracingInterceptor(output);
ServiceManagement.Common.Models.XunitTracingInterceptor.AddToContext(_logger);
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestBackupCrud()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-BackupCrud");
TestRunner.RunTestScript("Test-BackupCrud");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestBackupPipelines()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-BackupPipelines");
TestRunner.RunTestScript("Test-BackupPipelines");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestVolumeBackupStatusCrud()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-VolumeBackupStatus");
TestRunner.RunTestScript("Test-VolumeBackupStatus");
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,17 @@

namespace Microsoft.Azure.Commands.NetAppFiles.Test.ScenarioTests.ScenarioTest
{
public class ExportPolicyTests
public class ExportPolicyTests : NetAppFilesTestRunner
{
private ServiceManagement.Common.Models.XunitTracingInterceptor _logger;

public ExportPolicyTests(Xunit.Abstractions.ITestOutputHelper output)
public ExportPolicyTests(Xunit.Abstractions.ITestOutputHelper output) : base(output)
{
_logger = new ServiceManagement.Common.Models.XunitTracingInterceptor(output);
ServiceManagement.Common.Models.XunitTracingInterceptor.AddToContext(_logger);
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestExportPolicy()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-ExportPolicy");
TestRunner.RunTestScript("Test-ExportPolicy");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// ----------------------------------------------------------------------------------
//
// 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 System.Collections.Generic;
using Microsoft.Azure.Commands.TestFx;
using Xunit.Abstractions;

namespace Microsoft.Azure.Commands.NetAppFiles.Test.ScenarioTests
{
public class NetAppFilesTestRunner
{
protected readonly ITestRunner TestRunner;

protected NetAppFilesTestRunner(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.RMNetworkModule,
helper.GetRMModulePath("Az.NetAppFiles.psd1")
})
.WithNewRecordMatcherArguments(
userAgentsToIgnore: new Dictionary<string, string>
{
{"Microsoft.Azure.Management.Resources.ResourceManagementClient", "2016-02-01"}
},
resourceProviders: new Dictionary<string, string>
{
{"Microsoft.Resources", null},
{"Microsoft.Features", null},
{"Microsoft.Authorization", null},
{"Microsoft.Network", null},
{"Microsoft.Compute", null}
}
)
.Build();
}
}
}
12 changes: 4 additions & 8 deletions src/NetAppFiles/NetAppFiles.Test/ScenarioTests/PoolTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,24 @@

namespace Microsoft.Azure.Commands.NetAppFiles.Test.ScenarioTests.ScenarioTest
{
public class PoolTests
public class PoolTests : NetAppFilesTestRunner
{
private ServiceManagement.Common.Models.XunitTracingInterceptor _logger;

public PoolTests(Xunit.Abstractions.ITestOutputHelper output)
public PoolTests(Xunit.Abstractions.ITestOutputHelper output) : base(output)
{
_logger = new ServiceManagement.Common.Models.XunitTracingInterceptor(output);
ServiceManagement.Common.Models.XunitTracingInterceptor.AddToContext(_logger);
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestPoolCrud()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-PoolCrud");
TestRunner.RunTestScript("Test-PoolCrud");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestPoolPipelines()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-PoolPipelines");
TestRunner.RunTestScript("Test-PoolPipelines");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,21 +16,17 @@
using Xunit;
namespace Microsoft.Azure.Commands.NetAppFiles.Test.ScenarioTests.ScenarioTest
{
public class QuotaLimitTests
public class QuotaLimitTests : NetAppFilesTestRunner
{
private ServiceManagement.Common.Models.XunitTracingInterceptor _logger;

public QuotaLimitTests(Xunit.Abstractions.ITestOutputHelper output)
public QuotaLimitTests(Xunit.Abstractions.ITestOutputHelper output) : base(output)
{
_logger = new ServiceManagement.Common.Models.XunitTracingInterceptor(output);
ServiceManagement.Common.Models.XunitTracingInterceptor.AddToContext(_logger);
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestQuotaLimit()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-QuotaLimit");
TestRunner.RunTestScript("Test-QuotaLimit");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,24 @@

namespace Microsoft.Azure.Commands.NetAppFiles.Test.ScenarioTests.ScenarioTest
{
public class SnapshotPolicyTests
public class SnapshotPolicyTests : NetAppFilesTestRunner
{
private ServiceManagement.Common.Models.XunitTracingInterceptor _logger;

public SnapshotPolicyTests(Xunit.Abstractions.ITestOutputHelper output)
public SnapshotPolicyTests(Xunit.Abstractions.ITestOutputHelper output) : base(output)
{
_logger = new ServiceManagement.Common.Models.XunitTracingInterceptor(output);
ServiceManagement.Common.Models.XunitTracingInterceptor.AddToContext(_logger);
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestSnapshotPolicyCrud()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-SnapshotPolicyCrud");
TestRunner.RunTestScript("Test-SnapshotPolicyCrud");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestSnapshotPolicyPipelines()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-SnapshotPolicyPipelines");
TestRunner.RunTestScript("Test-SnapshotPolicyPipelines");
}
}
}
16 changes: 6 additions & 10 deletions src/NetAppFiles/NetAppFiles.Test/ScenarioTests/SnapshotTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,43 +17,39 @@

namespace Microsoft.Azure.Commands.NetAppFiles.Test.ScenarioTests.ScenarioTest
{
public class SnapshotTests
public class SnapshotTests : NetAppFilesTestRunner
{
private ServiceManagement.Common.Models.XunitTracingInterceptor _logger;

public SnapshotTests(Xunit.Abstractions.ITestOutputHelper output)
public SnapshotTests(Xunit.Abstractions.ITestOutputHelper output) : base(output)
{
_logger = new ServiceManagement.Common.Models.XunitTracingInterceptor(output);
ServiceManagement.Common.Models.XunitTracingInterceptor.AddToContext(_logger);
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestSnapshotCrud()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-SnapshotCrud");
TestRunner.RunTestScript("Test-SnapshotCrud");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestSnapshotPipelines()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-SnapshotPipelines");
TestRunner.RunTestScript("Test-SnapshotPipelines");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestCreateVolumeFromSnapshot()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-CreateVolumeFromSnapshot");
TestRunner.RunTestScript("Test-CreateVolumeFromSnapshot");
}


[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestRestoreVolumeFromSnapshot()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-RestoreVolumeFromSnapshot");
TestRunner.RunTestScript("Test-RestoreVolumeFromSnapshot");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,17 @@
using Xunit;
namespace Microsoft.Azure.Commands.NetAppFiles.Test.ScenarioTests.ScenarioTest
{
public class SubvolumeTests
public class SubvolumeTests : NetAppFilesTestRunner
{
private ServiceManagement.Common.Models.XunitTracingInterceptor _logger;
public SubvolumeTests(Xunit.Abstractions.ITestOutputHelper output)
public SubvolumeTests(Xunit.Abstractions.ITestOutputHelper output) : base(output)
{
_logger = new ServiceManagement.Common.Models.XunitTracingInterceptor(output);
ServiceManagement.Common.Models.XunitTracingInterceptor.AddToContext(_logger);
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestSubvolumeCrud()
{
TestController.NewInstance.RunPowerShellTest(_logger, "Test-SubvolumeCrud");
TestRunner.RunTestScript("Test-SubvolumeCrud");
}


Expand Down
Loading