ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From alexantone...@apache.org
Subject ambari git commit: AMBARI-10028. Service check for Kerberos need operation_level for request triggered from service actions menu. (alexantonenko)
Date Wed, 11 Mar 2015 16:21:36 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.0.0 8b854e79d -> 2a8f495f3


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/2a8f495f
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/2a8f495f
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/2a8f495f

Branch: refs/heads/branch-2.0.0
Commit: 2a8f495f319a2764d886be2ac7e6b899f9bb8d7b
Parents: 8b854e7
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Wed Mar 11 16:29:14 2015 +0200
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Wed Mar 11 18:21:32 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/2a8f495f/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/2a8f495f/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);
       });
     });
   });


Mime
View raw message