Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
v-yuzhichen authored May 18, 2022
1 parent 635e5c3 commit a62bbde
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 165 deletions.
44 changes: 18 additions & 26 deletions src/Search/Search.Test/ScenarioTests/SearchServiceTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,136 +12,128 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.Azure.Commands.ScenarioTest;
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.Search.Test.ScenarioTests
{
public class SearchServiceTests : RMTestBase
public class SearchServiceTests : SearchTestRunner
{
private readonly XunitTracingInterceptor traceInterceptor;

public SearchServiceTests(ITestOutputHelper output)
public SearchServiceTests(ITestOutputHelper output) : base(output)
{
traceInterceptor = new XunitTracingInterceptor(output);
XunitTracingInterceptor.AddToContext(this.traceInterceptor);
TestExecutionHelpers.SetUpSessionAndProfile();
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void TestManageSharedPrivateLinkResourcesJob()
{
TestController.NewInstance.RunPsTest(traceInterceptor, "Test-ManageAzSearchSharedPrivateLinkResourceJob");
TestRunner.RunTestScript("Test-ManageAzSearchSharedPrivateLinkResourceJob");
}
}
}
57 changes: 57 additions & 0 deletions src/Search/Search.Test/ScenarioTests/SearchTestRunner.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
// ----------------------------------------------------------------------------------
//
// 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.Management.Search.Test.ScenarioTests
{
public class SearchTestRunner
{
protected readonly ITestRunner TestRunner;

protected SearchTestRunner(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.Search.psd1"),
helper.GetRMModulePath("Az.Storage.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.Storage", null}
}
)
.Build();
}
}
}
139 changes: 0 additions & 139 deletions src/Search/Search.Test/TestController.cs

This file was deleted.

0 comments on commit a62bbde

Please sign in to comment.