You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by al...@apache.org on 2015/01/21 19:03:46 UTC
ambari git commit: AMBARI-9240. yarn.resourcemanager.zk-address has
default value,
that can cause Resource Manager Web UI unavailability (alexantonenko)
Repository: ambari
Updated Branches:
refs/heads/trunk 3b205d4f0 -> 8346c3c66
AMBARI-9240. yarn.resourcemanager.zk-address has default value, that can cause Resource Manager Web UI unavailability (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/8346c3c6
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/8346c3c6
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/8346c3c6
Branch: refs/heads/trunk
Commit: 8346c3c66fac384bf630b547e5493d4b2a7291d9
Parents: 3b205d4
Author: Alex Antonenko <hi...@gmail.com>
Authored: Wed Jan 21 19:27:56 2015 +0200
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Wed Jan 21 20:03:10 2015 +0200
----------------------------------------------------------------------
ambari-web/app/assets/test/tests.js | 1 +
.../resourceManager/step3_controller.js | 59 ++++-
ambari-web/app/controllers/main/host/details.js | 12 +-
ambari-web/app/models/service_config.js | 13 +-
.../highAvailability/resourceManager/step3.hbs | 15 +-
ambari-web/app/utils/config.js | 13 +-
.../resourceManager/step3_controller_test.js | 245 +++++++++++++++++++
.../test/controllers/main/host/details_test.js | 14 +-
ambari-web/test/models/service_config_test.js | 41 +++-
9 files changed, 379 insertions(+), 34 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/8346c3c6/ambari-web/app/assets/test/tests.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/assets/test/tests.js b/ambari-web/app/assets/test/tests.js
index b2a6514..827ccb8 100644
--- a/ambari-web/app/assets/test/tests.js
+++ b/ambari-web/app/assets/test/tests.js
@@ -56,6 +56,7 @@ var files = ['test/init_model_test',
'test/controllers/main/admin/highAvailability_controller_test',
'test/controllers/main/admin/highAvailability/progress_controller_test',
'test/controllers/main/admin/highAvailability/nameNode/step4_controller_test',
+ 'test/controllers/main/admin/highAvailability/resourceManager/step3_controller_test',
'test/controllers/main/admin/security_test',
'test/controllers/main/admin/security/disable_test',
'test/controllers/main/admin/security/security_progress_controller_test',
http://git-wip-us.apache.org/repos/asf/ambari/blob/8346c3c6/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step3_controller.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step3_controller.js b/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step3_controller.js
index 27e9954..29c8306 100644
--- a/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step3_controller.js
+++ b/ambari-web/app/controllers/main/admin/highAvailability/resourceManager/step3_controller.js
@@ -25,6 +25,12 @@ App.RMHighAvailabilityWizardStep3Controller = Em.Controller.extend({
versionLoaded: true,
+ isLoaded: false,
+
+ isSubmitDisabled: function () {
+ return !this.get('isLoaded');
+ }.property('isLoaded'),
+
loadStep: function () {
this.renderConfigs();
},
@@ -51,23 +57,66 @@ App.RMHighAvailabilityWizardStep3Controller = Em.Controller.extend({
}, this);
this.renderConfigProperties(configs, serviceConfig);
- this.setDynamicConfigValues(serviceConfig);
+ App.ajax.send({
+ name: 'config.tags',
+ sender: this,
+ success: 'loadConfigTagsSuccessCallback',
+ error: 'loadConfigsErrorCallback',
+ data: {
+ serviceConfig: serviceConfig
+ }
+ });
- this.set('selectedService', serviceConfig);
+ },
+
+ loadConfigTagsSuccessCallback: function (data, opt, params) {
+ var urlParams = '(type=zoo.cfg&tag=' + data.Clusters.desired_configs['zoo.cfg'].tag + ')';
+ App.ajax.send({
+ name: 'reassign.load_configs',
+ sender: this,
+ data: {
+ urlParams: urlParams,
+ serviceConfig: params.serviceConfig
+ },
+ success: 'loadConfigsSuccessCallback',
+ error: 'loadConfigsErrorCallback'
+ });
+ },
+
+ loadConfigsSuccessCallback: function (data, opt, params) {
+ var zooCfg = data.items.findProperty('type', 'zoo.cfg');
+ var portValue = zooCfg && Em.get(zooCfg, 'properties.clientPort');
+ var zkPort = typeof portValue === 'undefined' ? '2181' : portValue;
+ this.setDynamicConfigValues(params.serviceConfig, zkPort);
+ this.setProperties({
+ selectedService: params.serviceConfig,
+ isLoaded: true
+ });
+ },
+
+ loadConfigsErrorCallback: function (request, ajaxOptions, error, data, params) {
+ this.setDynamicConfigValues(params.serviceConfig, '2181');
+ this.setProperties({
+ selectedService: params.serviceConfig,
+ isLoaded: true
+ });
},
/**
* Set values dependent on host selection
* @param configs
+ * @param zkPort
*/
- setDynamicConfigValues: function (configs) {
+ setDynamicConfigValues: function (configs, zkPort) {
var configProperties = configs.configs;
var currentRMHost = this.get('content.rmHosts.currentRM');
var additionalRMHost = this.get('content.rmHosts.additionalRM');
- var zooKeeperHosts = App.HostComponent.find().filterProperty('componentName', 'ZOOKEEPER_SERVER').mapProperty('host.hostName').join(',');
+ var zooKeeperHostsWithPort = App.HostComponent.find().filterProperty('componentName', 'ZOOKEEPER_SERVER').map(function (item) {
+ return item.get('host.hostName') + ':' + zkPort;
+ }).join(',');
configProperties.findProperty('name', 'yarn.resourcemanager.hostname.rm1').set('value', currentRMHost).set('defaultValue', currentRMHost);
configProperties.findProperty('name', 'yarn.resourcemanager.hostname.rm2').set('value', additionalRMHost).set('defaultValue', additionalRMHost);
- configProperties.findProperty('name', 'yarn.resourcemanager.zk-address').set('value', zooKeeperHosts).set('defaultValue', zooKeeperHosts);
+ configProperties.findProperty('name', 'yarn.resourcemanager.zk-address').set('value', zooKeeperHostsWithPort).set('defaultValue', zooKeeperHostsWithPort);
},
/**
http://git-wip-us.apache.org/repos/asf/ambari/blob/8346c3c6/ambari-web/app/controllers/main/host/details.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js
index b7de1d8..40077f7 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -789,6 +789,7 @@ App.MainHostDetailsController = Em.Controller.extend({
}
if ((services.someProperty('serviceName', 'YARN') && App.get('isHadoop22Stack')) || App.get('isRMHaEnabled')) {
urlParams.push('(type=yarn-site&tag=' + data.Clusters.desired_configs['yarn-site'].tag + ')');
+ urlParams.push('(type=zoo.cfg&tag=' + data.Clusters.desired_configs['zoo.cfg'].tag + ')');
}
return urlParams;
},
@@ -805,7 +806,9 @@ App.MainHostDetailsController = Em.Controller.extend({
}, this);
var zks = this.getZkServerHosts();
- var zksWithPort = this.concatZkNames(zks);
+ var portValue = configs['zoo.cfg'] && Em.get(configs['zoo.cfg'], 'clientPort');
+ var zkPort = typeof portValue === 'udefined' ? '2181' : portValue;
+ var zksWithPort = this.concatZkNames(zks, zkPort);
this.setZKConfigs(configs, zksWithPort, zks);
var groups = [
{
@@ -842,7 +845,7 @@ App.MainHostDetailsController = Em.Controller.extend({
configs['storm-site']['storm.zookeeper.servers'] = JSON.stringify(zks).replace(/"/g, "'");
}
if (App.get('isRMHaEnabled')) {
- configs['yarn-site']['yarn.resourcemanager.zk-address'] = zks.join(',');
+ configs['yarn-site']['yarn.resourcemanager.zk-address'] = zksWithPort;
}
if (App.get('isHadoop22Stack')) {
if (configs['hive-site']) {
@@ -858,11 +861,12 @@ App.MainHostDetailsController = Em.Controller.extend({
* concatenate URLs to ZOOKEEPER hosts with port "2181",
* as value of config divided by comma
* @param zks {array}
+ * @param port {string}
*/
- concatZkNames: function (zks) {
+ concatZkNames: function (zks, port) {
var zks_with_port = '';
zks.forEach(function (zk) {
- zks_with_port += zk + ':2181,';
+ zks_with_port += zk + ':' + port + ',';
});
return zks_with_port.slice(0, -1);
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/8346c3c6/ambari-web/app/models/service_config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/models/service_config.js b/ambari-web/app/models/service_config.js
index cba475d..047c1b2 100644
--- a/ambari-web/app/models/service_config.js
+++ b/ambari-web/app/models/service_config.js
@@ -276,7 +276,7 @@ App.ServiceConfigProperty = Em.Object.extend({
return result;
}.property('displayType'),
- initialValue: function (localDB, hiveMetastoreUrisDefault) {
+ initialValue: function (localDB, dependencies) {
var masterComponentHostsInDB = localDB.masterComponentHosts;
//console.log("value in initialvalue: " + JSON.stringify(masterComponentHostsInDB));
var hostsInfo = localDB.hosts; // which we are setting in installerController in step3.
@@ -481,7 +481,7 @@ App.ServiceConfigProperty = Em.Object.extend({
this.set('value', hiveServerHost).set('defaultValue', hiveServerHost);
break;
case 'hive.metastore.uris':
- var hiveMSUris = this.getHiveMetastoreUris(masterComponentHostsInDB, hiveMetastoreUrisDefault);
+ var hiveMSUris = this.getHiveMetastoreUris(masterComponentHostsInDB, dependencies['hive.metastore.uris']);
if (hiveMSUris) {
this.setDefaultValue("(.*)", hiveMSUris);
}
@@ -540,6 +540,13 @@ App.ServiceConfigProperty = Em.Object.extend({
this.setDefaultValue("(\\w*)", zkHosts);
}
break;
+ case 'yarn.resourcemanager.zk-address':
+ var value = masterComponentHostsInDB.findProperty('component', 'ZOOKEEPER_SERVER').hostName + ':' + dependencies.clientPort;
+ this.setProperties({
+ value: value,
+ defaultValue: value
+ });
+ break;
case 'zookeeper.connect':
case 'hive.zookeeper.quorum':
case 'templeton.zookeeper.hosts':
@@ -558,7 +565,7 @@ App.ServiceConfigProperty = Em.Object.extend({
this.setDefaultValue("(.*)", zkHostPort);
break;
case 'templeton.hive.properties':
- var hiveMSUris = this.getHiveMetastoreUris(masterComponentHostsInDB, hiveMetastoreUrisDefault).replace(',', '\\,');
+ var hiveMSUris = this.getHiveMetastoreUris(masterComponentHostsInDB, dependencies['hive.metastore.uris']).replace(',', '\\,');
if (/\/\/localhost:/g.test(this.get('value'))) {
this.set('defaultValue', this.get('value') + ',hive.metastore.execute.setugi=true');
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/8346c3c6/ambari-web/app/templates/main/admin/highAvailability/resourceManager/step3.hbs
----------------------------------------------------------------------
diff --git a/ambari-web/app/templates/main/admin/highAvailability/resourceManager/step3.hbs b/ambari-web/app/templates/main/admin/highAvailability/resourceManager/step3.hbs
index 15776db..c143eef 100644
--- a/ambari-web/app/templates/main/admin/highAvailability/resourceManager/step3.hbs
+++ b/ambari-web/app/templates/main/admin/highAvailability/resourceManager/step3.hbs
@@ -42,15 +42,18 @@
</div>
</div>
+{{#if controller.isLoaded}}
+ <div id="serviceConfig">
-<div id="serviceConfig">
+ {{{t admin.rm_highAvailability.wizard.step3.confirm.config.body}}}
- {{{t admin.rm_highAvailability.wizard.step3.confirm.config.body}}}
-
- {{view App.ServiceConfigView}}
-</div>
+ {{view App.ServiceConfigView}}
+ </div>
+{{else}}
+ <div class="spinner"></div>
+{{/if}}
<div class="btn-area">
<a class="btn" {{action back}}>← {{t common.back}}</a>
- <a class="btn btn-success pull-right" {{action next}}>{{t common.next}} →</a>
+ <a class="btn btn-success pull-right" {{action next}} {{bindAttr disabled="controller.isSubmitDisabled"}}>{{t common.next}} →</a>
</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/8346c3c6/ambari-web/app/utils/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/config.js b/ambari-web/app/utils/config.js
index 1a4a50d..6eaad57 100644
--- a/ambari-web/app/utils/config.js
+++ b/ambari-web/app/utils/config.js
@@ -682,12 +682,13 @@ App.config = Em.Object.create({
var serviceConfigProperty = App.ServiceConfigProperty.create(_config);
this.updateHostOverrides(serviceConfigProperty, _config);
if (!storedConfigs && !serviceConfigProperty.get('hasInitialValue')) {
- var hiveMetastoreUrisDefault;
- var hiveMetastoreUrisConfig = serviceConfigs.findProperty('name', 'hive.metastore.uris');
- if (hiveMetastoreUrisConfig) {
- hiveMetastoreUrisDefault = hiveMetastoreUrisConfig.defaultValue;
- }
- serviceConfigProperty.initialValue(localDB, hiveMetastoreUrisDefault);
+ var hiveMetastoreUrisConfig = configs.filterProperty('filename', 'hive-site.xml').findProperty('name', 'hive.metastore.uris');
+ var clientPortConfig = configs.filterProperty('filename', 'zoo.cfg.xml').findProperty('name', 'clientPort');
+ var dependencies = {
+ 'hive.metastore.uris': hiveMetastoreUrisConfig && hiveMetastoreUrisConfig.defaultValue,
+ 'clientPort': clientPortConfig && clientPortConfig.defaultValue
+ };
+ serviceConfigProperty.initialValue(localDB, dependencies);
}
if (storedConfigs && storedConfigs.filterProperty('name', _config.name).length && !!_config.filename) {
var storedConfig = storedConfigs.filterProperty('name', _config.name).findProperty('filename', _config.filename);
http://git-wip-us.apache.org/repos/asf/ambari/blob/8346c3c6/ambari-web/test/controllers/main/admin/highAvailability/resourceManager/step3_controller_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/admin/highAvailability/resourceManager/step3_controller_test.js b/ambari-web/test/controllers/main/admin/highAvailability/resourceManager/step3_controller_test.js
new file mode 100644
index 0000000..155bc67
--- /dev/null
+++ b/ambari-web/test/controllers/main/admin/highAvailability/resourceManager/step3_controller_test.js
@@ -0,0 +1,245 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.
+ */
+
+var App = require('app');
+require('controllers/main/admin/highAvailability/resourceManager/step3_controller');
+
+describe('App.RMHighAvailabilityWizardStep3Controller', function () {
+
+ describe('#isSubmitDisabled', function () {
+
+ var controller = App.RMHighAvailabilityWizardStep3Controller.create(),
+ cases = [
+ {
+ isLoaded: false,
+ isSubmitDisabled: true,
+ title: 'wizard step content not loaded'
+ },
+ {
+ isLoaded: true,
+ isSubmitDisabled: false,
+ title: 'wizard step content loaded'
+ }
+ ];
+
+ cases.forEach(function (item) {
+ it(item.title, function () {
+ controller.set('isLoaded', item.isLoaded);
+ expect(controller.get('isSubmitDisabled')).to.equal(item.isSubmitDisabled);
+ });
+ });
+
+ });
+
+ describe('#loadConfigTagsSuccessCallback', function () {
+
+ var controller = App.RMHighAvailabilityWizardStep3Controller.create();
+
+ beforeEach(function () {
+ sinon.stub(App.ajax, 'send', Em.K);
+ });
+
+ afterEach(function () {
+ App.ajax.send.restore();
+ });
+
+ it('should send proper ajax request', function () {
+ controller.loadConfigTagsSuccessCallback({
+ 'Clusters': {
+ 'desired_configs': {
+ 'zoo.cfg': {
+ 'tag': 1
+ }
+ }
+ }
+ }, {}, {
+ 'serviceConfig': {}
+ });
+ var data = App.ajax.send.args[0][0].data;
+ expect(data.urlParams).to.equal('(type=zoo.cfg&tag=1)');
+ expect(data.serviceConfig).to.eql({});
+ });
+
+ });
+
+ describe('#loadConfigsSuccessCallback', function () {
+
+ var controller = App.RMHighAvailabilityWizardStep3Controller.create(),
+ cases = [
+ {
+ 'items': [],
+ 'params': {
+ 'serviceConfig': {}
+ },
+ 'port': '2181',
+ 'title': 'empty response'
+ },
+ {
+ 'items': [
+ {
+ 'type': 'zoo.cfg'
+ }
+ ],
+ 'params': {
+ 'serviceConfig': {}
+ },
+ 'port': '2181',
+ 'title': 'no zoo.cfg properties received'
+ },
+ {
+ 'items': [
+ {
+ 'type': 'zoo.cfg',
+ 'properties': {
+ 'n': 'v'
+ }
+ }
+ ],
+ 'params': {
+ 'serviceConfig': {}
+ },
+ 'port': '2181',
+ 'title': 'no clientPort property received'
+ },
+ {
+ 'items': [
+ {
+ 'type': 'zoo.cfg',
+ 'properties': {
+ 'clientPort': '2182'
+ }
+ }
+ ],
+ 'params': {
+ 'serviceConfig': {}
+ },
+ 'port': '2182',
+ 'title': 'clientPort property received'
+ }
+ ];
+
+ beforeEach(function () {
+ sinon.stub(controller, 'setDynamicConfigValues', Em.K);
+ });
+
+ afterEach(function () {
+ controller.setDynamicConfigValues.restore();
+ });
+
+ cases.forEach(function (item) {
+ it(item.title, function () {
+ controller.loadConfigsSuccessCallback({
+ items: item.items
+ }, {}, item.params);
+ expect(controller.setDynamicConfigValues.args[0]).to.eql([{}, item.port]);
+ expect(controller.get('selectedService')).to.eql({});
+ expect(controller.get('isLoaded')).to.be.true;
+ });
+ });
+
+ });
+
+ describe('#loadConfigsErrorCallback', function () {
+
+ var controller = App.RMHighAvailabilityWizardStep3Controller.create();
+
+ beforeEach(function () {
+ sinon.stub(controller, 'setDynamicConfigValues', Em.K);
+ });
+
+ afterEach(function () {
+ controller.setDynamicConfigValues.restore();
+ });
+
+ it('should proceed with default value', function () {
+ controller.loadConfigsErrorCallback({}, {}, {}, {}, {
+ serviceConfig: {}
+ });
+ expect(controller.setDynamicConfigValues.args[0]).to.eql([{}, '2181']);
+ expect(controller.get('selectedService')).to.eql({});
+ expect(controller.get('isLoaded')).to.be.true;
+ });
+
+ });
+
+ describe('#setDynamicConfigValues', function () {
+
+ var controller = App.RMHighAvailabilityWizardStep3Controller.create({
+ content: {
+ rmHosts: {
+ currentRM: 'h0',
+ additionalRM: 'h1'
+ }
+ }
+ }),
+ configs = {
+ configs: [
+ Em.Object.create({
+ name: 'yarn.resourcemanager.hostname.rm1'
+ }),
+ Em.Object.create({
+ name: 'yarn.resourcemanager.hostname.rm2'
+ }),
+ Em.Object.create({
+ name: 'yarn.resourcemanager.zk-address'
+ })
+ ]
+ };
+
+ beforeEach(function () {
+ sinon.stub(App.HostComponent, 'find', function () {
+ return [
+ Em.Object.create({
+ componentName: 'ZOOKEEPER_SERVER',
+ host: {
+ hostName: 'h2'
+ }
+ }),
+ Em.Object.create({
+ componentName: 'ZOOKEEPER_SERVER',
+ host: {
+ hostName: 'h3'
+ }
+ }),
+ Em.Object.create({
+ componentName: 'RESOURCEMANAGER',
+ host: {
+ hostName: 'h4'
+ }
+ })
+ ];
+ });
+ });
+
+ afterEach(function () {
+ App.HostComponent.find.restore();
+ });
+
+ it('setting new RM properties values', function () {
+ controller.setDynamicConfigValues(configs, '2181');
+ expect(configs.configs.findProperty('name', 'yarn.resourcemanager.hostname.rm1').get('value')).to.equal('h0');
+ expect(configs.configs.findProperty('name', 'yarn.resourcemanager.hostname.rm1').get('defaultValue')).to.equal('h0');
+ expect(configs.configs.findProperty('name', 'yarn.resourcemanager.hostname.rm2').get('value')).to.equal('h1');
+ expect(configs.configs.findProperty('name', 'yarn.resourcemanager.hostname.rm2').get('defaultValue')).to.equal('h1');
+ expect(configs.configs.findProperty('name', 'yarn.resourcemanager.zk-address').get('value')).to.equal('h2:2181,h3:2181');
+ expect(configs.configs.findProperty('name', 'yarn.resourcemanager.zk-address').get('defaultValue')).to.equal('h2:2181,h3:2181');
+ });
+
+ });
+
+});
http://git-wip-us.apache.org/repos/asf/ambari/blob/8346c3c6/ambari-web/test/controllers/main/host/details_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/host/details_test.js b/ambari-web/test/controllers/main/host/details_test.js
index 546f0c4..41b32ad 100644
--- a/ambari-web/test/controllers/main/host/details_test.js
+++ b/ambari-web/test/controllers/main/host/details_test.js
@@ -676,15 +676,15 @@ describe('App.MainHostDetailsController', function () {
id: 'YARN',
service_name: 'YARN'
});
- var data = {Clusters: {desired_configs: {'yarn-site': {tag: 1}}}};
- expect(controller.constructConfigUrlParams(data)).to.eql(['(type=yarn-site&tag=1)']);
+ var data = {Clusters: {desired_configs: {'yarn-site': {tag: 1}, 'zoo.cfg': {tag: 1}}}};
+ expect(controller.constructConfigUrlParams(data)).to.eql(['(type=yarn-site&tag=1)', '(type=zoo.cfg&tag=1)']);
App.set('currentStackVersion', 'HDP-2.0.1');
App.Service.find().clear();
});
it('isRMHaEnabled true', function () {
sinon.stub(App, 'get').withArgs('isRMHaEnabled').returns(true);
- var data = {Clusters: {desired_configs: {'yarn-site': {tag: 1}}}};
- expect(controller.constructConfigUrlParams(data)).to.eql(['(type=yarn-site&tag=1)']);
+ var data = {Clusters: {desired_configs: {'yarn-site': {tag: 1}, 'zoo.cfg': {tag: 1}}}};
+ expect(controller.constructConfigUrlParams(data)).to.eql(['(type=yarn-site&tag=1)', '(type=zoo.cfg&tag=1)']);
App.get.restore();
});
});
@@ -831,7 +831,7 @@ describe('App.MainHostDetailsController', function () {
sinon.stub(App, 'get').withArgs('isRMHaEnabled').returns(true);
expect(controller.setZKConfigs(configs, 'host1:2181', ['host1', 'host2'])).to.be.true;
expect(configs).to.eql({"yarn-site": {
- "yarn.resourcemanager.zk-address": "host1,host2"
+ "yarn.resourcemanager.zk-address": "host1:2181"
}});
App.get.restore();
});
@@ -842,10 +842,10 @@ describe('App.MainHostDetailsController', function () {
expect(controller.concatZkNames([])).to.equal('');
});
it('One ZooKeeper host', function () {
- expect(controller.concatZkNames(['host1'])).to.equal('host1:2181');
+ expect(controller.concatZkNames(['host1'], '2181')).to.equal('host1:2181');
});
it('Two ZooKeeper hosts', function () {
- expect(controller.concatZkNames(['host1', 'host2'])).to.equal('host1:2181,host2:2181');
+ expect(controller.concatZkNames(['host1', 'host2'], '2181')).to.equal('host1:2181,host2:2181');
});
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/8346c3c6/ambari-web/test/models/service_config_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/models/service_config_test.js b/ambari-web/test/models/service_config_test.js
index 3c77fd7..afdd663 100644
--- a/ambari-web/test/models/service_config_test.js
+++ b/ambari-web/test/models/service_config_test.js
@@ -797,6 +797,9 @@ describe('App.ServiceConfigProperty', function () {
}
]
},
+ dependencies: {
+ 'hive.metastore.uris': 'thrift://localhost:9083'
+ },
defaultValue: 'thrift://localhost:9083',
value: 'thrift://h0:9083,thrift://h1:9083',
title: 'comma separated list of Metastore hosts with thrift prefix and port'
@@ -814,10 +817,32 @@ describe('App.ServiceConfigProperty', function () {
}
]
},
- hiveMSUrisDefaultValue: 'thrift://localhost:9083',
+ dependencies: {
+ 'hive.metastore.uris': 'thrift://localhost:9083'
+ },
defaultValue: 'hive.metastore.local=false,hive.metastore.uris=thrift://localhost:9933,hive.metastore.sasl.enabled=false',
value: 'hive.metastore.local=false,hive.metastore.uris=thrift://h0:9083\\,thrift://h1:9083,hive.metastore.sasl.enabled=false,hive.metastore.execute.setugi=true',
title: 'should add relevant hive.metastore.uris value'
+ },
+ 'yarn.resourcemanager.zk-address': {
+ localDB: {
+ masterComponentHosts: [
+ {
+ component: 'ZOOKEEPER_SERVER',
+ hostName: 'h0'
+ },
+ {
+ component: 'ZOOKEEPER_SERVER',
+ hostName: 'h1'
+ }
+ ]
+ },
+ dependencies: {
+ clientPort: '2182'
+ },
+ defaultValue: 'localhost:2181',
+ value: 'h0:2182',
+ title: 'should add ZK host and port dynamically'
}
};
@@ -908,7 +933,7 @@ describe('App.ServiceConfigProperty', function () {
name: 'hive.metastore.uris',
defaultValue: cases['hive.metastore.uris'].defaultValue
});
- serviceConfigProperty.initialValue(cases['hive.metastore.uris'].localDB, cases['hive.metastore.uris'].defaultValue);
+ serviceConfigProperty.initialValue(cases['hive.metastore.uris'].localDB, cases['hive.metastore.uris'].dependencies);
expect(serviceConfigProperty.get('value')).to.equal(cases['hive.metastore.uris'].value);
expect(serviceConfigProperty.get('defaultValue')).to.equal(cases['hive.metastore.uris'].value);
});
@@ -919,11 +944,21 @@ describe('App.ServiceConfigProperty', function () {
defaultValue: cases['templeton.hive.properties'].defaultValue,
value: cases['templeton.hive.properties'].defaultValue
});
- serviceConfigProperty.initialValue(cases['templeton.hive.properties'].localDB, cases['templeton.hive.properties'].hiveMSUrisDefaultValue);
+ serviceConfigProperty.initialValue(cases['templeton.hive.properties'].localDB, cases['templeton.hive.properties'].dependencies);
expect(serviceConfigProperty.get('value')).to.equal(cases['templeton.hive.properties'].value);
expect(serviceConfigProperty.get('defaultValue')).to.equal(cases['templeton.hive.properties'].value);
});
+ it(cases['yarn.resourcemanager.zk-address'].title, function () {
+ serviceConfigProperty.setProperties({
+ name: 'yarn.resourcemanager.zk-address',
+ defaultValue: cases['yarn.resourcemanager.zk-address'].defaultValue
+ });
+ serviceConfigProperty.initialValue(cases['yarn.resourcemanager.zk-address'].localDB, cases['yarn.resourcemanager.zk-address'].dependencies);
+ expect(serviceConfigProperty.get('value')).to.equal(cases['yarn.resourcemanager.zk-address'].value);
+ expect(serviceConfigProperty.get('defaultValue')).to.equal(cases['yarn.resourcemanager.zk-address'].value);
+ });
+
});
describe('#getHiveMetastoreUris', function () {