Skip to content

Commit 04f2f8d

Browse files
author
Hovsep Mkrtchyan
committed
Fixed CDN cmdlet and test logs
1 parent 6dfedfd commit 04f2f8d

File tree

7 files changed

+31
-18
lines changed

7 files changed

+31
-18
lines changed

src/ResourceManager/Cdn/Commands.Cdn.Test/ScenarioTests/CustomDomainTests.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,26 @@ namespace Microsoft.Azure.Commands.Cdn.Test.ScenarioTests.ScenarioTest
1919
{
2020
public class CustomDomainTests
2121
{
22+
private ServiceManagemenet.Common.Models.XunitTracingInterceptor _logger;
23+
2224
public CustomDomainTests(Xunit.Abstractions.ITestOutputHelper output)
2325
{
24-
ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
26+
_logger = new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output);
27+
ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(_logger);
2528
}
2629

2730
[Fact]
2831
[Trait(Category.AcceptanceType, Category.CheckIn)]
2932
public void TestCustomDomainGetRemoveWithRunningEndpoint()
3033
{
31-
TestController.NewInstance.RunPowerShellTest("Test-CustomDomainGetRemoveWithRunningEndpoint");
34+
TestController.NewInstance.RunPowerShellTest(_logger, "Test-CustomDomainGetRemoveWithRunningEndpoint");
3235
}
3336

3437
[Fact]
3538
[Trait(Category.AcceptanceType, Category.CheckIn)]
3639
public void TestCustomDomainGetRemoveWithStoppedEndpoint()
3740
{
38-
TestController.NewInstance.RunPowerShellTest("Test-CustomDomainGetRemoveWithStoppedEndpoint");
41+
TestController.NewInstance.RunPowerShellTest(_logger, "Test-CustomDomainGetRemoveWithStoppedEndpoint");
3942
}
4043
}
4144
}

src/ResourceManager/Cdn/Commands.Cdn.Test/ScenarioTests/EndpointTests.cs

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,37 +19,40 @@ namespace Microsoft.Azure.Commands.Cdn.Test.ScenarioTests.ScenarioTest
1919
{
2020
public class EndpointTests
2121
{
22+
private ServiceManagemenet.Common.Models.XunitTracingInterceptor _logger;
23+
2224
public EndpointTests(Xunit.Abstractions.ITestOutputHelper output)
2325
{
24-
ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
26+
_logger = new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output);
27+
ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(_logger);
2528
}
2629

2730
[Fact]
2831
[Trait(Category.AcceptanceType, Category.CheckIn)]
2932
public void TestEndpointCrudAndAction()
3033
{
31-
TestController.NewInstance.RunPowerShellTest("Test-EndpointCrudAndAction");
34+
TestController.NewInstance.RunPowerShellTest(_logger, "Test-EndpointCrudAndAction");
3235
}
3336

3437
[Fact]
3538
[Trait(Category.AcceptanceType, Category.CheckIn)]
3639
public void TestEndpointCrudAndActionWithPiping()
3740
{
38-
TestController.NewInstance.RunPowerShellTest("Test-EndpointCrudAndActionWithPiping");
41+
TestController.NewInstance.RunPowerShellTest(_logger, "Test-EndpointCrudAndActionWithPiping");
3942
}
4043

4144
[Fact]
4245
[Trait(Category.AcceptanceType, Category.CheckIn)]
4346
public void TestEndpointCrudAndActionWithAllProperties()
4447
{
45-
TestController.NewInstance.RunPowerShellTest("Test-EndpointCrudAndActionWithAllProperties");
48+
TestController.NewInstance.RunPowerShellTest(_logger, "Test-EndpointCrudAndActionWithAllProperties");
4649
}
4750

4851
[Fact]
4952
[Trait(Category.AcceptanceType, Category.CheckIn)]
5053
public void TestEndpointCrudAndActionWithAllPropertiesWithPiping()
5154
{
52-
TestController.NewInstance.RunPowerShellTest("Test-EndpointCrudAndActionWithAllPropertiesWithPiping");
55+
TestController.NewInstance.RunPowerShellTest(_logger, "Test-EndpointCrudAndActionWithAllPropertiesWithPiping");
5356
}
5457
}
5558
}

src/ResourceManager/Cdn/Commands.Cdn.Test/ScenarioTests/OriginTests.cs

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,30 +19,33 @@ namespace Microsoft.Azure.Commands.Cdn.Test.ScenarioTests.ScenarioTest
1919
{
2020
public class OriginTests
2121
{
22+
private ServiceManagemenet.Common.Models.XunitTracingInterceptor _logger;
23+
2224
public OriginTests(Xunit.Abstractions.ITestOutputHelper output)
2325
{
24-
ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
26+
_logger = new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output);
27+
ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(_logger);
2528
}
2629

2730
[Fact]
2831
[Trait(Category.AcceptanceType, Category.CheckIn)]
2932
public void TestOriginGetSetWithRunningEndpoint()
3033
{
31-
TestController.NewInstance.RunPowerShellTest("Test-OriginGetSetWithRunningEndpoint");
34+
TestController.NewInstance.RunPowerShellTest(_logger, "Test-OriginGetSetWithRunningEndpoint");
3235
}
3336

3437
[Fact]
3538
[Trait(Category.AcceptanceType, Category.CheckIn)]
3639
public void TestOriginGetSetWithStoppedEndpoint()
3740
{
38-
TestController.NewInstance.RunPowerShellTest("Test-OriginGetSetWithStoppedEndpoint");
41+
TestController.NewInstance.RunPowerShellTest(_logger, "Test-OriginGetSetWithStoppedEndpoint");
3942
}
4043

4144
[Fact]
4245
[Trait(Category.AcceptanceType, Category.CheckIn)]
4346
public void TestOriginGetSetWhenEndpointDoesnotExist()
4447
{
45-
TestController.NewInstance.RunPowerShellTest("Test-OriginGetSetWhenEndpointDoesnotExist");
48+
TestController.NewInstance.RunPowerShellTest(_logger, "Test-OriginGetSetWhenEndpointDoesnotExist");
4649
}
4750
}
4851
}

src/ResourceManager/Cdn/Commands.Cdn.Test/ScenarioTests/ProfileTests.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,23 +19,26 @@ namespace Microsoft.Azure.Commands.Cdn.Test.ScenarioTests.ScenarioTest
1919
{
2020
public class ProfileTests
2121
{
22+
private ServiceManagemenet.Common.Models.XunitTracingInterceptor _logger;
23+
2224
public ProfileTests(Xunit.Abstractions.ITestOutputHelper output)
2325
{
24-
ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output));
26+
_logger = new ServiceManagemenet.Common.Models.XunitTracingInterceptor(output);
27+
ServiceManagemenet.Common.Models.XunitTracingInterceptor.AddToContext(_logger);
2528
}
2629

2730
[Fact]
2831
[Trait(Category.AcceptanceType, Category.CheckIn)]
2932
public void TestProfileCrud()
3033
{
31-
TestController.NewInstance.RunPowerShellTest("Test-ProfileCrud");
34+
TestController.NewInstance.RunPowerShellTest(_logger, "Test-ProfileCrud");
3235
}
3336

3437
[Fact]
3538
[Trait(Category.AcceptanceType, Category.CheckIn)]
3639
public void TestProfileCrudWithPiping()
3740
{
38-
TestController.NewInstance.RunPowerShellTest("Test-ProfileDeleteAndSsoWithPiping");
41+
TestController.NewInstance.RunPowerShellTest(_logger, "Test-ProfileDeleteAndSsoWithPiping");
3942
}
4043
}
4144
}

src/ResourceManager/Cdn/Commands.Cdn.Test/ScenarioTests/TestController.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,12 @@ protected void SetupManagementClients(MockContext context)
7878
CdnManagementClient);
7979
}
8080

81-
public void RunPowerShellTest(params string[] scripts)
81+
public void RunPowerShellTest(ServiceManagemenet.Common.Models.XunitTracingInterceptor logger, params string[] scripts)
8282
{
8383
var callingClassType = TestUtilities.GetCallingClass(2);
8484
var mockName = TestUtilities.GetCurrentMethodName(2);
8585

86+
_helper.TracingInterceptor = logger;
8687
RunPsTestWorkflow(
8788
() => scripts,
8889
// no custom initializer
@@ -136,7 +137,6 @@ public void RunPsTestWorkflow(
136137
_helper.RMProfileModule,
137138
_helper.RMResourceModule,
138139
@"AzureRM.Cdn.psd1");
139-
140140
try
141141
{
142142
if (scriptBuilder != null)

src/ResourceManager/Cdn/Commands.Cdn/CustomDomain/NewAzureRmCdnCustomDomain.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public void OnImport()
9999
System.Management.Automation.PowerShell invoker = null;
100100
invoker = System.Management.Automation.PowerShell.Create(RunspaceMode.CurrentRunspace);
101101
invoker.AddScript(File.ReadAllText(FileUtilities.GetContentFilePath(
102-
Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
102+
Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory),
103103
"CdnStartup.ps1")));
104104
invoker.Invoke();
105105
}

src/ServiceManagement/Services/Commands.Test/Profile/ProfileCmdltsTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1007,6 +1007,7 @@ public void AddAzureAccountThrowsForEmptySubscriptions()
10071007
cmdlet.InvokeBeginProcessing();
10081008
Assert.Throws<ArgumentException>(() => cmdlet.ExecuteCmdlet());
10091009
}
1010+
10101011
[Fact]
10111012
[Trait(Category.AcceptanceType, Category.CheckIn)]
10121013
public void CanCreateProfieWithSPAuth()

0 commit comments

Comments
 (0)