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/03/11 17:20:58 UTC
ambari git commit: AMBARI-10028. Service check for Kerberos need
operation_level for request triggered from service actions menu.
(alexantonenko)
Repository: ambari
Updated Branches:
refs/heads/trunk 91ca6666d -> d84898e59
AMBARI-10028. Service check for Kerberos need operation_level for request triggered from service actions menu. (alexantonenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/d84898e5
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/d84898e5
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/d84898e5
Branch: refs/heads/trunk
Commit: d84898e59893bf8bf1c419ff8d8791087782e0fd
Parents: 91ca666
Author: Alex Antonenko <hi...@gmail.com>
Authored: Wed Mar 11 16:29:14 2015 +0200
Committer: Alex Antonenko <hi...@gmail.com>
Committed: Wed Mar 11 18:20:54 2015 +0200
----------------------------------------------------------------------
ambari-web/app/controllers/main/service/item.js | 20 +++++++----
.../test/controllers/main/service/item_test.js | 36 ++++++++++++++++----
2 files changed, 43 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/d84898e5/ambari-web/app/controllers/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/item.js b/ambari-web/app/controllers/main/service/item.js
index 27d18c1..c7a840d 100644
--- a/ambari-web/app/controllers/main/service/item.js
+++ b/ambari-web/app/controllers/main/service/item.js
@@ -474,17 +474,25 @@ App.MainServiceItemController = Em.Controller.extend({
},
runSmokeTestPrimary: function(query) {
+ var clusterLevelRequired = ['KERBEROS'];
+ var requestData = {
+ 'serviceName': this.get('content.serviceName'),
+ 'displayName': this.get('content.displayName'),
+ 'actionName': this.get('content.serviceName') === 'ZOOKEEPER' ? 'ZOOKEEPER_QUORUM_SERVICE_CHECK' : this.get('content.serviceName') + '_SERVICE_CHECK',
+ 'query': query
+ };
+ if (clusterLevelRequired.contains(this.get('content.serviceName'))) {
+ requestData.operationLevel = {
+ "level": "CLUSTER",
+ "cluster_name": App.get('clusterName')
+ };
+ }
App.ajax.send({
'name': 'service.item.smoke',
'sender': this,
'success':'runSmokeTestSuccessCallBack',
'error':'runSmokeTestErrorCallBack',
- 'data': {
- 'serviceName': this.get('content.serviceName'),
- 'displayName': this.get('content.displayName'),
- 'actionName': this.get('content.serviceName') === 'ZOOKEEPER' ? 'ZOOKEEPER_QUORUM_SERVICE_CHECK' : this.get('content.serviceName') + '_SERVICE_CHECK',
- 'query': query
- }
+ 'data': requestData
});
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/d84898e5/ambari-web/test/controllers/main/service/item_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/item_test.js b/ambari-web/test/controllers/main/service/item_test.js
index 548028e..7d57570 100644
--- a/ambari-web/test/controllers/main/service/item_test.js
+++ b/ambari-web/test/controllers/main/service/item_test.js
@@ -572,6 +572,16 @@ describe('App.MainServiceItemController', function () {
});
describe("#runSmokeTestPrimary", function () {
+ beforeEach(function () {
+ sinon.stub(App, 'get').withArgs('clusterName').returns('myCluster');
+ sinon.spy($, 'ajax');
+ });
+
+ afterEach(function () {
+ App.get.restore();
+ $.ajax.restore();
+ });
+
var tests = [
{
data: {
@@ -584,8 +594,25 @@ describe('App.MainServiceItemController', function () {
"command" : "HDFS_SERVICE_CHECK"
},
"Requests/resource_filters": [{"service_name" : "HDFS"}]
+ },
+ {
+ data: {
+ 'serviceName': "KERBEROS",
+ 'displayName': "Kerberos",
+ 'query': "test"
+ },
+ "RequestInfo": {
+ "context": "Kerberos Service Check",
+ "command" : "KERBEROS_SERVICE_CHECK",
+ "operation_level": {
+ "level": "CLUSTER",
+ "cluster_name": "myCluster"
+ }
+ },
+ "Requests/resource_filters": [{"service_name" : "KERBEROS"}]
}
];
+
tests.forEach(function (test) {
var mainServiceItemController = App.MainServiceItemController.create({content: {serviceName: test.data.serviceName,
@@ -593,21 +620,16 @@ describe('App.MainServiceItemController', function () {
beforeEach(function () {
mainServiceItemController.set("runSmokeTestErrorCallBack", Em.K);
mainServiceItemController.set("runSmokeTestSuccessCallBack", Em.K);
- sinon.spy($, 'ajax');
});
- afterEach(function () {
- $.ajax.restore();
- });
-
- it('send request to run smoke test', function () {
-
+ it('send request to run smoke test for ' + test.data.serviceName, function () {
mainServiceItemController.runSmokeTestPrimary(test.data.query);
expect($.ajax.calledOnce).to.equal(true);
expect(JSON.parse($.ajax.args[0][0].data).RequestInfo.context).to.equal(test.RequestInfo.context);
expect(JSON.parse($.ajax.args[0][0].data).RequestInfo.command).to.equal(test.RequestInfo.command);
expect(JSON.parse($.ajax.args[0][0].data)["Requests/resource_filters"][0].serviceName).to.equal(test["Requests/resource_filters"][0].serviceName);
+ expect(JSON.parse($.ajax.args[0][0].data).RequestInfo.operation_level).to.be.deep.equal(test.RequestInfo.operation_level);
});
});
});