Skip to content

Commit 029aadc

Browse files
committed
Add test and fix md file
1 parent 5cfa1d5 commit 029aadc

File tree

2 files changed

+53
-5
lines changed

2 files changed

+53
-5
lines changed

src/ResourceManager/HDInsight/Commands.HDInsight.Test/UnitTests/ConfigurationTests.cs

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
// ----------------------------------------------------------------------------------
1414

1515
using Microsoft.Azure.Commands.HDInsight.Models;
16+
using Microsoft.Azure.Management.HDInsight;
1617
using Microsoft.WindowsAzure.Commands.ScenarioTest;
1718
using Moq;
1819
using Xunit;
@@ -41,6 +42,43 @@ public void CanCreateNewConfigForRServer()
4142
CreateNewConfig(setEdgeNodeVmSize: true);
4243
}
4344

45+
[Fact]
46+
[Trait(Category.AcceptanceType, Category.CheckIn)]
47+
public void CanAddSparkCustomConfigs()
48+
{
49+
AzureHDInsightConfig config = new AzureHDInsightConfig();
50+
51+
var addConfigValuesCmdlet = new AddAzureHDInsightConfigValuesCommand
52+
{
53+
CommandRuntime = commandRuntimeMock.Object,
54+
HDInsightManagementClient = hdinsightManagementMock.Object,
55+
Config = config,
56+
SparkDefaults = new System.Collections.Hashtable() { { @"spark.executor.instances", "3" } },
57+
SparkThriftConf = new System.Collections.Hashtable() { { @"spark.executor.cores", "4" } },
58+
Spark2Defaults = new System.Collections.Hashtable() { { @"spark.executor.memory", "2048m" } },
59+
Spark2ThriftConf = new System.Collections.Hashtable() { { @"spark.driver.memory.overhead", "1024" } },
60+
};
61+
62+
addConfigValuesCmdlet.ExecuteCmdlet();
63+
64+
commandRuntimeMock.Verify(
65+
f =>
66+
f.WriteObject(
67+
It.Is<AzureHDInsightConfig>(
68+
c =>
69+
c.Configurations != null &&
70+
c.Configurations.ContainsKey(ConfigurationKey.SparkDefaults) &&
71+
c.Configurations[ConfigurationKey.SparkDefaults]["spark.executor.instances"].Equals("3") &&
72+
c.Configurations.ContainsKey(ConfigurationKey.SparkThriftConf) &&
73+
c.Configurations[ConfigurationKey.SparkThriftConf]["spark.executor.cores"].Equals("4") &&
74+
c.Configurations.ContainsKey(ConfigurationKey.Spark2Defaults) &&
75+
c.Configurations[ConfigurationKey.Spark2Defaults]["spark.executor.memory"].Equals("2048m") &&
76+
c.Configurations.ContainsKey(ConfigurationKey.Spark2ThriftConf) &&
77+
c.Configurations[ConfigurationKey.Spark2ThriftConf]["spark.driver.memory.overhead"].Equals("1024") &&
78+
c.ScriptActions.Count == 0)),
79+
Times.Once);
80+
}
81+
4482
public void CreateNewConfig(bool setEdgeNodeVmSize = false)
4583
{
4684
var newconfigcmdlet = new NewAzureHDInsightClusterConfigCommand

src/ResourceManager/HDInsight/Commands.HDInsight/help/Add-AzureRmHDInsightConfigValues.md

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,9 @@ Accept wildcard characters: False
222222
```
223223
224224
### -RServer
225-
Specifies the RServer configurations. Valid only for RServer clusters.```yaml
225+
Specifies the RServer configurations. Valid only for RServer clusters.
226+
227+
```yaml
226228
Type: Hashtable
227229
Parameter Sets: (All)
228230
Aliases:
@@ -235,7 +237,9 @@ Accept wildcard characters: False
235237
```
236238
237239
### -Spark2Defaults
238-
Specifies the Spark2 Defaults configurations of this HDInsight cluster.```yaml
240+
Specifies the Spark2 Defaults configurations of this HDInsight cluster.
241+
242+
```yaml
239243
Type: Hashtable
240244
Parameter Sets: (All)
241245
Aliases:
@@ -248,7 +252,9 @@ Accept wildcard characters: False
248252
```
249253
250254
### -Spark2ThriftConf
251-
Specifies the Spark2 Thrift SparkConf configurations of this HDInsight cluster.```yaml
255+
Specifies the Spark2 Thrift SparkConf configurations of this HDInsight cluster.
256+
257+
```yaml
252258
Type: Hashtable
253259
Parameter Sets: (All)
254260
Aliases:
@@ -261,7 +267,9 @@ Accept wildcard characters: False
261267
```
262268
263269
### -SparkDefaults
264-
Specifies the Spark Defaults configurations of this HDInsight cluster.```yaml
270+
Specifies the Spark Defaults configurations of this HDInsight cluster.
271+
272+
```yaml
265273
Type: Hashtable
266274
Parameter Sets: (All)
267275
Aliases:
@@ -274,7 +282,9 @@ Accept wildcard characters: False
274282
```
275283
276284
### -SparkThriftConf
277-
Specifies the Spark Thrift SparkConf configurations of this HDInsight cluster.```yaml
285+
Specifies the Spark Thrift SparkConf configurations of this HDInsight cluster.
286+
287+
```yaml
278288
Type: Hashtable
279289
Parameter Sets: (All)
280290
Aliases:

0 commit comments

Comments
 (0)