Skip to content

Commit 1b3dc61

Browse files
unknownunknown
authored andcommitted
Fix PIR tests.
1 parent ead1b01 commit 1b3dc61

File tree

6 files changed

+32
-81
lines changed

6 files changed

+32
-81
lines changed

src/ServiceManagement/Compute/Commands.ServiceManagement.Test/Commands.ServiceManagement.Test.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,6 @@
381381
<Compile Include="FunctionalTests\IaasCmdletInfo\NewAzureQuickVMCmdletInfo.cs" />
382382
<Compile Include="FunctionalTests\IaasCmdletInfo\NewAzureStorageAccountCmdletInfo.cs" />
383383
<Compile Include="FunctionalTests\SubscriptionCmdletInfo\SetAzureSubscriptionCmdletInfo.cs" />
384-
<Compile Include="FunctionalTests\IaasCmdletInfo\WindowsAzurePowershellCmdletSequence.cs" />
385384
<Compile Include="FunctionalTests\IaasCmdletInfo\WindowsAzurePowershellCmdlet.cs" />
386385
<Compile Include="FunctionalTests\PowershellCore\CmdletsInfo.cs" />
387386
<Compile Include="FunctionalTests\PowershellCore\CmdletParam.cs" />

src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/IaasCmdletInfo/WindowsAzurePowershellCmdlet.cs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15-
using System.IO;
1615
using Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests.PowershellCore;
16+
using System.IO;
1717

1818
namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests.IaasCmdletInfo
1919
{
@@ -38,10 +38,13 @@ public static string[] Modules
3838

3939
private static PowershellModule[] ConstructModules()
4040
{
41-
return new[]
41+
var modules = new[]
4242
{
43-
new PowershellModule(Utilities.windowsAzurePowershellServiceModule, Utilities.windowsAzurePowershellPath)
43+
new PowershellModule(Utilities.windowsAzurePowershellServiceModule, Utilities.windowsAzurePowershellPath),
44+
new PowershellModule(Utilities.AzurePowershellModuleServiceManagementPirModule, Utilities.windowsAzurePowershellDefaultPath),
45+
new PowershellModule(Utilities.AzurePowershellModuleServiceManagementPreviewModule, Utilities.windowsAzurePowershellDefaultPath),
4446
};
47+
return modules;
4548
}
4649
}
4750
}

src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/IaasCmdletInfo/WindowsAzurePowershellCmdletSequence.cs

Lines changed: 0 additions & 52 deletions
This file was deleted.

src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/IaasCmdletInfo/WindowsAzurePowershellScript.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15+
using Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests.PowershellCore;
1516
using System.Collections.Generic;
1617
using System.IO;
17-
using Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests.PowershellCore;
1818

1919
namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests.IaasCmdletInfo
2020
{

src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/PowershellCore/PowershellEnvironment.cs

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,23 @@ public abstract class PowershellEnvironment
2727

2828
public PowershellEnvironment(params PowershellModule[] modules)
2929
{
30-
initialSessionState = InitialSessionState.CreateDefault();
31-
string[] moduleFullPath=new string[modules.Length];
32-
for(int i=0;i<modules.Length;i++)
30+
if (modules == null)
3331
{
34-
moduleFullPath[i] = modules[i].FullPath;
35-
initialSessionState.Assemblies.Add(new SessionStateAssemblyEntry(modules[i].FullPath));
32+
runspace = RunspaceFactory.CreateRunspace();
33+
}
34+
else
35+
{
36+
initialSessionState = InitialSessionState.CreateDefault();
37+
string[] moduleFullPath = new string[modules.Length];
38+
for (int i = 0; i < modules.Length; i++)
39+
{
40+
moduleFullPath[i] = modules[i].FullPath;
41+
initialSessionState.Assemblies.Add(new SessionStateAssemblyEntry(modules[i].FullPath));
42+
}
43+
initialSessionState.ImportPSModule(moduleFullPath);
44+
45+
runspace = RunspaceFactory.CreateRunspace(initialSessionState);
3646
}
37-
initialSessionState.ImportPSModule(moduleFullPath);
38-
39-
runspace = RunspaceFactory.CreateRunspace(initialSessionState);
4047
}
4148

4249
public PowershellEnvironment()

src/ServiceManagement/Compute/Commands.ServiceManagement.Test/FunctionalTests/Utilities.cs

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,17 @@
1212
// limitations under the License.
1313
// ----------------------------------------------------------------------------------
1414

15+
using Microsoft.VisualStudio.TestTools.UnitTesting;
16+
using Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.Extensions;
17+
using Microsoft.WindowsAzure.Commands.ServiceManagement.Model;
18+
using Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests.ConfigDataInfo;
19+
using Microsoft.WindowsAzure.Commands.Sync.Download;
20+
using Microsoft.WindowsAzure.Storage.Auth;
21+
using Microsoft.WindowsAzure.Storage.Blob;
22+
using Security.Cryptography;
23+
using Security.Cryptography.X509Certificates;
1524
using System;
1625
using System.Collections.Generic;
17-
using System.Diagnostics;
1826
using System.IO;
1927
using System.Reflection;
2028
using System.Security;
@@ -24,15 +32,6 @@
2432
using System.Text.RegularExpressions;
2533
using System.Threading;
2634
using System.Xml;
27-
using Microsoft.VisualStudio.TestTools.UnitTesting;
28-
using Microsoft.WindowsAzure.Commands.ServiceManagement.IaaS.Extensions;
29-
using Microsoft.WindowsAzure.Commands.ServiceManagement.Model;
30-
using Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests.ConfigDataInfo;
31-
using Microsoft.WindowsAzure.Commands.Sync.Download;
32-
using Microsoft.WindowsAzure.Storage.Auth;
33-
using Microsoft.WindowsAzure.Storage.Blob;
34-
using Security.Cryptography;
35-
using Security.Cryptography.X509Certificates;
3635

3736
namespace Microsoft.WindowsAzure.Commands.ServiceManagement.Test.FunctionalTests
3837
{
@@ -41,14 +40,9 @@ internal class Utilities
4140
#region Constants
4241

4342
public static string windowsAzurePowershellPath = Path.Combine(Environment.CurrentDirectory, "ServiceManagement\\Azure");
43+
public static string windowsAzurePowershellDefaultPath = Environment.CurrentDirectory;
4444

4545
public const string windowsAzurePowershellServiceModule = "Azure.psd1";
46-
public const string windowsAzurePowershellModuleServiceManagementPlatformImageRepository = "PIR.psd1";
47-
public const string windowsAzurePowershellModuleServiceManagementPreview = "AzurePreview.psd1";
48-
49-
public const string AzurePowershellCommandsModule = "Microsoft.WindowsAzure.Commands.dll";
50-
public const string AzurePowershellServiceManagementModule = "Microsoft.WindowsAzure.Commands.ServiceManagement.dll";
51-
public const string AzurePowershellStorageModule = "Microsoft.WindowsAzure.Commands.Storage.dll";
5246
public const string AzurePowershellModuleServiceManagementPirModule = "Microsoft.WindowsAzure.Commands.ServiceManagement.PlatformImageRepository.dll";
5347
public const string AzurePowershellModuleServiceManagementPreviewModule = "Microsoft.WindowsAzure.Commands.ServiceManagement.Preview.dll";
5448

0 commit comments

Comments
 (0)