Skip to content

Commit fc5f98c

Browse files
authored
Merge pull request Azure#3224 from srsiva/adlcontainers
Adding support for creating HDInsight clusters with Datalake storage as default filesystem
2 parents d4e3e16 + b600d27 commit fc5f98c

24 files changed

+8647
-9201
lines changed

src/ResourceManager/HDInsight/Commands.HDInsight.Test/Commands.HDInsight.Test.csproj

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,9 @@
5050
<Reference Include="Microsoft.Azure.Management.Authorization">
5151
<HintPath>..\..\..\packages\Microsoft.Azure.Management.Authorization.0.18.2-preview\lib\net40\Microsoft.Azure.Management.Authorization.dll</HintPath>
5252
</Reference>
53-
<Reference Include="Microsoft.Azure.Management.HDInsight, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
54-
<SpecificVersion>False</SpecificVersion>
55-
<HintPath>..\..\..\packages\Microsoft.Azure.Management.HDInsight.1.3.0\lib\net40\Microsoft.Azure.Management.HDInsight.dll</HintPath>
53+
<Reference Include="Microsoft.Azure.Management.HDInsight, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
54+
<HintPath>..\..\..\packages\Microsoft.Azure.Management.HDInsight.2.0.0\lib\net40\Microsoft.Azure.Management.HDInsight.dll</HintPath>
55+
<Private>True</Private>
5656
</Reference>
5757
<Reference Include="Microsoft.Azure.Management.HDInsight.Job">
5858
<SpecificVersion>False</SpecificVersion>
@@ -162,6 +162,7 @@
162162
</Reference>
163163
</ItemGroup>
164164
<ItemGroup>
165+
<Compile Include="DataLakeStoreDefaultFilesystemTests.cs" />
165166
<Compile Include="HDInsightTestBase.cs" />
166167
<Compile Include="UnitTests\PremiumClusterTests.cs" />
167168
<Compile Include="UnitTests\ScriptActionTests.cs" />
@@ -170,10 +171,6 @@
170171
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
171172
</None>
172173
<Compile Include="ScenarioTests\HDInsightConfigurationTests.cs" />
173-
<None Include="ScenarioTests\DataLakeStoreScenarioTests.ps1">
174-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
175-
</None>
176-
<Compile Include="ScenarioTests\DataLakeStoreScenarioTests.cs" />
177174
<Compile Include="ScenarioTests\HDInsightScenarioTestsBase.cs" />
178175
<Compile Include="UnitTests\JobTests.cs" />
179176
<Compile Include="UnitTests\ResizeClusterTests.cs" />
@@ -214,9 +211,6 @@
214211
</ItemGroup>
215212
<ItemGroup>
216213
<None Include="packages.config" />
217-
<None Include="SessionRecords\Microsoft.Azure.Commands.HDInsight.Test.DataLakeStoreScenarioTests\TestDataLakeStoreClusterCreate.json">
218-
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
219-
</None>
220214
</ItemGroup>
221215
<ItemGroup>
222216
<Service Include="{82A7F48D-3B50-4B1E-B82E-3ADA8210C358}" />
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
// ----------------------------------------------------------------------------------
2+
//
3+
// Copyright Microsoft Corporation
4+
// Licensed under the Apache License, Version 2.0 (the "License");
5+
// you may not use this file except in compliance with the License.
6+
// You may obtain a copy of the License at
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
// ----------------------------------------------------------------------------------
14+
15+
using Microsoft.Azure.Commands.HDInsight;
16+
using Microsoft.Azure.Commands.HDInsight.ManagementCommands;
17+
using Microsoft.Azure.Commands.HDInsight.Models;
18+
using Microsoft.Azure.Commands.HDInsight.Test;
19+
using Microsoft.Azure.ServiceManagemenet.Common.Models;
20+
using Microsoft.WindowsAzure.Commands.Common;
21+
using Microsoft.WindowsAzure.Commands.ScenarioTest;
22+
using Moq;
23+
using System;
24+
using System.Management.Automation;
25+
using Xunit;
26+
27+
namespace Commands.HDInsight.Test.UnitTests
28+
{
29+
public class DataLakeStoreDefaultFilesystemTests : HDInsightTestBase
30+
{
31+
private NewAzureHDInsightClusterCommand cmdlet;
32+
private const string StorageName = "dummystorage.azuredatalakestore.net";
33+
private const int ClusterSize = 4;
34+
private Guid ObjectId = new Guid("11111111-1111-1111-1111-111111111111");
35+
private Guid AadTenantId = new Guid("11111111-1111-1111-1111-111111111111");
36+
private string Certificate = "";
37+
private string CertificatePassword = "";
38+
private byte[] CertificateFileContents = { };
39+
private readonly PSCredential _httpCred;
40+
private Mock<AzureHDInsightConfig> AzureHDInsightconfigMock;
41+
42+
public DataLakeStoreDefaultFilesystemTests(Xunit.Abstractions.ITestOutputHelper output)
43+
{
44+
XunitTracingInterceptor.AddToContext(new XunitTracingInterceptor(output));
45+
base.SetupTestsForManagement();
46+
_httpCred = new PSCredential("hadoopuser", string.Format("Password1!").ConvertToSecureString());
47+
cmdlet = new NewAzureHDInsightClusterCommand
48+
{
49+
CommandRuntime = commandRuntimeMock.Object,
50+
HDInsightManagementClient = hdinsightManagementMock.Object
51+
};
52+
AzureHDInsightconfigMock = new Mock<AzureHDInsightConfig>();
53+
}
54+
55+
[Fact]
56+
[Trait(Category.AcceptanceType, Category.CheckIn)]
57+
public void CanCreateClusterConfigWithDataLakeStoreParameters()
58+
{
59+
var newclusteridentitycmdlet = new NewAzureHDInsightClusterConfigCommand()
60+
{
61+
CommandRuntime = commandRuntimeMock.Object,
62+
HDInsightManagementClient = hdinsightManagementMock.Object,
63+
ObjectId = ObjectId,
64+
CertificateFilePath = Certificate,
65+
AadTenantId = AadTenantId,
66+
CertificatePassword = CertificatePassword,
67+
DefaultStorageAccountName = StorageName
68+
};
69+
70+
newclusteridentitycmdlet.ExecuteCmdlet();
71+
commandRuntimeMock.Verify(
72+
f =>
73+
f.WriteObject(
74+
It.Is<AzureHDInsightConfig>(
75+
c =>
76+
c.AADTenantId == AadTenantId &&
77+
c.CertificatePassword == CertificatePassword &&
78+
c.ObjectId == ObjectId &&
79+
c.CertificateFilePath == Certificate &&
80+
c.DefaultStorageAccountName == StorageName
81+
)),
82+
Times.Once);
83+
}
84+
85+
[Fact]
86+
[Trait(Category.AcceptanceType, Category.CheckIn)]
87+
public void CanCreateDataLakeClusterWithCertificateFileContents()
88+
{
89+
var clusterIdentityCmdlet = new NewAzureHDInsightClusterConfigCommand()
90+
{
91+
CommandRuntime = commandRuntimeMock.Object,
92+
HDInsightManagementClient = hdinsightManagementMock.Object,
93+
ObjectId = ObjectId,
94+
CertificateFileContents = CertificateFileContents,
95+
AadTenantId = AadTenantId,
96+
CertificatePassword = CertificatePassword,
97+
DefaultStorageAccountName = StorageName
98+
};
99+
100+
clusterIdentityCmdlet.ExecuteCmdlet();
101+
commandRuntimeMock.Verify(
102+
f =>
103+
f.WriteObject(
104+
It.Is<AzureHDInsightConfig>(
105+
c =>
106+
c.AADTenantId == AadTenantId &&
107+
c.CertificatePassword == CertificatePassword &&
108+
c.ObjectId == ObjectId &&
109+
c.CertificateFileContents == CertificateFileContents &&
110+
c.DefaultStorageAccountName == StorageName
111+
)),
112+
Times.Once);
113+
}
114+
115+
[Fact]
116+
[Trait(Category.AcceptanceType, Category.CheckIn)]
117+
public void ShouldThrowIfCertificateOptionsAreNotPassed()
118+
{
119+
var clusterIdentityCmdlet = new AddAzureHDInsightClusterIdentity()
120+
{
121+
CommandRuntime = commandRuntimeMock.Object,
122+
HDInsightManagementClient = hdinsightManagementMock.Object,
123+
ObjectId = ObjectId,
124+
AadTenantId = AadTenantId,
125+
CertificatePassword = CertificatePassword
126+
};
127+
128+
Assert.Throws<ArgumentException>(() => clusterIdentityCmdlet.ExecuteCmdlet());
129+
}
130+
131+
[Fact]
132+
[Trait(Category.AcceptanceType, Category.CheckIn)]
133+
public void ShouldThrowIfBothCertificateOptionsArePassed()
134+
{
135+
var clusterIdentityCmdlet = new AddAzureHDInsightClusterIdentity()
136+
{
137+
CommandRuntime = commandRuntimeMock.Object,
138+
HDInsightManagementClient = hdinsightManagementMock.Object,
139+
ObjectId = ObjectId,
140+
AadTenantId = AadTenantId,
141+
CertificatePassword = CertificatePassword,
142+
CertificateFileContents = CertificateFileContents,
143+
CertificateFilePath = Certificate
144+
};
145+
146+
Assert.Throws<ArgumentException>(() => clusterIdentityCmdlet.ExecuteCmdlet());
147+
}
148+
}
149+
}
150+

src/ResourceManager/HDInsight/Commands.HDInsight.Test/ScenarioTests/DataLakeStoreScenarioTests.cs

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/ResourceManager/HDInsight/Commands.HDInsight.Test/ScenarioTests/DataLakeStoreScenarioTests.ps1

Lines changed: 0 additions & 63 deletions
This file was deleted.

0 commit comments

Comments
 (0)