Skip to content

Commit

Permalink
Merged from Azure:master
Browse files Browse the repository at this point in the history
  • Loading branch information
srsiva committed Nov 15, 2016
2 parents 48ae36d + 4675261 commit e95118a
Show file tree
Hide file tree
Showing 11 changed files with 160 additions and 117 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ public void GetResourceProviderManifest()
Assert.Equal("Microsoft.Sql.Admin", result.ProviderRegistration.Properties.Namespace);
Assert.Equal("local", result.ProviderRegistration.Properties.ProviderLocation);
Assert.Equal("hostingservers", result.ProviderRegistration.Properties.ResourceTypes[0].Name);
Assert.Equal("hostingservers", result.ProviderRegistration.Properties.Extensions[0].Name);
Assert.Equal("SqlAdminExtension", result.ProviderRegistration.Properties.Extensions[0].Name);
Assert.Equal("2014-04-01-preview", result.ProviderRegistration.Properties.ResourceTypes[0].Endpoints[0].ApiVersions[0]);
Assert.Equal("https://azstack:30010", result.ProviderRegistration.Properties.ResourceTypes[0].Endpoints[0].EndpointUri);
Assert.Equal(new TimeSpan(0, 0, 0), result.ProviderRegistration.Properties.ResourceTypes[0].Endpoints[0].Timeout);
Expand Down Expand Up @@ -185,7 +185,7 @@ public void CreateOrUpdateResourceProviderManifest()

}
},
ProvisioningState = ProvisioningState.Succeeded
ProvisioningState = "Succeeded"
}
}
));
Expand All @@ -200,7 +200,7 @@ public void CreateOrUpdateResourceProviderManifest()
Assert.Equal("Microsoft.Sql.Admin", result.ProviderRegistration.Properties.Namespace);
Assert.Equal("local", result.ProviderRegistration.Properties.ProviderLocation);
Assert.Equal("hostingservers", result.ProviderRegistration.Properties.ResourceTypes[0].Name);
Assert.Equal("hostingservers", result.ProviderRegistration.Properties.Extensions[0].Name);
Assert.Equal("SqlAdminExtension", result.ProviderRegistration.Properties.Extensions[0].Name);
Assert.Equal("2014-04-01-preview", result.ProviderRegistration.Properties.ResourceTypes[0].Endpoints[0].ApiVersions[0]);
Assert.Equal("https://azstack:30010", result.ProviderRegistration.Properties.ResourceTypes[0].Endpoints[0].EndpointUri);
Assert.Equal(new TimeSpan(0, 0, 0), result.ProviderRegistration.Properties.ResourceTypes[0].Endpoints[0].Timeout);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
</ItemGroup>
<ItemGroup>
<None Include="Microsoft.AzureStack.Management.nuget.proj" />
<None Include="Microsoft.AzureStack.Management.nuspec" />
<None Include="Microsoft.AzureStack.Management.nuspec">
<SubType>Designer</SubType>
</None>
<None Include="packages.config">
<SubType>Designer</SubType>
</None>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,12 @@ public string ProviderLocation
set { this._providerLocation = value; }
}

private Microsoft.AzureStack.Management.Models.ProvisioningState? _provisioningState;
private string _provisioningState;

/// <summary>
/// Optional. Gets or sets the provisioning state.
/// </summary>
public Microsoft.AzureStack.Management.Models.ProvisioningState? ProvisioningState
public string ProvisioningState
{
get { return this._provisioningState; }
set { this._provisioningState = value; }
Expand Down

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<!--
Microsoft.AzureStack.Management
-->
<SdkNuGetPackage Include="Microsoft.AzureStack.Management">
<PackageVersion>0.9.6-preview</PackageVersion>
<Folder>$(MSBuildThisFileDirectory)</Folder>
</SdkNuGetPackage>
</ItemGroup>
</Project>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<!--
Microsoft.AzureStack.Management
-->
<SdkNuGetPackage Include="Microsoft.AzureStack.Management">
<PackageVersion>0.10.1-preview</PackageVersion>
<Folder>$(MSBuildThisFileDirectory)</Folder>
</SdkNuGetPackage>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: AssemblyVersion("0.9.0.0")]
[assembly: AssemblyFileVersion("0.9.6.0")]
[assembly: AssemblyVersion("0.10.0.0")]
[assembly: AssemblyFileVersion("0.10.1.0")]
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<Compile Include="ScenarioTests\ScriptActionsOnRunningCluster.cs" />
<Compile Include="UnitTests\ClusterCreateTests.cs" />
<Compile Include="UnitTests\StorageAccountTests.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 @@ -555,7 +555,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 @@ -564,23 +570,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 @@ -589,10 +593,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,8 +2,8 @@
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<SdkNuGetPackage Include="Microsoft.Azure.Management.HDInsight">
<PackageVersion>2.0.0</PackageVersion>
<PackageVersion>2.0.0</PackageVersion>
<Folder>$(MSBuildThisFileDirectory)</Folder>
</SdkNuGetPackage>
</ItemGroup>
</Project>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,4 @@
[assembly:InternalsVisibleTo("HDInsight.Tests, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
#else
[assembly:InternalsVisibleTo("HDInsight.Tests")]
#endif
#endif

0 comments on commit e95118a

Please sign in to comment.