Skip to content

Commit

Permalink
Remove Storage TestController (#18470)
Browse files Browse the repository at this point in the history
* Remove TestController

* Update StorageBlobTests.cs

* Update StorageTestRunner.cs

* Update StorageTestRunner.cs
  • Loading branch information
ziyuezh576 authored Jun 17, 2022
1 parent 6567757 commit 7d4bc91
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 188 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,107 +12,101 @@
// limitations under the License.
// ----------------------------------------------------------------------------------


using Microsoft.Azure.ServiceManagement.Common.Models;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
using Xunit;
using Xunit.Abstractions;

namespace Microsoft.Azure.Commands.Management.Storage.Test.ScenarioTests
{
public class StorageBlobTests : RMTestBase
public class StorageBlobTests : StorageTestRunner
{
public XunitTracingInterceptor _logger;

public StorageBlobTests(ITestOutputHelper output)
: base(output)
{
_logger = new XunitTracingInterceptor(output);
XunitTracingInterceptor.AddToContext(_logger);
}

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

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

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

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

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

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

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

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

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

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

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

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestStorageBlobContainerVLW()
{
TestController.NewInstance.RunPsTest(_logger, "Test-StorageBlobContainerVLW");
TestRunner.RunTestScript("Test-StorageBlobContainerVLW");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,83 +12,72 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using System;
using System.Collections;
using System.Collections.ObjectModel;
using System.Management.Automation;
using Xunit;
using Xunit.Abstractions;
using System.Diagnostics;
using Microsoft.Azure.ServiceManagement.Common.Models;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
using Microsoft.Azure.Management.Internal.Resources;
using Microsoft.Azure.Management.Storage;
using Microsoft.Rest.ClientRuntime.Azure.TestFramework;

namespace Microsoft.Azure.Commands.Management.Storage.Test.ScenarioTests
{
public class StorageDataPlaneTests : RMTestBase
public class StorageDataPlaneTests : StorageTestRunner
{
public XunitTracingInterceptor _logger;
private string resourceGroupName;
private string storageAccountName;

public StorageDataPlaneTests(ITestOutputHelper output)
: base(output)
{
resourceGroupName = TestUtilities.GenerateName();
storageAccountName = "sto" + resourceGroupName;
_logger = new XunitTracingInterceptor(output);
XunitTracingInterceptor.AddToContext(_logger);
}

[Fact]
[Trait(Category.RunType, Category.LiveOnly)]
public void TestBlob()
{
TestController.NewInstance.RunPsTest(_logger, $"Test-Blob -ResourceGroupName \"{resourceGroupName}\" -StorageAccountName \"{storageAccountName}\"");
TestRunner.RunTestScript($"Test-Blob -ResourceGroupName \"{resourceGroupName}\" -StorageAccountName \"{storageAccountName}\"");
}

[Fact]
[Trait(Category.RunType, Category.LiveOnly)]
public void TestFile()
{
TestController.NewInstance.RunPsTest(_logger, $"Test-File -ResourceGroupName \"{resourceGroupName}\" -StorageAccountName \"{storageAccountName}\"");
TestRunner.RunTestScript($"Test-File -ResourceGroupName \"{resourceGroupName}\" -StorageAccountName \"{storageAccountName}\"");
}

[Fact]
[Trait(Category.RunType, Category.LiveOnly)]
public void TestBlobFileCopy()
{
TestController.NewInstance.RunPsTest(_logger, $"Test-BlobFileCopy -ResourceGroupName \"{resourceGroupName}\" -StorageAccountName \"{storageAccountName}\"");
TestRunner.RunTestScript($"Test-BlobFileCopy -ResourceGroupName \"{resourceGroupName}\" -StorageAccountName \"{storageAccountName}\"");
}

[Fact]
[Trait(Category.RunType, Category.LiveOnly)]
public void TestTable()
{
TestController.NewInstance.RunPsTest(_logger, $"Test-Table -ResourceGroupName \"{resourceGroupName}\" -StorageAccountName \"{storageAccountName}\"");
TestRunner.RunTestScript($"Test-Table -ResourceGroupName \"{resourceGroupName}\" -StorageAccountName \"{storageAccountName}\"");
}

[Fact]
[Trait(Category.RunType, Category.LiveOnly)]
public void TestQueue()
{
TestController.NewInstance.RunPsTest(_logger, $"Test-Queue -ResourceGroupName \"{resourceGroupName}\" -StorageAccountName \"{storageAccountName}\"");
TestRunner.RunTestScript($"Test-Queue -ResourceGroupName \"{resourceGroupName}\" -StorageAccountName \"{storageAccountName}\"");
}

[Fact]
[Trait(Category.RunType, Category.LiveOnly)]
public void TestCommon()
{
TestController.NewInstance.RunPsTest(_logger, $"Test-Common -ResourceGroupName \"{resourceGroupName}\" -StorageAccountName \"{storageAccountName}\"");
TestRunner.RunTestScript($"Test-Common -ResourceGroupName \"{resourceGroupName}\" -StorageAccountName \"{storageAccountName}\"");
}

[Fact]
[Trait(Category.RunType, Category.LiveOnly)]
public void TestDatalakeGen2()
{
TestController.NewInstance.RunPsTest(_logger, $"Test-DatalakeGen2 -ResourceGroupName \"{resourceGroupName}\" -StorageAccountName \"{storageAccountName}\"");
TestRunner.RunTestScript($"Test-DatalakeGen2 -ResourceGroupName \"{resourceGroupName}\" -StorageAccountName \"{storageAccountName}\"");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,65 +12,59 @@
// limitations under the License.
// ----------------------------------------------------------------------------------


using Microsoft.Azure.ServiceManagement.Common.Models;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
using Xunit;
using Xunit.Abstractions;

namespace Microsoft.Azure.Commands.Management.Storage.Test.ScenarioTests
{
public class StorageFileTests : RMTestBase
public class StorageFileTests : StorageTestRunner
{
public XunitTracingInterceptor _logger;

public StorageFileTests(ITestOutputHelper output)
: base(output)
{
_logger = new XunitTracingInterceptor(output);
XunitTracingInterceptor.AddToContext(_logger);
}

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

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

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

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

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

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestAzureStorageShareNFS()
{
TestController.NewInstance.RunPsTest(_logger, "Test-AzureStorageShareNFS");
}
TestRunner.RunTestScript("Test-AzureStorageShareNFS");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Commands.TestFx;
using System.Collections.Generic;
using Xunit.Abstractions;

namespace Microsoft.Azure.Commands.Management.Storage.Test
Expand All @@ -28,13 +29,26 @@ protected StorageTestRunner(ITestOutputHelper output)
.WithProjectSubfolderForTests("ScenarioTests")
.WithCommonPsScripts(new[]
{
@"Common.ps1", @"../AzureRM.Resources.ps1"
@"Common.ps1",
@"../AzureRM.Resources.ps1"
})
.WithNewRmModules(helper => new[]
{
helper.RMProfileModule,
helper.RMStorageModule
})
.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}
}
)
.Build();
}
}
Expand Down
Loading

0 comments on commit 7d4bc91

Please sign in to comment.