Skip to content

Adding support for creating HDInsight clusters with Datalake storage as default filesystem #3224

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 10 commits into from
Dec 8, 2016
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 @@ -50,9 +50,9 @@
<Reference Include="Microsoft.Azure.Management.Authorization">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.0.18.2-preview\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
</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.3.0\lib\net40\Microsoft.Azure.Management.HDInsight.dll</HintPath>
<Reference Include="Microsoft.Azure.Management.HDInsight, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\..\packages\Microsoft.Azure.Management.HDInsight.2.0.0\lib\net40\Microsoft.Azure.Management.HDInsight.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.Azure.Management.HDInsight.Job">
<SpecificVersion>False</SpecificVersion>
Expand Down Expand Up @@ -162,6 +162,7 @@
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="DataLakeStoreDefaultFilesystemTests.cs" />
<Compile Include="HDInsightTestBase.cs" />
<Compile Include="UnitTests\PremiumClusterTests.cs" />
<Compile Include="UnitTests\ScriptActionTests.cs" />
Expand All @@ -170,10 +171,6 @@
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Compile Include="ScenarioTests\HDInsightConfigurationTests.cs" />
<None Include="ScenarioTests\DataLakeStoreScenarioTests.ps1">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<Compile Include="ScenarioTests\DataLakeStoreScenarioTests.cs" />
<Compile Include="ScenarioTests\HDInsightScenarioTestsBase.cs" />
<Compile Include="UnitTests\JobTests.cs" />
<Compile Include="UnitTests\ResizeClusterTests.cs" />
Expand Down Expand Up @@ -214,9 +211,6 @@
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
<None Include="SessionRecords\Microsoft.Azure.Commands.HDInsight.Test.DataLakeStoreScenarioTests\TestDataLakeStoreClusterCreate.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
<ItemGroup>
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,150 @@
// ----------------------------------------------------------------------------------
//
// 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 Microsoft.Azure.Commands.HDInsight;
using Microsoft.Azure.Commands.HDInsight.ManagementCommands;
using Microsoft.Azure.Commands.HDInsight.Models;
using Microsoft.Azure.Commands.HDInsight.Test;
using Microsoft.Azure.ServiceManagemenet.Common.Models;
using Microsoft.WindowsAzure.Commands.Common;
using Microsoft.WindowsAzure.Commands.ScenarioTest;
using Moq;
using System;
using System.Management.Automation;
using Xunit;

namespace Commands.HDInsight.Test.UnitTests
{
public class DataLakeStoreDefaultFilesystemTests : HDInsightTestBase
{
private NewAzureHDInsightClusterCommand cmdlet;
private const string StorageName = "dummystorage.azuredatalakestore.net";
private const int ClusterSize = 4;
private Guid ObjectId = new Guid("11111111-1111-1111-1111-111111111111");
private Guid AadTenantId = new Guid("11111111-1111-1111-1111-111111111111");
private string Certificate = "";
private string CertificatePassword = "";
private byte[] CertificateFileContents = { };
private readonly PSCredential _httpCred;
private Mock<AzureHDInsightConfig> AzureHDInsightconfigMock;

public DataLakeStoreDefaultFilesystemTests(Xunit.Abstractions.ITestOutputHelper output)
{
XunitTracingInterceptor.AddToContext(new XunitTracingInterceptor(output));
base.SetupTestsForManagement();
_httpCred = new PSCredential("hadoopuser", string.Format("Password1!").ConvertToSecureString());
cmdlet = new NewAzureHDInsightClusterCommand
{
CommandRuntime = commandRuntimeMock.Object,
HDInsightManagementClient = hdinsightManagementMock.Object
};
AzureHDInsightconfigMock = new Mock<AzureHDInsightConfig>();
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void CanCreateClusterConfigWithDataLakeStoreParameters()
{
var newclusteridentitycmdlet = new NewAzureHDInsightClusterConfigCommand()
{
CommandRuntime = commandRuntimeMock.Object,
HDInsightManagementClient = hdinsightManagementMock.Object,
ObjectId = ObjectId,
CertificateFilePath = Certificate,
AadTenantId = AadTenantId,
CertificatePassword = CertificatePassword,
DefaultStorageAccountName = StorageName
};

newclusteridentitycmdlet.ExecuteCmdlet();
commandRuntimeMock.Verify(
f =>
f.WriteObject(
It.Is<AzureHDInsightConfig>(
c =>
c.AADTenantId == AadTenantId &&
c.CertificatePassword == CertificatePassword &&
c.ObjectId == ObjectId &&
c.CertificateFilePath == Certificate &&
c.DefaultStorageAccountName == StorageName
)),
Times.Once);
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void CanCreateDataLakeClusterWithCertificateFileContents()
{
var clusterIdentityCmdlet = new NewAzureHDInsightClusterConfigCommand()
{
CommandRuntime = commandRuntimeMock.Object,
HDInsightManagementClient = hdinsightManagementMock.Object,
ObjectId = ObjectId,
CertificateFileContents = CertificateFileContents,
AadTenantId = AadTenantId,
CertificatePassword = CertificatePassword,
DefaultStorageAccountName = StorageName
};

clusterIdentityCmdlet.ExecuteCmdlet();
commandRuntimeMock.Verify(
f =>
f.WriteObject(
It.Is<AzureHDInsightConfig>(
c =>
c.AADTenantId == AadTenantId &&
c.CertificatePassword == CertificatePassword &&
c.ObjectId == ObjectId &&
c.CertificateFileContents == CertificateFileContents &&
c.DefaultStorageAccountName == StorageName
)),
Times.Once);
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void ShouldThrowIfCertificateOptionsAreNotPassed()
{
var clusterIdentityCmdlet = new AddAzureHDInsightClusterIdentity()
{
CommandRuntime = commandRuntimeMock.Object,
HDInsightManagementClient = hdinsightManagementMock.Object,
ObjectId = ObjectId,
AadTenantId = AadTenantId,
CertificatePassword = CertificatePassword
};

Assert.Throws<ArgumentException>(() => clusterIdentityCmdlet.ExecuteCmdlet());
}

[Fact]
[Trait(Category.AcceptanceType, Category.CheckIn)]
public void ShouldThrowIfBothCertificateOptionsArePassed()
{
var clusterIdentityCmdlet = new AddAzureHDInsightClusterIdentity()
{
CommandRuntime = commandRuntimeMock.Object,
HDInsightManagementClient = hdinsightManagementMock.Object,
ObjectId = ObjectId,
AadTenantId = AadTenantId,
CertificatePassword = CertificatePassword,
CertificateFileContents = CertificateFileContents,
CertificateFilePath = Certificate
};

Assert.Throws<ArgumentException>(() => clusterIdentityCmdlet.ExecuteCmdlet());
}
}
}

This file was deleted.

This file was deleted.

Loading