You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by on...@apache.org on 2016/01/08 20:06:41 UTC
ambari git commit: AMBARI-14592. UI test: adding zk servers post
install (onechiporenko)
Repository: ambari
Updated Branches:
refs/heads/trunk 848371dfa -> 30e17c7f1
AMBARI-14592. UI test: adding zk servers post install (onechiporenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/30e17c7f
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/30e17c7f
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/30e17c7f
Branch: refs/heads/trunk
Commit: 30e17c7f108b6795808d7594372fe937d332514c
Parents: 848371d
Author: Oleg Nechiporenko <on...@apache.org>
Authored: Fri Jan 8 14:59:22 2016 +0200
Committer: Oleg Nechiporenko <on...@apache.org>
Committed: Fri Jan 8 21:06:37 2016 +0200
----------------------------------------------------------------------
ambari-web/app/controllers/main/host/details.js | 8 +-
.../test/controllers/main/host/details_test.js | 201 ++++++++++++++++---
2 files changed, 174 insertions(+), 35 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/30e17c7f/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 8ec521e..f9c1951 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -1313,7 +1313,6 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
}, this);
this.updateZkConfigs(configs);
-
var groups = [
{
properties: {
@@ -1326,7 +1325,8 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
}
}
];
- if ((App.Service.find().someProperty('serviceName', 'YARN') && App.get('isHadoop22Stack')) || App.get('isRMHaEnabled')) {
+ var installedServiceNames = App.Service.find().mapProperty('serviceName');
+ if (installedServiceNames.contains('YARN') && App.get('isHadoop22Stack') || App.get('isRMHaEnabled')) {
groups.push(
{
properties: {
@@ -1338,7 +1338,7 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
}
);
}
- if (App.Service.find().someProperty('serviceName', 'HBASE')) {
+ if (installedServiceNames.contains('HBASE')) {
groups.push(
{
properties: {
@@ -1350,7 +1350,7 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
}
);
}
- if (App.Service.find().someProperty('serviceName', 'ACCUMULO')) {
+ if (installedServiceNames.contains('ACCUMULO')) {
groups.push(
{
properties: {
http://git-wip-us.apache.org/repos/asf/ambari/blob/30e17c7f/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 2aaa35f..f4f0b33 100644
--- a/ambari-web/test/controllers/main/host/details_test.js
+++ b/ambari-web/test/controllers/main/host/details_test.js
@@ -919,18 +919,56 @@ describe('App.MainHostDetailsController', function () {
describe('#constructConfigUrlParams()', function () {
+ function loadService(serviceName) {
+ App.store.load(App.Service, {
+ id: serviceName,
+ service_name: serviceName
+ });
+ }
+
+ var data = {
+ Clusters: {
+ desired_configs: {
+ 'core-site': {
+ tag: 1
+ },
+ 'hbase-site': {
+ tag: 1
+ },
+ 'webhcat-site': {
+ tag: 1
+ },
+ 'hive-site': {
+ tag: 1
+ },
+ 'storm-site': {
+ tag: 1
+ },
+ 'yarn-site': {
+ tag: 1
+ },
+ 'zoo.cfg': {
+ tag: 1
+ },
+ 'accumulo-site': {
+ tag: 1
+ }
+ }
+ }
+ };
+
+ afterEach(function () {
+ App.Service.find().clear();
+ });
+
it('URL params should be empty', function () {
- var data = {};
App.Service.find().clear();
expect(controller.constructConfigUrlParams(data)).to.eql([]);
});
it('isHaEnabled = true', function () {
- App.store.load(App.Service, {
- id: 'HDFS',
- service_name: 'HDFS'
- });
- var data = {Clusters: {desired_configs: {'core-site': {tag: 1}}}};
+ loadService('HDFS');
+
App.HostComponent.find().clear();
App.propertyDidChange('isHaEnabled');
expect(controller.constructConfigUrlParams(data)).to.eql(['(type=core-site&tag=1)']);
@@ -942,46 +980,31 @@ describe('App.MainHostDetailsController', function () {
});
it('HBASE is installed', function () {
- App.store.load(App.Service, {
- id: 'HBASE',
- service_name: 'HBASE'
- });
+ loadService('HBASE');
App.propertyDidChange('isHaEnabled');
- var data = {Clusters: {desired_configs: {'hbase-site': {tag: 1}}}};
expect(controller.constructConfigUrlParams(data)).to.eql(['(type=hbase-site&tag=1)']);
- App.Service.find().clear();
});
it('HIVE is installed', function () {
- App.store.load(App.Service, {
- id: 'HIVE',
- service_name: 'HIVE'
- });
- var data = {Clusters: {desired_configs: {'webhcat-site': {tag: 1}, 'hive-site': {tag: 1}}}};
+ loadService('HIVE');
expect(controller.constructConfigUrlParams(data)).to.eql(['(type=webhcat-site&tag=1)', '(type=hive-site&tag=1)']);
- App.Service.find().clear();
});
it('STORM is installed', function () {
- App.store.load(App.Service, {
- id: 'STORM',
- service_name: 'STORM'
- });
- var data = {Clusters: {desired_configs: {'storm-site': {tag: 1}}}};
+ loadService('STORM');
expect(controller.constructConfigUrlParams(data)).to.eql(['(type=storm-site&tag=1)']);
- App.Service.find().clear();
});
it('YARN for 2.2 stack is installed', function () {
App.set('currentStackVersion', 'HDP-2.2.0');
- App.store.load(App.Service, {
- id: 'YARN',
- service_name: 'YARN'
- });
- var data = {Clusters: {desired_configs: {'yarn-site': {tag: 1}, 'zoo.cfg': {tag: 1}}}};
+ loadService('YARN');
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('ACCUMULO is installed', function () {
+ loadService('ACCUMULO');
+ expect(controller.constructConfigUrlParams(data)).to.eql(['(type=accumulo-site&tag=1)']);
});
describe('isRMHaEnabled true', function () {
@@ -993,7 +1016,6 @@ describe('App.MainHostDetailsController', function () {
});
it('params are valid', function () {
- 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)']);
});
@@ -1123,6 +1145,123 @@ describe('App.MainHostDetailsController', function () {
});
});
+ describe('check groups', function () {
+
+ var data = {
+ items: [
+ {
+ type: 'hive-site',
+ properties: {
+ hs: 'hs'
+ },
+ properties_attributes: {
+ hs: 'pa_hs'
+ }
+ },
+ {
+ type: 'webhcat-site',
+ properties: {
+ ws: 'ws'
+ },
+ properties_attributes: {
+ ws: 'pa_ws'
+ }
+ },
+ {
+ type: 'hbase-site',
+ properties: {
+ hbs: 'hbs'
+ },
+ properties_attributes: {
+ hbs: 'pa_hbs'
+ }
+ },
+ {
+ type: 'accumulo-site',
+ properties: {
+ as: 'as'
+ },
+ properties_attributes: {
+ as: 'pa_as'
+ }
+ }
+ ]
+ };
+
+ beforeEach(function () {
+ sinon.stub(controller, 'updateZkConfigs', Em.K);
+ sinon.stub(App.Service, 'find', function () {
+ return [
+ {serviceName: 'YARN'},
+ {serviceName: 'HBASE'},
+ {serviceName: 'ACCUMULO'}
+ ];
+ });
+ controller.saveZkConfigs(data);
+ this.groups = controller.saveConfigsBatch.args[0][0];
+ });
+
+ afterEach(function () {
+ controller.updateZkConfigs.restore();
+ App.Service.find.restore();
+ });
+
+ it('configs for HIVE', function () {
+ var expected = {
+ "properties": {
+ "hive-site": {
+ "hs": "hs"
+ },
+ "webhcat-site": {
+ "ws": "ws"
+ }
+ },
+ "properties_attributes": {
+ "hive-site": {
+ "hs": "pa_hs"
+ },
+ "webhcat-site": {
+ "ws": "pa_ws"
+ }
+ }
+ };
+ expect(this.groups[0]).to.be.eql(expected);
+ });
+
+ it('configs for HBASE', function () {
+ var expected = {
+ "properties": {
+ "hbase-site": {
+ "hbs": "hbs"
+ }
+ },
+ "properties_attributes": {
+ "hbase-site": {
+ "hbs": "pa_hbs"
+ }
+ }
+ };
+ expect(this.groups[1]).to.be.eql(expected);
+ });
+
+ it('configs for ACCUMULO', function () {
+ var expected = {
+ "properties": {
+ "accumulo-site": {
+ "as": "as"
+ }
+ },
+ "properties_attributes": {
+ "accumulo-site": {
+ "as": "pa_as"
+ }
+ }
+ };
+ expect(this.groups[2]).to.be.eql(expected);
+ });
+
+ });
+
});
describe("#saveConfigsBatch()", function () {