@@ -135,6 +135,64 @@ public void CanCreateNewHDInsightCluster()
135
135
[ Fact ]
136
136
[ Trait ( Category . AcceptanceType , Category . CheckIn ) ]
137
137
public void CanCreateNewHDInsightCluster_Linux ( )
138
+ {
139
+ CreateNewHDInsightCluster ( ) ;
140
+
141
+ commandRuntimeMock . Verify ( f => f . WriteObject ( It . Is < AzureHDInsightCluster > (
142
+ clusterout =>
143
+ clusterout . ClusterState == "Running" &&
144
+ clusterout . ClusterType == ClusterType &&
145
+ clusterout . ClusterVersion == "3.1" &&
146
+ clusterout . CoresUsed == 24 &&
147
+ clusterout . Location == Location &&
148
+ clusterout . Name == ClusterName &&
149
+ clusterout . OperatingSystemType == OSType . Linux ) ) ,
150
+ Times . Once ) ;
151
+
152
+ }
153
+
154
+ [ Fact ]
155
+ [ Trait ( Category . AcceptanceType , Category . CheckIn ) ]
156
+ public void CanCreateNewHDInsightCluster_Secure_Linux ( )
157
+ {
158
+ cmdlet . SecurityProfile = new AzureHDInsightSecurityProfile ( )
159
+ {
160
+ Domain = "domain.com" ,
161
+ DomainUserCredential = new PSCredential ( "username" , "pass" . ConvertToSecureString ( ) ) ,
162
+ OrganizationalUnitDN = "OUDN" ,
163
+ LdapsUrls = new [ ]
164
+ {
165
+ "ldapsurl"
166
+ } ,
167
+ ClusterUsersGroupDNs = new [ ]
168
+ {
169
+ "userGroupDn"
170
+ }
171
+ } ;
172
+
173
+ CreateNewHDInsightCluster ( addSecurityProfileInresponse : true ) ;
174
+
175
+ commandRuntimeMock . Verify ( f => f . WriteObject ( It . Is < AzureHDInsightCluster > (
176
+ clusterout =>
177
+ clusterout . ClusterState == "Running" &&
178
+ clusterout . ClusterType == ClusterType &&
179
+ clusterout . ClusterVersion == "3.1" &&
180
+ clusterout . CoresUsed == 24 &&
181
+ clusterout . Location == Location &&
182
+ clusterout . Name == ClusterName &&
183
+ clusterout . OperatingSystemType == OSType . Linux &&
184
+ clusterout . SecurityProfile . Domain . Equals ( cmdlet . SecurityProfile . Domain ) &&
185
+ clusterout . SecurityProfile . DomainUserCredential . UserName . Equals (
186
+ cmdlet . SecurityProfile . DomainUserCredential . UserName ) &&
187
+ clusterout . SecurityProfile . OrganizationalUnitDN . Equals ( cmdlet . SecurityProfile . OrganizationalUnitDN ) &&
188
+ clusterout . SecurityProfile . LdapsUrls . ArrayToString ( "" )
189
+ . Equals ( cmdlet . SecurityProfile . LdapsUrls . ArrayToString ( "" ) ) &&
190
+ clusterout . SecurityProfile . ClusterUsersGroupDNs . ArrayToString ( "" )
191
+ . Equals ( cmdlet . SecurityProfile . ClusterUsersGroupDNs . ArrayToString ( "" ) ) ) ) ,
192
+ Times . Once ) ;
193
+ }
194
+
195
+ private void CreateNewHDInsightCluster ( bool addSecurityProfileInresponse = false )
138
196
{
139
197
cmdlet . ClusterName = ClusterName ;
140
198
cmdlet . ResourceGroupName = ResourceGroupName ;
@@ -146,7 +204,7 @@ public void CanCreateNewHDInsightCluster_Linux()
146
204
cmdlet . ClusterType = ClusterType ;
147
205
cmdlet . SshCredential = _sshCred ;
148
206
cmdlet . OSType = OSType . Linux ;
149
-
207
+
150
208
var cluster = new Cluster
151
209
{
152
210
Id = "id" ,
@@ -167,6 +225,26 @@ public void CanCreateNewHDInsightCluster_Linux()
167
225
OperatingSystemType = OSType . Linux
168
226
}
169
227
} ;
228
+
229
+ if ( addSecurityProfileInresponse )
230
+ {
231
+ cluster . Properties . SecurityProfile = new SecurityProfile ( )
232
+ {
233
+ Domain = "domain.com" ,
234
+ DomainUsername = "username" ,
235
+ DomainUserPassword = "pass" ,
236
+ OrganizationalUnitDN = "OUDN" ,
237
+ LdapsUrls = new [ ]
238
+ {
239
+ "ldapsurl"
240
+ } ,
241
+ ClusterUsersGroupDNs = new [ ]
242
+ {
243
+ "userGroupDn"
244
+ }
245
+ } ;
246
+ }
247
+
170
248
var coreConfigs = new Dictionary < string , string >
171
249
{
172
250
{ "fs.defaultFS" , "wasb://giyertestcsmv2@" + StorageName } ,
@@ -190,22 +268,23 @@ public void CanCreateNewHDInsightCluster_Linux()
190
268
var serializedConfig = JsonConvert . SerializeObject ( configurations ) ;
191
269
cluster . Properties . ClusterDefinition . Configurations = serializedConfig ;
192
270
193
- var getresponse = new ClusterGetResponse { Cluster = cluster } ;
271
+ var getresponse = new ClusterGetResponse { Cluster = cluster } ;
194
272
195
- hdinsightManagementMock . Setup ( c => c . CreateNewCluster ( ResourceGroupName , ClusterName , It . Is < ClusterCreateParameters > (
196
- parameters =>
197
- parameters . ClusterSizeInNodes == ClusterSize &&
198
- parameters . DefaultStorageAccountName == StorageName &&
199
- parameters . DefaultStorageAccountKey == StorageKey &&
200
- parameters . Location == Location &&
201
- parameters . UserName == _httpCred . UserName &&
202
- parameters . Password == _httpCred . Password . ConvertToString ( ) &&
203
- parameters . ClusterType == ClusterType &&
204
- parameters . OSType == OSType . Linux &&
205
- parameters . SshUserName == _sshCred . UserName &&
206
- parameters . SshPassword == _sshCred . Password . ConvertToString ( ) ) ) )
207
- . Returns ( getresponse )
208
- . Verifiable ( ) ;
273
+ hdinsightManagementMock . Setup (
274
+ c => c . CreateNewCluster ( ResourceGroupName , ClusterName , It . Is < ClusterCreateParameters > (
275
+ parameters =>
276
+ parameters . ClusterSizeInNodes == ClusterSize &&
277
+ parameters . DefaultStorageAccountName == StorageName &&
278
+ parameters . DefaultStorageAccountKey == StorageKey &&
279
+ parameters . Location == Location &&
280
+ parameters . UserName == _httpCred . UserName &&
281
+ parameters . Password == _httpCred . Password . ConvertToString ( ) &&
282
+ parameters . ClusterType == ClusterType &&
283
+ parameters . OSType == OSType . Linux &&
284
+ parameters . SshUserName == _sshCred . UserName &&
285
+ parameters . SshPassword == _sshCred . Password . ConvertToString ( ) ) ) )
286
+ . Returns ( getresponse )
287
+ . Verifiable ( ) ;
209
288
210
289
cmdlet . ExecuteCmdlet ( ) ;
211
290
@@ -268,7 +347,6 @@ public void CanCreateNewHDInsightCluster_LinuxComponentVersion()
268
347
269
348
270
349
cluster . Properties . ClusterDefinition . ComponentVersion = componentVersion ;
271
-
272
350
var coreConfigs = new Dictionary < string , string >
273
351
{
274
352
{ "fs.defaultFS" , "wasb://giyertestcsmv2@" + StorageName } ,
@@ -292,7 +370,7 @@ public void CanCreateNewHDInsightCluster_LinuxComponentVersion()
292
370
var serializedConfig = JsonConvert . SerializeObject ( configurations ) ;
293
371
cluster . Properties . ClusterDefinition . Configurations = serializedConfig ;
294
372
295
- var getresponse = new ClusterGetResponse { Cluster = cluster } ;
373
+ var getresponse = new ClusterGetResponse { Cluster = cluster } ;
296
374
297
375
hdinsightManagementMock . Setup ( c => c . CreateNewCluster ( ResourceGroupName , ClusterName , It . Is < ClusterCreateParameters > (
298
376
parameters =>
@@ -309,6 +387,21 @@ public void CanCreateNewHDInsightCluster_LinuxComponentVersion()
309
387
parameters . ComponentVersion [ "Spark" ] == componentVersion [ "Spark" ] ) ) )
310
388
. Returns ( getresponse )
311
389
. Verifiable ( ) ;
390
+ hdinsightManagementMock . Setup (
391
+ c => c . CreateNewCluster ( ResourceGroupName , ClusterName , It . Is < ClusterCreateParameters > (
392
+ parameters =>
393
+ parameters . ClusterSizeInNodes == ClusterSize &&
394
+ parameters . DefaultStorageAccountName == StorageName &&
395
+ parameters . DefaultStorageAccountKey == StorageKey &&
396
+ parameters . Location == Location &&
397
+ parameters . UserName == _httpCred . UserName &&
398
+ parameters . Password == _httpCred . Password . ConvertToString ( ) &&
399
+ parameters . ClusterType == ClusterType &&
400
+ parameters . OSType == OSType . Linux &&
401
+ parameters . SshUserName == _sshCred . UserName &&
402
+ parameters . SshPassword == _sshCred . Password . ConvertToString ( ) ) ) )
403
+ . Returns ( getresponse )
404
+ . Verifiable ( ) ;
312
405
313
406
cmdlet . ExecuteCmdlet ( ) ;
314
407
0 commit comments