Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
</Reference>
<Reference Include="Microsoft.Azure.Management.HDInsight, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.HDInsight.1.0.10-preview\lib\net40\Microsoft.Azure.Management.HDInsight.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.HDInsight.1.0.12-preview\lib\net40\Microsoft.Azure.Management.HDInsight.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Management.HDInsight.Job">
<SpecificVersion>False</SpecificVersion>
Expand Down Expand Up @@ -163,6 +163,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="HDInsightTestBase.cs" />
<Compile Include="UnitTests\PremiumClusterTests.cs" />
<Compile Include="UnitTests\ScriptActionTests.cs" />
<None Include="ScenarioTests\HDInsightConfigurationTests.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
Tests pipelining with creating the config
#>
function Test-ConfigurationPipelining{
#test New-AzureRmHDInsightClusterConfig
$config = New-AzureRmHDInsightClusterConfig -ClusterType Hadoop
#test New-AzureRmHDInsightClusterConfig
$config = New-AzureRmHDInsightClusterConfig -ClusterType Hadoop -ClusterTier Standard
Assert-NotNull $config.ClusterType
Assert-NotNull $config.ClusterTier

#test Add-AzureRmHDInsightStorage
Assert-AreEqual $config.AdditionalStorageAccounts.Count 0
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
// ----------------------------------------------------------------------------------
//
// 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 System.Management.Automation;
using Microsoft.Azure.Commands.HDInsight.Models;
using Microsoft.Azure.Management.HDInsight.Models;
using Microsoft.WindowsAzure.Commands.Common;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Moq;
using Newtonsoft.Json;
using Xunit;

namespace Microsoft.Azure.Commands.HDInsight.Test
{
public class PremiumClusterTests : HDInsightTestBase
{
private NewAzureHDInsightClusterCommand cmdlet;
private const string StorageName = "PlaceStorageName";
private const string StorageKey = "PlaceStorageKey";
private const int ClusterSize = 4;

private readonly PSCredential _httpCred;

public PremiumClusterTests()
{
base.SetupTestsForManagement();
_httpCred = new PSCredential("hadoopuser", string.Format("Password1!").ConvertToSecureString());
cmdlet = new NewAzureHDInsightClusterCommand
{
CommandRuntime = commandRuntimeMock.Object,
HDInsightManagementClient = hdinsightManagementMock.Object
};
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void CanCreateNewPremiumHDInsightCluster()
{
cmdlet.ClusterName = ClusterName;
cmdlet.ResourceGroupName = ResourceGroupName;
cmdlet.ClusterSizeInNodes = ClusterSize;
cmdlet.Location = Location;
cmdlet.HttpCredential = _httpCred;
cmdlet.DefaultStorageAccountName = StorageName;
cmdlet.DefaultStorageAccountKey = StorageKey;
cmdlet.ClusterType = ClusterType;
cmdlet.OSType = OSType.Linux;
cmdlet.ClusterTier = Tier.Premium;
cmdlet.SshCredential = _httpCred;
var cluster = new Cluster
{
Id = "id",
Name = ClusterName,
Location = Location,
Properties = new ClusterGetProperties
{
ClusterVersion = "3.2",
ClusterState = "Running",
ClusterDefinition = new ClusterDefinition
{
ClusterType = ClusterType
},
QuotaInfo = new QuotaInfo
{
CoresUsed = 24
},
OperatingSystemType = OSType.Linux,
ClusterTier = Tier.Premium
}
};
var coreConfigs = new Dictionary<string, string>
{
{"fs.defaultFS", "wasb://giyertestcsmv2@" + StorageName},
{
"fs.azure.account.key." + StorageName,
StorageKey
}
};
var gatewayConfigs = new Dictionary<string, string>
{
{"restAuthCredential.isEnabled", "true"},
{"restAuthCredential.username", _httpCred.UserName},
{"restAuthCredential.password", _httpCred.Password.ConvertToString()}
};

var configurations = new Dictionary<string, Dictionary<string, string>>
{
{"core-site", coreConfigs},
{"gateway", gatewayConfigs}
};
var serializedConfig = JsonConvert.SerializeObject(configurations);
cluster.Properties.ClusterDefinition.Configurations = serializedConfig;

var getresponse = new ClusterGetResponse {Cluster = cluster};

hdinsightManagementMock.Setup(c => c.CreateNewCluster(ResourceGroupName, ClusterName, It.Is<ClusterCreateParameters>(
parameters =>
parameters.ClusterSizeInNodes == ClusterSize &&
parameters.DefaultStorageAccountName == StorageName &&
parameters.DefaultStorageAccountKey == StorageKey &&
parameters.Location == Location &&
parameters.UserName == _httpCred.UserName &&
parameters.Password == _httpCred.Password.ConvertToString() &&
parameters.SshUserName == _httpCred.UserName &&
parameters.SshPassword == _httpCred.Password.ConvertToString() &&
parameters.ClusterType == ClusterType &&
parameters.OSType == OSType.Linux &&
parameters.ClusterTier == Tier.Premium)))
.Returns(getresponse)
.Verifiable();

cmdlet.ExecuteCmdlet();

commandRuntimeMock.VerifyAll();
commandRuntimeMock.Verify(f => f.WriteObject(It.Is<AzureHDInsightCluster>(
clusterout =>
clusterout.ClusterState == "Running" &&
clusterout.ClusterType == ClusterType &&
clusterout.ClusterVersion == "3.2" &&
clusterout.CoresUsed == 24 &&
clusterout.Location == Location &&
clusterout.Name == ClusterName &&
clusterout.OperatingSystemType == OSType.Linux &&
clusterout.ClusterTier == Tier.Premium)),
Times.Once);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<package id="Microsoft.Azure.Gallery" version="2.6.2-preview" targetFramework="net45" />
<package id="Microsoft.Azure.KeyVault.Core" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Authorization" version="0.18.2-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.HDInsight" version="1.0.10-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.HDInsight" version="1.0.12-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.HDInsight.Job" version="2.0.0-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Resources" version="2.19.0-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Storage" version="2.4.0-preview" targetFramework="net45" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@
</Reference>
<Reference Include="Microsoft.Azure.Management.HDInsight, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<SpecificVersion>False</SpecificVersion>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.HDInsight.1.0.10-preview\lib\net40\Microsoft.Azure.Management.HDInsight.dll</HintPath>
<HintPath>..\..\..\packages\Microsoft.Azure.Management.HDInsight.1.0.12-preview\lib\net40\Microsoft.Azure.Management.HDInsight.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Management.HDInsight.Job">
<SpecificVersion>False</SpecificVersion>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ public AzureHDInsightConfig Config
var result = new AzureHDInsightConfig
{
ClusterType = parameters.ClusterType,
ClusterTier = parameters.ClusterTier,
DefaultStorageAccountName = parameters.DefaultStorageAccountName,
DefaultStorageAccountKey = parameters.DefaultStorageAccountKey,
WorkerNodeSize = parameters.WorkerNodeSize,
Expand Down Expand Up @@ -140,6 +141,7 @@ var storageAccount in
set
{
parameters.ClusterType = value.ClusterType;
parameters.ClusterTier = value.ClusterTier;
if (parameters.DefaultStorageAccountName == null)
{
parameters.DefaultStorageAccountName = value.DefaultStorageAccountName;
Expand Down Expand Up @@ -197,9 +199,9 @@ public string DefaultStorageContainer
get { return parameters.DefaultStorageContainer; }
set { parameters.DefaultStorageContainer = value; }
}

[Parameter(HelpMessage = "Gets or sets the version of the HDInsight cluster.")]
public string Version
public string Version
{
get { return parameters.Version; }
set { parameters.Version = value; }
Expand All @@ -213,7 +215,7 @@ public string HeadNodeSize
}

[Parameter(HelpMessage = "Gets or sets the size of the Data Node.")]
public string WorkerNodeSize
public string WorkerNodeSize
{
get { return parameters.WorkerNodeSize; }
set { parameters.WorkerNodeSize = value; }
Expand Down Expand Up @@ -254,6 +256,13 @@ public OSType OSType
set { parameters.OSType = value; }
}

[Parameter(HelpMessage = "Gets or sets the cluster tier for this HDInsight cluster.")]
public Tier ClusterTier
{
get { return parameters.ClusterTier; }
set { parameters.ClusterTier = value; }
}

[Parameter(HelpMessage = "Gets or sets SSH credential.")]
public PSCredential SshCredential { get; set; }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ public class NewAzureHDInsightClusterConfigCommand : HDInsightCmdletBase
#region Input Parameter Definitions

[Parameter(HelpMessage = "Gets or sets the StorageName for the default Azure Storage Account.")]
public string DefaultStorageAccountName {
public string DefaultStorageAccountName
{
get { return _config.DefaultStorageAccountName; }
set { _config.DefaultStorageAccountName = value; }
}
Expand Down Expand Up @@ -86,6 +87,14 @@ public string ClusterType
set { _config.ClusterType = value; }
}

[Parameter(HelpMessage = "Gets or sets the cluster tier for this HDInsight cluster.")]
public Tier ClusterTier
{
get { return _config.ClusterTier; }
set { _config.ClusterTier = value; }
}


[Parameter(HelpMessage = "Gets or sets the Service Principal Object Id for accessing Azure Data Lake.")]
public Guid ObjectId
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3065,6 +3065,13 @@
</maml:description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
</command:parameter>
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
<maml:name>ClusterTier</maml:name>
<maml:description>
<maml:para>The HDInsight cluster tier. By default, this is Standard. The Premium tier can only be used with Linux clusters, and it enables the use of some new features.</maml:para>
</maml:description>
<command:parameterValue required="true" variableLength="false">Tier</command:parameterValue>
</command:parameter>
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
<maml:name>VirtualNetworkId</maml:name>
<maml:description>
Expand Down Expand Up @@ -3387,6 +3394,13 @@
</dev:type>
<dev:defaultValue></dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
<maml:name>ClusterTier</maml:name>
<maml:description>
<maml:para>The HDInsight cluster tier. By default, this is Standard. The Premium tier can only be used with Linux clusters, and it enables the use of some new features.</maml:para>
</maml:description>
<command:parameterValue required="true" variableLength="false">Tier</command:parameterValue>
</command:parameter>
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
<maml:name>VirtualNetworkId</maml:name>
<maml:description>
Expand Down Expand Up @@ -3671,6 +3685,13 @@
</maml:description>
<command:parameterValue required="true" variableLength="false">String</command:parameterValue>
</command:parameter>
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
<maml:name>ClusterTier</maml:name>
<maml:description>
<maml:para>The HDInsight cluster tier. By default, this is Standard. The Premium tier can only be used with Linux clusters, and it enables the use of some new features.</maml:para>
</maml:description>
<command:parameterValue required="true" variableLength="false">Tier</command:parameterValue>
</command:parameter>
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
<maml:name>ObjectId</maml:name>
<maml:description>
Expand Down Expand Up @@ -3812,6 +3833,13 @@
</dev:type>
<dev:defaultValue></dev:defaultValue>
</command:parameter>
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
<maml:name>ClusterTier</maml:name>
<maml:description>
<maml:para>The HDInsight cluster tier. By default, this is Standard. The Premium tier can only be used with Linux clusters, and it enables the use of some new features.</maml:para>
</maml:description>
<command:parameterValue required="true" variableLength="false">Tier</command:parameterValue>
</command:parameter>
<command:parameter required="false" variableLength="false" globbing="false" pipelineInput="false" position="named">
<maml:name>ObjectId</maml:name>
<maml:description>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ public AzureHDInsightCluster(Cluster cluster)
Location = cluster.Location;
ClusterVersion = cluster.Properties.ClusterVersion;
OperatingSystemType = cluster.Properties.OperatingSystemType;
ClusterTier = cluster.Properties.ClusterTier;
ClusterState = cluster.Properties.ClusterState;
ClusterType = cluster.Properties.ClusterDefinition.ClusterType;
CoresUsed = cluster.Properties.QuotaInfo.CoresUsed;
Expand Down Expand Up @@ -80,6 +81,11 @@ public AzureHDInsightCluster(Cluster cluster, IDictionary<string, string> cluste
/// </summary>
public OSType OperatingSystemType { get; set; }

/// <summary>
/// Gets or sets the cluster tier.
/// </summary>
public Tier ClusterTier { get; set; }

/// <summary>
/// The state of the cluster.
/// </summary>
Expand Down Expand Up @@ -123,6 +129,6 @@ public AzureHDInsightCluster(Cluster cluster, IDictionary<string, string> cluste
/// <summary>
/// Additional storage accounts for this cluster
/// </summary>
public List<string> AdditionalStorageAccounts { get; set; }
public List<string> AdditionalStorageAccounts { get; set; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@ public class AzureHDInsightConfig
/// Gets or sets the flavor for a cluster.
/// </summary>
public string ClusterType { get; set; }


/// <summary>
/// Gets or sets the cluster tier.
/// </summary>
public Tier ClusterTier { get; set; }

/// <summary>
/// Gets or sets the database to store the metadata for Oozie.
/// </summary>
Expand Down Expand Up @@ -86,7 +91,7 @@ public class AzureHDInsightConfig
/// Gets AAD tenant uri of the service principal
/// </summary>
public Guid AADTenantId { get; set; }

/// <summary>
/// Gets the configurations of this HDInsight cluster.
/// </summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<package id="Microsoft.Azure.Common.Dependencies" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.Azure.Graph.RBAC" version="1.9.0-preview" targetFramework="net45" />
<package id="Microsoft.Azure.KeyVault.Core" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.Azure.Management.HDInsight" version="1.0.10-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.HDInsight" version="1.0.12-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.HDInsight.Job" version="2.0.0-preview" targetFramework="net45" />
<package id="Microsoft.Azure.Management.Resources" version="2.19.0-preview" targetFramework="net45" />
<package id="Microsoft.Bcl" version="1.1.9" targetFramework="net45" />
Expand Down