Skip to content

HPF PR: dev <- huangpf:dev #187

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

Merged
merged 28 commits into from
Mar 19, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
5b9c465
Merge branch 'dev' of github.com:Azure/azure-powershell into dev
Mar 15, 2016
434c188
Merge branch 'dev' of github.com:Azure/azure-powershell into dev
Mar 16, 2016
9b430ab
Moved Storage package to a separate folder.
Mar 17, 2016
e20c346
Merge branch 'dev' of github.com:Azure/azure-powershell into dev
Mar 17, 2016
c5451d5
Fixed ServiceManagement solution.
Mar 17, 2016
bec08fc
Adding AzureStorage to build.proj
Mar 17, 2016
4a60003
Fixed build breaks.
Mar 17, 2016
94dc009
Regenerated wxi file.
Mar 17, 2016
8119886
Changed Azure.Storage folder to Storage for the MSI
Mar 17, 2016
054bfcb
Fixed wxi file
Mar 17, 2016
b480b67
Fixed Azure.Storage.psd1 test reference path.
Mar 17, 2016
40c7568
Removed dependency range from Azure modules because it is supported f…
Mar 17, 2016
8f4c728
Fixed ASM test environment setup.
Mar 17, 2016
797554e
Changed location of MSI installation path
Mar 18, 2016
bb01c36
Fixed test locations in ASM tests.
Mar 18, 2016
3e6ce77
Removed RunAzurePlatformVMImageNegativeTest flaky test from CI
Mar 18, 2016
337bf67
Setting script load sequence.
Mar 18, 2016
ca4a003
Cleaning powershell error stream before test execution.
Mar 18, 2016
cac1a1d
Merge branch 'dev' of github.com:Azure/azure-powershell into dev
Mar 18, 2016
2dbdd1c
Fixed AzureBackupVaultScenarioTests test
Mar 18, 2016
c8ccab3
Skipping failing test
Mar 18, 2016
91495a5
Changing the location of the Compute scripts.
Mar 18, 2016
c1f11c5
Adding more details to test failure.
Mar 19, 2016
306c142
Giving better formatting to Powershell test execution.
Mar 19, 2016
e28b0be
Fixing module path for compute PIR.psd1 and AzurePreview.psd1 modules
Mar 19, 2016
2559e42
Skipped failing tests. they will be covered by https://www.pivotaltra…
Mar 19, 2016
c0b3a75
Merge pull request #1957 from hovsepm/dev
Mar 19, 2016
4c0087d
Merge pull request #485 from Azure/dev
huangpf Mar 19, 2016
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
6 changes: 4 additions & 2 deletions build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,15 @@
<Scope Condition=" $(Scope) == '' " >all</Scope>
</PropertyGroup>
<ItemGroup>
<CmdletSolutionsToBuild Include=".\src\ResourceManager\**\*.sln;.\src\ServiceManagement\ServiceManagement.sln"
<CmdletSolutionsToBuild Include=".\src\ResourceManager\**\*.sln;.\src\ServiceManagement\ServiceManagement.sln;.\src\Storage\Storage.sln"
Exclude=".\src\ResourceManager\Intune\*.sln"
Condition=" '$(Scope)' == 'all' "/>
<CmdletSolutionsToBuild Include=".\src\ResourceManager\$(Scope)\*.sln"
Condition=" '$(Scope)' != 'all' and '$(Scope)' != 'ServiceManagement' and '$(Scope)' != 'AzureStorage' "/>
<CmdletSolutionsToBuild Include=".\src\ServiceManagement\ServiceManagement.sln"
Condition=" '$(Scope)' == 'ServiceManagement' or '$(Scope)' == 'AzureStorage' "/>
Condition=" '$(Scope)' == 'ServiceManagement'"/>
<CmdletSolutionsToBuild Include=".\src\Storage\Storage.sln"
Condition=" '$(Scope)' == 'AzureStorage' "/>
<SetupSln Include=".\setup\azurepowershell.sln" />
<StaticAnalysis Include=".\tools\StaticAnalysis\StaticAnalysis.sln" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion setup/azurecmd.wxs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
<Component Id="PSModulePath.System" Guid="273525B9-7AAB-421A-90C8-8E50A1840B8D">
<CreateFolder />
<!-- Work around bug that PowerShell does not always consider default module paths. -->
<Environment Id="PSModulePath.SystemAppRoot" Action="set" Name="PSMODULEPATH" Part="last" Value="[BaseModulesFolder];[PowerShellFolder]ResourceManager\AzureResourceManager\;[PowerShellFolder]ServiceManagement\" System="yes" />
<Environment Id="PSModulePath.SystemAppRoot" Action="set" Name="PSMODULEPATH" Part="last" Value="[BaseModulesFolder];[PowerShellFolder]ResourceManager\AzureResourceManager\;[PowerShellFolder]ServiceManagement\;[PowerShellFolder]\Storage" System="yes" />
</Component>
</DirectoryRef>

Expand Down
448 changes: 144 additions & 304 deletions setup/azurecmdfiles.wxi

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public static class WindowsAzureSubscriptionExtensions
/// <summary>
/// Get storage account details from the current storage account
/// </summary>
/// <param name="subscription">The subscription continign the account.</param>
/// <param name="profile">The profile continaing the subscription.</param>
/// <param name="subscription">The subscription containing the account.</param>
/// <param name="profile">The profile continuing the subscription.</param>
/// <returns>Storage account details, usable with the windows azure storage data plane library.</returns>
public static CloudStorageAccount GetCloudStorageAccount(this AzureSubscription subscription, AzureSMProfile profile)
{
Expand Down
7 changes: 7 additions & 0 deletions src/Common/Commands.Common/CmdletExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,22 @@
// limitations under the License.
// ----------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.IO;
using System.Management.Automation;
using System.Reflection;

namespace Microsoft.WindowsAzure.Commands.Utilities.Common
{
public static class CmdletExtensions
{
public static string AsAbsoluteLocation(this string realtivePath)
{
return Path.GetFullPath(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, realtivePath));
}

public static string TryResolvePath(this PSCmdlet psCmdlet, string path)
{
try
Expand Down
97 changes: 69 additions & 28 deletions src/Common/Commands.ScenarioTests.Common/EnvironmentSetupHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
using System.Management.Automation;
using System.Security.Cryptography.X509Certificates;
using Microsoft.Azure.ServiceManagemenet.Common;
using System.Text;

namespace Microsoft.WindowsAzure.Commands.ScenarioTest
{
Expand All @@ -41,7 +42,7 @@ public class EnvironmentSetupHelper
private AzureAccount testAccount;

private const string PackageDirectoryFromCommon = @"..\..\..\..\Package\Debug";
private const string PackageDirectory = @"..\..\..\..\..\Package\Debug";
public const string PackageDirectory = @"..\..\..\..\..\Package\Debug";

protected List<string> modules;

Expand Down Expand Up @@ -210,11 +211,15 @@ public void SetupModules(AzureModule mode, params string[] modules)
this.modules = new List<string>();
if (mode == AzureModule.AzureProfile)
{
this.modules.Add(Path.Combine(PackageDirectory, @"ResourceManager\AzureResourceManager\AzureRM.Profile\AzureRM.Profile.psd1"));
this.modules.Add(Path.Combine(PackageDirectory, @"Storage\Azure.Storage\Azure.Storage.psd1"));
this.modules.Add(Path.Combine(PackageDirectory, @"ServiceManagement\Azure\Azure.psd1"));
this.modules.Add(Path.Combine(PackageDirectory, @"ResourceManager\AzureResourceManager\AzureResourceManager.psd1"));
}
else if (mode == AzureModule.AzureServiceManagement)
{
this.modules.Add(Path.Combine(PackageDirectory, @"ResourceManager\AzureResourceManager\AzureRM.Profile\AzureRM.Profile.psd1"));
this.modules.Add(Path.Combine(PackageDirectory, @"Storage\Azure.Storage\Azure.Storage.psd1"));
this.modules.Add(Path.Combine(PackageDirectory, @"ServiceManagement\Azure\Azure.psd1"));
}
else if (mode == AzureModule.AzureResourceManager)
Expand All @@ -235,11 +240,15 @@ public void SetupModulesFromCommon(AzureModule mode, params string[] modules)
this.modules = new List<string>();
if (mode == AzureModule.AzureProfile)
{
this.modules.Add(Path.Combine(PackageDirectoryFromCommon, @"ResourceManager\AzureResourceManager\AzureRM.Profile\AzureRM.Profile.psd1"));
this.modules.Add(Path.Combine(PackageDirectoryFromCommon, @"Storage\Azure.Storage\Azure.Storage.psd1"));
this.modules.Add(Path.Combine(PackageDirectoryFromCommon, @"ServiceManagement\Azure\Azure.psd1"));
this.modules.Add(Path.Combine(PackageDirectoryFromCommon, @"ResourceManager\AzureResourceManager\AzureResourceManager.psd1"));
}
else if (mode == AzureModule.AzureServiceManagement)
{
this.modules.Add(Path.Combine(PackageDirectoryFromCommon, @"ResourceManager\AzureResourceManager\AzureRM.Profile\AzureRM.Profile.psd1"));
this.modules.Add(Path.Combine(PackageDirectoryFromCommon, @"Storage\Azure.Storage\Azure.Storage.psd1"));
this.modules.Add(Path.Combine(PackageDirectoryFromCommon, @"ServiceManagement\Azure\Azure.psd1"));
}
else if (mode == AzureModule.AzureResourceManager)
Expand All @@ -263,53 +272,85 @@ public void SetupModules(params string[] modules)
this.modules.AddRange(modules);
}


public virtual Collection<PSObject> RunPowerShellTest(params string[] scripts)
{
using (var powershell = System.Management.Automation.PowerShell.Create(RunspaceMode.NewRunspace))
{
SetupPowerShellModules(powershell);
return ExecuteShellTest(powershell, null, scripts);
}
}
public virtual Collection<PSObject> RunPowerShellTest(IEnumerable<string> setupScripts, IEnumerable<string> scripts)
{
using (var powershell = System.Management.Automation.PowerShell.Create(RunspaceMode.NewRunspace))
{
return ExecuteShellTest(powershell, setupScripts, scripts);
}
}

Collection<PSObject> output = null;
for (int i = 0; i < scripts.Length; ++i)
{
Console.WriteLine(scripts[i]);
powershell.AddScript(scripts[i]);
}
try
private Collection<PSObject> ExecuteShellTest(
System.Management.Automation.PowerShell powershell,
IEnumerable<string> setupScripts,
IEnumerable<string> scripts)
{
SetupPowerShellModules(powershell, null);

Collection<PSObject> output = null;

foreach (var script in scripts)
{
Console.WriteLine(script);
powershell.AddScript(script);
}
try
{
powershell.Runspace.Events.Subscribers.Clear();
powershell.Streams.Error.Clear();
output = powershell.Invoke();

if (powershell.Streams.Error.Count > 0)
{
powershell.Runspace.Events.Subscribers.Clear();
output = powershell.Invoke();
var sb = new StringBuilder();

if (powershell.Streams.Error.Count > 0)
sb.AppendLine("Test failed due to a non-empty error stream, check the error stream in the test log for more details.");
sb.AppendLine(string.Format("{0} total Errors", powershell.Streams.Error.Count));
foreach (var error in powershell.Streams.Error)
{
throw new RuntimeException(
"Test failed due to a non-empty error stream, check the error stream in the test log for more details.");
sb.AppendLine(error.Exception.ToString());
}

return output;
}
catch (Exception psException)
{
powershell.LogPowerShellException(psException);
throw;
}
finally
{
powershell.LogPowerShellResults(output);
powershell.Streams.Error.Clear();
throw new RuntimeException(sb.ToString());
}

return output;
}
catch (Exception psException)
{
powershell.LogPowerShellException(psException);
throw;
}
finally
{
powershell.LogPowerShellResults(output);
powershell.Streams.Error.Clear();
}
}

private void SetupPowerShellModules(System.Management.Automation.PowerShell powershell)
private void SetupPowerShellModules(System.Management.Automation.PowerShell powershell, IEnumerable<string> setupScripts)
{
powershell.AddScript("$error.clear()");
powershell.AddScript(string.Format("cd \"{0}\"", AppDomain.CurrentDomain.BaseDirectory));
if (setupScripts != null)
{
foreach(var script in setupScripts)
{
powershell.AddScript(script);
}
}

foreach (string moduleName in modules)
{
powershell.AddScript(string.Format("Import-Module \"{0}\"",
Path.Combine(AppDomain.CurrentDomain.BaseDirectory, moduleName)));
powershell.AddScript(string.Format("Import-Module \"{0}\"", moduleName.AsAbsoluteLocation()));
}

powershell.AddScript(
Expand Down
27 changes: 0 additions & 27 deletions src/Common/Storage/Commands.Storage/PostBuild.ps1

This file was deleted.

2 changes: 1 addition & 1 deletion src/ResourceManager/ApiManagement/ApiManagement.sln
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Management.Storage
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Resources.Rest", "..\Resources\Commands.ResourceManager\Cmdlets\Commands.Resources.Rest.csproj", "{8058D403-06E3-4BED-8924-D166CE303961}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Storage", "..\..\Common\Storage\Commands.Storage\Commands.Storage.csproj", "{08CF7DA7-0392-4A19-B79B-E1FF67CDB81A}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Storage", "..\..\Storage\Commands.Storage\Commands.Storage.csproj", "{08CF7DA7-0392-4A19-B79B-E1FF67CDB81A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Common\Commands.Common\Commands.Common.csproj", "{5EE72C53-1720-4309-B54B-5FB79703195F}"
EndProject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ CLRVersion='4.0'
ProcessorArchitecture = 'None'

# Modules that must be imported into the global environment prior to importing this module
RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; MaximumVersion = '1.9999.9999.9999'; ModuleVersion = '1.0.5'})
RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '1.0.5'})

# Assemblies that must be loaded prior to importing this module
RequiredAssemblies = @()
Expand Down
2 changes: 1 addition & 1 deletion src/ResourceManager/Automation/AzureRM.Automation.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ CLRVersion='4.0'
ProcessorArchitecture = 'None'

# Modules that must be imported into the global environment prior to importing this module
RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; MaximumVersion = '1.9999.9999.9999'; ModuleVersion = '1.0.5'})
RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '1.0.5'})

# Assemblies that must be loaded prior to importing this module
RequiredAssemblies = @()
Expand Down
2 changes: 1 addition & 1 deletion src/ResourceManager/AzureBackup/AzureRM.Backup.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ CLRVersion='4.0'
ProcessorArchitecture = 'None'

# Modules that must be imported into the global environment prior to importing this module
RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; MaximumVersion = '1.9999.9999.9999'; ModuleVersion = '1.0.5'})
RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '1.0.5'})

# Assemblies that must be loaded prior to importing this module
RequiredAssemblies = @()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,6 @@
"x-ms-client-request-id": [
"ff97c9dd-5838-4ec9-802a-dc1f5f06a3bf-2015-08-16 19:16:03Z-PS"
],
"x-ms-version": [
"2013-03-01"
],
"User-Agent": [
"Microsoft.Azure.Management.BackupServices.BackupVaultServicesManagementClient/0.0.0.0"
]
Expand Down Expand Up @@ -148,9 +145,6 @@
"x-ms-client-request-id": [
"fd70aa7c-a1db-42ed-8295-5cec7663d72d-2015-08-16 19:16:19Z-PS"
],
"x-ms-version": [
"2013-03-01"
],
"User-Agent": [
"Microsoft.Azure.Management.BackupServices.BackupVaultServicesManagementClient/0.0.0.0"
]
Expand Down Expand Up @@ -515,9 +509,6 @@
"x-ms-client-request-id": [
"43cf16e7-e7a0-4d56-8eb5-66f9ecee0ff4-2015-08-16 19:16:15Z-PS"
],
"x-ms-version": [
"2013-03-01"
],
"User-Agent": [
"Microsoft.Azure.Management.BackupServices.BackupVaultServicesManagementClient/0.0.0.0"
]
Expand Down
2 changes: 1 addition & 1 deletion src/ResourceManager/AzureBatch/AzureRM.Batch.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ CLRVersion='4.0'
ProcessorArchitecture = 'None'

# Modules that must be imported into the global environment prior to importing this module
RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; MaximumVersion = '1.9999.9999.9999'; ModuleVersion = '1.0.5'})
RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '1.0.5'})

# Assemblies that must be loaded prior to importing this module
RequiredAssemblies = @()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ CLRVersion = '4.0'
ProcessorArchitecture = ''

# Modules that must be imported into the global environment prior to importing this module
RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; MaximumVersion = '1.9999.9999.9999'; ModuleVersion = '1.0.4'})
RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '1.0.4'})

# Assemblies that must be loaded prior to importing this module
# RequiredAssemblies = @()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ CLRVersion='4.0'
ProcessorArchitecture = 'None'

# Modules that must be imported into the global environment prior to importing this module
RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; MaximumVersion = '1.9999.9999.9999'; ModuleVersion = '1.0.4'})
RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '1.0.4'})

# Assemblies that must be loaded prior to importing this module
RequiredAssemblies = @()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public string RMStorageDataPlaneModule
get
{
return Path.Combine(this.PackageDirectory,
@"ResourceManager\AzureResourceManager\Azure.Storage\Azure.Storage.psd1");
@"Storage\Azure.Storage\Azure.Storage.psd1");
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/ResourceManager/Compute/AzureRM.Compute.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ CLRVersion='4.0'
ProcessorArchitecture = 'None'

# Modules that must be imported into the global environment prior to importing this module
RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; MaximumVersion = '1.9999.9999.9999'; ModuleVersion = '1.0.5'})
RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '1.0.5'})

# Assemblies that must be loaded prior to importing this module
RequiredAssemblies = @()
Expand Down
2 changes: 1 addition & 1 deletion src/ResourceManager/Compute/Compute.sln
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Common", "..\..\Co
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Resources.Rest", "..\Resources\Commands.ResourceManager\Cmdlets\Commands.Resources.Rest.csproj", "{8058D403-06E3-4BED-8924-D166CE303961}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Storage", "..\..\Common\Storage\Commands.Storage\Commands.Storage.csproj", "{08CF7DA7-0392-4A19-B79B-E1FF67CDB81A}"
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.Storage", "..\..\Storage\Commands.Storage\Commands.Storage.csproj", "{08CF7DA7-0392-4A19-B79B-E1FF67CDB81A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Commands.ServiceManagement.Common", "..\..\ServiceManagement\Common\Commands.ServiceManagement.Common\Commands.ServiceManagement.Common.csproj", "{CFF09E81-1E31-444E-B4D4-A21E946C29E2}"
EndProject
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ CLRVersion='4.0'
ProcessorArchitecture = 'None'

# Modules that must be imported into the global environment prior to importing this module
RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; MaximumVersion = '1.9999.9999.9999'; ModuleVersion = '1.0.5'})
RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '1.0.5'})

# Assemblies that must be loaded prior to importing this module
RequiredAssemblies = @()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ CLRVersion='4.0'
ProcessorArchitecture = 'None'

# Modules that must be imported into the global environment prior to importing this module
RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; MaximumVersion = '1.9999.9999.9999'; ModuleVersion = '1.0.5' })
RequiredModules = @( @{ ModuleName = 'AzureRM.Profile'; ModuleVersion = '1.0.5' })

# Assemblies that must be loaded prior to importing this module
RequiredAssemblies = @()
Expand Down
Loading