소스 검색

AMBARI-9692 Kerberos Wizard tries to delete ATS is it's not installed. (ababiichuk)

aBabiichuk 10 년 전
부모
커밋
c82eb0c8bf

+ 2 - 1
ambari-web/app/controllers/main/admin/kerberos/step5_controller.js

@@ -45,7 +45,8 @@ App.KerberosWizardStep5Controller = App.KerberosProgressPageController.extend({
    * remove Application Timeline Server component if needed.
    */
   checkComponentsRemoval: function() {
-    if (App.Service.find().someProperty('serviceName', 'YARN') && !App.get('doesATSSupportKerberos') && !this.get('commands').contains('deleteATS')) {
+    if (App.Service.find().someProperty('serviceName', 'YARN') && !App.get('doesATSSupportKerberos')
+      && !this.get('commands').contains('deleteATS') && App.HostComponent.find().findProperty('componentName', 'APP_TIMELINE_SERVER')) {
       this.get('commands').pushObject('deleteATS');
     }
   },

+ 8 - 5
ambari-web/test/controllers/main/admin/kerberos/step5_controller_test.js

@@ -19,13 +19,14 @@
 var App = require('app');
 
 describe('App.KerberosWizardStep5Controller', function() {
-  describe('checkComponentsRemoval', function() {
+  describe('#checkComponentsRemoval', function() {
 
     var tests = [
-      { yarnInstalled: true, doesATSSupportKerberos: false, commands: ['stopServices', 'deleteATS']},
-      { yarnInstalled: false, doesATSSupportKerberos: true, commands: ['stopServices']},
-      { yarnInstalled: false, doesATSSupportKerberos: false, commands: ['stopServices']},
-      { yarnInstalled: true, doesATSSupportKerberos: true, commands: ['stopServices']},
+      { yarnInstalled: true, doesATSSupportKerberos: false, commands: ['stopServices', 'deleteATS'], ATSInstalled: true},
+      { yarnInstalled: false, doesATSSupportKerberos: true, commands: ['stopServices'], ATSInstalled: true},
+      { yarnInstalled: false, doesATSSupportKerberos: false, commands: ['stopServices'], ATSInstalled: true},
+      { yarnInstalled: true, doesATSSupportKerberos: true, commands: ['stopServices'], ATSInstalled: false},
+      { yarnInstalled: true, doesATSSupportKerberos: true, commands: ['stopServices'], ATSInstalled: true}
     ];
 
     tests.forEach(function(test) {
@@ -33,9 +34,11 @@ describe('App.KerberosWizardStep5Controller', function() {
         var controller = App.KerberosWizardStep5Controller.create({ commands: ['stopServices'] });
         sinon.stub(App, 'get').withArgs('doesATSSupportKerberos').returns(test.doesATSSupportKerberos);
         sinon.stub(App.Service, 'find').returns(test.yarnInstalled ? [Em.Object.create({ serviceName: 'YARN'})] : []);
+        sinon.stub(App.HostComponent, 'find').returns(test.ATSInstalled ? [Em.Object.create({ componentName: 'APP_TIMELINE_SERVER'})] : []);
         controller.checkComponentsRemoval();
         App.get.restore();
         App.Service.find.restore();
+        App.HostComponent.find.restore();
         expect(controller.get('commands').toArray()).to.eql(test.commands);
       });
     });