Skip to content

Commit

Permalink
Merge pull request #2532 from kirankumarkolli/master
Browse files Browse the repository at this point in the history
InteractiveHive cluster type VM defaults to D13_v2
  • Loading branch information
markcowl authored Nov 12, 2016
2 parents 8c03afa + 7480637 commit 4675261
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<Compile Include="ScenarioTests\ListClusterTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="ScenarioTests\ScriptActionsOnRunningCluster.cs" />
<Compile Include="UnitTests\ClusterCreateDefaultVmTypeTests.cs" />
<Compile Include="UnitTests\MetastoreTests.cs" />
</ItemGroup>
<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using Microsoft.Azure.Management.HDInsight;
using Microsoft.Azure.Management.HDInsight.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Xunit;

namespace HDInsight.Tests.UnitTests
{
public class ClusterCreateDefaultVmTypeTests
{
[Fact]
public void TestDefaultVmTypes()
{
AssertDefaultVmTypes("hadoop", "Standard_D3", "Standard_D3");
AssertDefaultVmTypes("spark", "Standard_D12", "Standard_D12");
AssertDefaultVmTypes("InteractiveHive", "Standard_D13_v2", "Standard_D13_v2");
AssertDefaultVmTypes("hbase", "Large", "Standard_D3");
}

public void AssertDefaultVmTypes(string clusterType, string expectedheadNodeVmType, string expectedWorkerNodeVmType)
{
var createParams = new ClusterCreateParameters()
{
ClusterType = clusterType,
};

Assert.Equal(expectedheadNodeVmType, ClusterOperations.GetHeadNodeSize(createParams));
Assert.Equal(expectedWorkerNodeVmType, ClusterOperations.GetWorkerNodeSize(createParams));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -517,7 +517,13 @@ private static IEnumerable<Role> GetRoleCollection(ClusterCreateParameters clust
return roles;
}

private static string GetHeadNodeSize(ClusterCreateParameters clusterCreateParameters)
private static readonly Dictionary<string, string> HeadNodeDefaultSizes = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) {
{"hadoop", "Standard_D3" },
{"spark", "Standard_D12"},
{"InteractiveHive", "Standard_D13_v2"},
};

internal static string GetHeadNodeSize(ClusterCreateParameters clusterCreateParameters)
{
string headNodeSize;
if (clusterCreateParameters.HeadNodeSize != null)
Expand All @@ -526,23 +532,21 @@ private static string GetHeadNodeSize(ClusterCreateParameters clusterCreateParam
}
else
{
if (clusterCreateParameters.ClusterType.Equals("Hadoop", StringComparison.OrdinalIgnoreCase))
{
headNodeSize = "Standard_D3";
}
else if (clusterCreateParameters.ClusterType.Equals("Spark", StringComparison.OrdinalIgnoreCase))
{
headNodeSize = "Standard_D12";
}
else
if (! HeadNodeDefaultSizes.TryGetValue(clusterCreateParameters.ClusterType, out headNodeSize))
{
headNodeSize = "Large";
}
}

return headNodeSize;
}

private static string GetWorkerNodeSize(ClusterCreateParameters clusterCreateParameters)
private static readonly Dictionary<string, string> WorkerNodeDefaultSizes = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase) {
{"spark", "Standard_D12"},
{"InteractiveHive", "Standard_D13_v2"},
};

internal static string GetWorkerNodeSize(ClusterCreateParameters clusterCreateParameters)
{
string workerNodeSize;
if (clusterCreateParameters.WorkerNodeSize != null)
Expand All @@ -551,10 +555,12 @@ private static string GetWorkerNodeSize(ClusterCreateParameters clusterCreatePar
}
else
{
workerNodeSize = clusterCreateParameters.ClusterType.Equals("Spark", StringComparison.OrdinalIgnoreCase)
? "Standard_D12"
: "Standard_D3";
if (!WorkerNodeDefaultSizes.TryGetValue(clusterCreateParameters.ClusterType, out workerNodeSize))
{
workerNodeSize = "Standard_D3";
}
}

return workerNodeSize;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<SdkNuGetPackage Include="Microsoft.Azure.Management.HDInsight">
<PackageVersion>1.3.0</PackageVersion>
<PackageVersion>1.3.1</PackageVersion>
<Folder>$(MSBuildThisFileDirectory)</Folder>
</SdkNuGetPackage>
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
// by using the '*' as shown below:

[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.3.0.0")]
[assembly: AssemblyFileVersion("1.3.1.0")]

#if CODESIGN
[assembly:InternalsVisibleTo("HDInsight.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
Expand Down

0 comments on commit 4675261

Please sign in to comment.