|
13 | 13 | // ----------------------------------------------------------------------------------
|
14 | 14 |
|
15 | 15 | using Microsoft.Azure.Commands.HDInsight.Models;
|
| 16 | +using Microsoft.Azure.Management.HDInsight; |
16 | 17 | using Microsoft.WindowsAzure.Commands.ScenarioTest;
|
17 | 18 | using Moq;
|
18 | 19 | using Xunit;
|
@@ -41,6 +42,43 @@ public void CanCreateNewConfigForRServer()
|
41 | 42 | CreateNewConfig(setEdgeNodeVmSize: true);
|
42 | 43 | }
|
43 | 44 |
|
| 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 | + |
44 | 82 | public void CreateNewConfig(bool setEdgeNodeVmSize = false)
|
45 | 83 | {
|
46 | 84 | var newconfigcmdlet = new NewAzureHDInsightClusterConfigCommand
|
|
0 commit comments