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 AnalysisServicesTestRunner and replace AsTestsBase #18056

Merged
merged 3 commits into from
May 17, 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
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
using System.Threading.Tasks;
using Microsoft.Azure.Commands.AnalysisServices.Dataplane;
using Microsoft.Azure.Commands.AnalysisServices.Dataplane.Models;
using Microsoft.Azure.Commands.AnalysisServices.Test.ScenarioTests;
using Microsoft.Azure.Commands.Profile.Models.Core;
using Microsoft.Azure.ServiceManagement.Common.Models;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
Expand All @@ -31,12 +30,12 @@
using Xunit.Abstractions;
using System.Collections.Generic;
using System.Net.Http.Headers;
using Newtonsoft.Json;
using Microsoft.Azure.Commands.Common.Authentication.Abstractions;
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;

namespace Microsoft.Azure.Commands.AnalysisServices.Test.InMemoryTests
{
public class DataPlaneCommandTests : AsTestsBase
public class DataPlaneCommandTests : RMTestBase
{
private const string testInstance = "asazure://westcentralus.asazure.windows.net/testserver";

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
// ----------------------------------------------------------------------------------
//
// 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.AnalysisServices.Test.ScenarioTests
{
public class AnalysisServicesTestRunner
{
protected readonly ITestRunner TestRunner;

protected AnalysisServicesTestRunner(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.AnalysisServices.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}
}
)
.Build();
}
}
}
30 changes: 13 additions & 17 deletions src/AnalysisServices/AnalysisServices.Test/ScenarioTests/AsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,91 +18,87 @@ namespace Microsoft.Azure.Commands.AnalysisServices.Test.ScenarioTests
using ServiceManagement.Common.Models;
using Xunit;

public class AsTests : AsTestsBase
public class AsTests : AnalysisServicesTestRunner
{
public XunitTracingInterceptor _logger;

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

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

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

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

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

[Fact]
[Trait(Category.RunType, Category.LiveOnly)]
public void TestAnalysisServicesServerDisableBackup()
{
NewInstance.RunPsTest(_logger, "Test-AnalysisServicesServerDisableBackup");
TestRunner.RunTestScript("Test-AnalysisServicesServerDisableBackup");
}

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

[Fact]
[Trait(Category.RunType, Category.LiveOnly)]
public void TestAnalysisServicesServerLogExport()
{
NewInstance.RunPsTest(_logger, "Test-AnalysisServicesServerLogExport");
TestRunner.RunTestScript("Test-AnalysisServicesServerLogExport");
}

[Fact]
[Trait(Category.RunType, Category.LiveOnly)]
public void TestAnalysisServicesServerRestart()
{
NewInstance.RunPsTest(_logger, "Test-AnalysisServicesServerRestart");
TestRunner.RunTestScript("Test-AnalysisServicesServerRestart");
}

[Fact]
[Trait(Category.RunType, Category.LiveOnly)]
public void TestAnalysisServicesServerSynchronizeSingle()
{
NewInstance.RunPsTest(_logger, "Test-AnalysisServicesServerSynchronizeSingle");
TestRunner.RunTestScript("Test-AnalysisServicesServerSynchronizeSingle");
}

[Fact]
[Trait(Category.RunType, Category.LiveOnly)]
public void TestAnalysisServicesServerLoginWithSPN()
{
NewInstance.RunPsTest(_logger, "Test-AnalysisServicesServerLoginWithSPN");
TestRunner.RunTestScript("Test-AnalysisServicesServerLoginWithSPN");
}

[Fact]
[Trait(Category.RunType, Category.LiveOnly)]
public void TestAnalysisServicesServerGateway()
{
NewInstance.RunPsTest(_logger, "Test-AnalysisServicesServerGateway");
TestRunner.RunTestScript("Test-AnalysisServicesServerGateway");
}

}
Expand Down

This file was deleted.