Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 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
8 changes: 7 additions & 1 deletion src/EventHub/EventHub.Test/EventHub.Test.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,12 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Azure.Management.EventHub" Version="2.5.0" />
<PackageReference Include="Microsoft.Azure.KeyVault" Version="3.0.5" />
<PackageReference Include="Microsoft.Azure.Management.EventHub" Version="2.7.0" />
<PackageReference Include="Microsoft.Azure.Management.KeyVault" Version="3.0.0" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\EventHub\EventHub.csproj" />
</ItemGroup>
</Project>
27 changes: 11 additions & 16 deletions src/EventHub/EventHub.Test/ScenarioTests/ConsumerGroups.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,25 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Xunit;

namespace Microsoft.Azure.Commands.EventHub.Test.ScenarioTests
{
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
using ScenarioTest;
using ServiceManagement.Common.Models;
using Xunit;
using Xunit.Abstractions;
public class ConsumerGroupsTests : RMTestBase
{
public XunitTracingInterceptor _logger;

public class ConsumerGroupsTests : EventHubTestRunner
{

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

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void ConsumerGroupsCRUD()
{
EventHubsController.NewInstance.RunPsTest(_logger, "ConsumerGroupsTests");
{
TestRunner.RunTestScript("ConsumerGroupsTests");
}

}
Expand Down
21 changes: 9 additions & 12 deletions src/EventHub/EventHub.Test/ScenarioTests/DRConfigurations.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,32 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Xunit;

namespace Microsoft.Azure.Commands.EventHub.Test.ScenarioTests
{
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
using ServiceManagement.Common.Models;
using Xunit;
using Xunit.Abstractions;
public class DRConfigurationTests : RMTestBase

public class DRConfigurationTests : EventHubTestRunner
{
public XunitTracingInterceptor _logger;

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

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void DRConfigurationsCURD()
{
EventHubsController.NewInstance.RunPsTest(_logger, "DRConfigurationTests");
TestRunner.RunTestScript("DRConfigurationTests");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void DRConfigurationsCURDAlternateName()
{
EventHubsController.NewInstance.RunPsTest(_logger, "DRConfigurationTestsAlternateName");
TestRunner.RunTestScript("DRConfigurationTestsAlternateName");
}
}
}
66 changes: 66 additions & 0 deletions src/EventHub/EventHub.Test/ScenarioTests/EventHubTestRunner.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// ----------------------------------------------------------------------------------
//
// 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 Microsoft.WindowsAzure.Commands.ScenarioTest;
using Xunit.Abstractions;

namespace Microsoft.Azure.Commands.EventHub.Test.ScenarioTests
{
public class EventHubTestRunner
{
protected readonly ITestRunner TestRunner;

protected EventHubTestRunner(ITestOutputHelper output)
{
TestRunner = TestFx.TestManager.CreateInstance(output)
.WithNewPsScriptFilename($"{GetType().Name}.ps1")
.WithProjectSubfolderForTests("ScenarioTests")
.WithCommonPsScripts(new[]
{
@"../AzureRM.Resources.ps1",
@"../AzureRM.Storage.ps1"
})
.WithNewRmModules(helper => new[]
{
helper.RMProfileModule,
helper.GetRMModulePath("AzureRM.EventHub.psd1"),
helper.GetRMModulePath("AzureRM.KeyVault.psd1"),

})
.WithRecordMatcher(
(ignoreResourcesClient, resourceProviders, userAgentsToIgnore) =>
new PermissiveRecordMatcherWithApiExclusion(ignoreResourcesClient, resourceProviders, userAgentsToIgnore)
)
.WithNewRecordMatcherArguments(
userAgentsToIgnore: new Dictionary<string, string>
{
{"Microsoft.Azure.Management.Resources.ResourceManagementClient", "2016-02-01"},
{"Microsoft.Azure.Management.ResourceManager.ResourceManagementClient", "2017-05-10"},
{"Microsoft.Azure.Management.Internal.Resources.ResourceManagementClient", "2016-09-01"},
},
resourceProviders: new Dictionary<string, string>
{
{"Microsoft.Resources", null},
{"Microsoft.Features", null},
{"Microsoft.Authorization", null},
{"Microsoft.EventHub", null},
{"Microsoft.KeyVault", null},
}
)
.Build();
}
}
}
23 changes: 10 additions & 13 deletions src/EventHub/EventHub.Test/ScenarioTests/EventHubs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,35 +12,32 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Xunit;

namespace Microsoft.Azure.Commands.EventHub.Test.ScenarioTests
{
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
using ServiceManagement.Common.Models;
using Xunit;
using Xunit.Abstractions;
public class EventHubsTests : RMTestBase
{
public XunitTracingInterceptor _logger;

public EventHubsTests(ITestOutputHelper output)
public class EventHubsTests : EventHubTestRunner
{

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

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void EventHubsCRUD()
{
EventHubsController.NewInstance.RunPsTest(_logger, "EventHubsTests");
TestRunner.RunTestScript("EventHubsTests");
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void EventHubsAuthorizationRulesCRUD()
{
EventHubsController.NewInstance.RunPsTest(_logger, "EventHubsAuthTests");
TestRunner.RunTestScript("EventHubsAuthTests");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,30 +12,23 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Xunit;

namespace Microsoft.Azure.Commands.EventHub.Test.ScenarioTests
{
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Microsoft.WindowsAzure.Commands.Test.Utilities.Common;
using ScenarioTest;
using ServiceManagement.Common.Models;
using Xunit;
using Xunit.Abstractions;
public class EventHubsConsumerGroupsSkipTopTests : RMTestBase
public class EventHubsConsumerGroupsSkipTopTests : EventHubTestRunner
{
public XunitTracingInterceptor _logger;

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

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void EventHubsConsumerGroupsskiptop()
{
EventHubsController.NewInstance.RunPsTest(_logger, "SkipTopTests");
TestRunner.RunTestScript("SkipTopTests");
}

}
Expand Down
129 changes: 0 additions & 129 deletions src/EventHub/EventHub.Test/ScenarioTests/EventHubsController.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ function EventHubsTests
$createdEventHub.CaptureDescription.Destination.Name = "EventHubArchive.AzureBlockBlob"
$createdEventHub.CaptureDescription.Destination.BlobContainer = "container01"
$createdEventHub.CaptureDescription.Destination.ArchiveNameFormat = "{Namespace}/{EventHub}/{PartitionId}/{Year}/{Month}/{Day}/{Hour}/{Minute}/{Second}"
$createdEventHub.CaptureDescription.Destination.StorageAccountResourceId = "/subscriptions/854d368f-1828-428f-8f3c-f2affa9b2f7d/resourcegroups/v-ajnavtest/providers/Microsoft.Storage/storageAccounts/testingsdkeventhub11"
$createdEventHub.CaptureDescription.Destination.StorageAccountResourceId = "/subscriptions/326100e2-f69d-4268-8503-075374f62b6e/resourcegroups/v-ajnavtest/providers/Microsoft.Storage/storageAccounts/testingsdkeventhubnew"

$result = Set-AzEventHub -ResourceGroup $resourceGroupName -Namespace $namespaceName -Name $createdEventHub.Name -InputObject $createdEventHub

Expand Down
Loading