|
@@ -23,13 +23,14 @@ require('controllers/wizard/step4_controller');
|
|
|
describe('App.WizardStep4Controller', function () {
|
|
|
|
|
|
var services = [
|
|
|
- 'HDFS', 'MAPREDUCE', 'NAGIOS', 'GANGLIA', 'OOZIE', 'HIVE', 'HBASE', 'PIG', 'SCOOP', 'ZOOKEEPER', 'HCATALOG', 'WEBHCAT', 'YARN', 'MAPREDUCE2'
|
|
|
+ 'HDFS', 'MAPREDUCE', 'NAGIOS', 'GANGLIA', 'OOZIE', 'HIVE', 'HBASE', 'PIG', 'SCOOP', 'ZOOKEEPER', 'HCATALOG',
|
|
|
+ 'WEBHCAT', 'YARN', 'MAPREDUCE2', 'FALCON', 'TEZ', 'STORM'
|
|
|
];
|
|
|
|
|
|
var controller = App.WizardStep4Controller.create();
|
|
|
services.forEach(function(serviceName, index){
|
|
|
controller.pushObject(Ember.Object.create({
|
|
|
- 'serviceName':serviceName, 'isSelected': true, 'canBeSelected': true, 'isInstalled': false, 'isDisabled': index == 0
|
|
|
+ 'serviceName':serviceName, 'isSelected': true, 'canBeSelected': true, 'isInstalled': false, 'isDisabled': 'HDFS' === serviceName
|
|
|
}));
|
|
|
});
|
|
|
|
|
@@ -68,37 +69,6 @@ describe('App.WizardStep4Controller', function () {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
- var ajax_send;
|
|
|
- describe('#checkDependencies()', function () {
|
|
|
-
|
|
|
- beforeEach(function() {
|
|
|
- ajax_send = App.ajax.send;
|
|
|
- App.ajax.send = function() {};
|
|
|
- });
|
|
|
-
|
|
|
- afterEach(function() {
|
|
|
- App.ajax.send = ajax_send;
|
|
|
- });
|
|
|
-
|
|
|
- it('should set ZooKeeper, HCatalog, WebHCatalog isSelected property like in Hive', function () {
|
|
|
- controller.setEach('isSelected', false);
|
|
|
- controller.findProperty('serviceName', 'HIVE').set('isSelected', true);
|
|
|
- controller.checkDependencies();
|
|
|
- expect(controller.findProperty('serviceName', 'HCATALOG').get('isSelected')).to.equal(true);
|
|
|
- expect(controller.findProperty('serviceName', 'WEBHCAT').get('isSelected')).to.equal(true);
|
|
|
- });
|
|
|
- it('should set MapReduce2 isSelected property like in Yarn', function () {
|
|
|
- App.set('currentStackVersion', 'HDP-2.0.1');
|
|
|
- App.set('defaultStackVersion', 'HDP-2.0.1');
|
|
|
- controller.setEach('isSelected', false);
|
|
|
- controller.findProperty('serviceName', 'YARN').set('isSelected', true);
|
|
|
- controller.checkDependencies();
|
|
|
- expect(controller.findProperty('serviceName', 'MAPREDUCE2').get('isSelected')).to.equal(true);
|
|
|
- App.set('currentStackVersion', 'HDP-1.2.2');
|
|
|
- App.set('defaultStackVersion', 'HDP-1.2.2');
|
|
|
- });
|
|
|
- });
|
|
|
-
|
|
|
describe('#selectAll()', function () {
|
|
|
it('should select all services', function () {
|
|
|
controller.setEach('isSelected', false);
|
|
@@ -171,12 +141,40 @@ describe('App.WizardStep4Controller', function () {
|
|
|
});
|
|
|
|
|
|
describe('#needToAddZooKeeper()', function () {
|
|
|
- it('should return false if ZOOKEEPER is selected or HBASE is not selected', function () {
|
|
|
+ beforeEach(function() {
|
|
|
+ ajax_send = App.ajax.send;
|
|
|
+ App.ajax.send = function() {};
|
|
|
+ });
|
|
|
+
|
|
|
+ afterEach(function() {
|
|
|
+ App.ajax.send = ajax_send;
|
|
|
+ });
|
|
|
+ var originalStackVersion = App.get('currentStackVersion');
|
|
|
+
|
|
|
+ it('should return false if ZOOKEEPER is selected and Hadoop version above 2', function () {
|
|
|
+ App.set('currentStackVersion', 'HDP-2.1.1');
|
|
|
controller.findProperty('serviceName', 'ZOOKEEPER').set('isSelected', true);
|
|
|
expect(controller.needToAddZooKeeper()).to.equal(false);
|
|
|
- controller.setEach('isSelected', false);
|
|
|
+ });
|
|
|
+ it('should return true if ZOOKEEPER is not selected and Hadoop version above 2', function () {
|
|
|
+ controller.findProperty('serviceName', 'ZOOKEEPER').set('isSelected', false);
|
|
|
+ expect(controller.needToAddZooKeeper()).to.equal(true);
|
|
|
+ });
|
|
|
+ it('should return false if none of the HBASE, HIVE, WEBHCAT, STORM is selected and Hadoop version below 2', function () {
|
|
|
+ App.set('currentStackVersion', 'HDP-1.3.0');
|
|
|
expect(controller.needToAddZooKeeper()).to.equal(false);
|
|
|
});
|
|
|
+ it('should return true if HBASE is not selected and Hadoop version below 2', function () {
|
|
|
+ controller.findProperty('serviceName', 'HBASE').set('isSelected', true);
|
|
|
+ expect(controller.needToAddZooKeeper()).to.equal(true);
|
|
|
+ });
|
|
|
+ it('should return true if HBASE, HIVE, WEBHCAT, STORM are selected and Hadoop version below 2', function () {
|
|
|
+ controller.findProperty('serviceName', 'HIVE').set('isSelected', true);
|
|
|
+ controller.findProperty('serviceName', 'WEBHCAT').set('isSelected', true);
|
|
|
+ controller.findProperty('serviceName', 'STORM').set('isSelected', true);
|
|
|
+ expect(controller.needToAddZooKeeper()).to.equal(true);
|
|
|
+ App.set('currentStackVersion', originalStackVersion);
|
|
|
+ });
|
|
|
});
|
|
|
|
|
|
describe('#gangliaOrNagiosNotSelected()', function () {
|
|
@@ -197,4 +195,147 @@ describe('App.WizardStep4Controller', function () {
|
|
|
});
|
|
|
});
|
|
|
|
|
|
+ describe('#needToAddTez()', function () {
|
|
|
+ it('should return false if YARN is present, but not selected', function () {
|
|
|
+ controller.findProperty('serviceName', 'YARN').set('isSelected', false);
|
|
|
+ expect(controller.needToAddTez()).to.equal(false);
|
|
|
+ });
|
|
|
+ it('should return true if YARN is selected', function () {
|
|
|
+ controller.findProperty('serviceName', 'YARN').set('isSelected', true);
|
|
|
+ expect(controller.needToAddTez()).to.equal(true);
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ describe('#needToAddOozie()', function () {
|
|
|
+ it('should return false if FALCON is present, but not selected', function () {
|
|
|
+ controller.findProperty('serviceName', 'FALCON').set('isSelected', false);
|
|
|
+ expect(controller.needToAddOozie()).to.equal(false);
|
|
|
+ });
|
|
|
+ it('should return true if FALCON is selected', function () {
|
|
|
+ controller.findProperty('serviceName', 'FALCON').set('isSelected', true);
|
|
|
+ expect(controller.needToAddOozie()).to.equal(true);
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ describe('#noDFSs()', function () {
|
|
|
+ it('should return true if HDFS is not selected and GLUSTERFS is absent', function () {
|
|
|
+ controller.findProperty('serviceName', 'HDFS').set('isSelected', false);
|
|
|
+ expect(controller.noDFSs()).to.equal(true);
|
|
|
+ });
|
|
|
+ it('should return false if HDFS is selected and GLUSTERFS is absent', function () {
|
|
|
+ controller.findProperty('serviceName', 'HDFS').set('isSelected', true);
|
|
|
+ expect(controller.noDFSs()).to.equal(false);
|
|
|
+ });
|
|
|
+ it('should return true if HDFS is not selected and GLUSTERFS is not selected, but present', function () {
|
|
|
+ controller.pushObject(Ember.Object.create({
|
|
|
+ 'serviceName':'GLUSTERFS', 'isSelected': false, 'canBeSelected': true, 'isInstalled': false, 'isDisabled': false
|
|
|
+ }));
|
|
|
+ controller.findProperty('serviceName', 'HDFS').set('isSelected', false);
|
|
|
+ expect(controller.noDFSs()).to.equal(true);
|
|
|
+ });
|
|
|
+ it('should return false if HDFS is not selected and GLUSTERFS is selected', function () {
|
|
|
+ controller.findProperty('serviceName', 'GLUSTERFS').set('isSelected', true);
|
|
|
+ expect(controller.noDFSs()).to.equal(false);
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ describe('#multipleDFSs()', function () {
|
|
|
+ it('should return true if HDFS is selected and GLUSTERFS is selected', function () {
|
|
|
+ controller.findProperty('serviceName', 'HDFS').set('isSelected', true);
|
|
|
+ controller.findProperty('serviceName', 'GLUSTERFS').set('isSelected', true);
|
|
|
+ expect(controller.multipleDFSs()).to.equal(true);
|
|
|
+ });
|
|
|
+ it('should return false if HDFS is not selected and GLUSTERFS is selected', function () {
|
|
|
+ controller.findProperty('serviceName', 'HDFS').set('isSelected', false);
|
|
|
+ expect(controller.multipleDFSs()).to.equal(false);
|
|
|
+ });
|
|
|
+ it('should return false if HDFS is selected and GLUSTERFS is not selected', function () {
|
|
|
+ controller.findProperty('serviceName', 'HDFS').set('isSelected', true);
|
|
|
+ controller.findProperty('serviceName', 'GLUSTERFS').set('isSelected', false);
|
|
|
+ expect(controller.multipleDFSs()).to.equal(false);
|
|
|
+ });
|
|
|
+ });
|
|
|
+
|
|
|
+ describe('#checkDependencies()', function () {
|
|
|
+ var testCases = [
|
|
|
+ {
|
|
|
+ title: 'should set HCATALOG and WEBHCAT isSelected to true when HIVE is selected',
|
|
|
+ condition: {
|
|
|
+ 'HBASE': true,
|
|
|
+ 'ZOOKEEPER': true,
|
|
|
+ 'HIVE': true,
|
|
|
+ 'HCATALOG': true,
|
|
|
+ 'WEBHCAT': true
|
|
|
+ },
|
|
|
+ result: {
|
|
|
+ 'HCATALOG': true,
|
|
|
+ 'WEBHCAT': true
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: 'should set HCATALOG and WEBHCAT isSelected to false when HIVE is not selected',
|
|
|
+ condition: {
|
|
|
+ 'HBASE': true,
|
|
|
+ 'ZOOKEEPER': true,
|
|
|
+ 'HIVE': false,
|
|
|
+ 'HCATALOG': true,
|
|
|
+ 'WEBHCAT': true
|
|
|
+ },
|
|
|
+ result: {
|
|
|
+ 'HCATALOG': false,
|
|
|
+ 'WEBHCAT': false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: 'should set MAPREDUCE2 isSelected to true when YARN is selected',
|
|
|
+ condition: {
|
|
|
+ 'HBASE': true,
|
|
|
+ 'ZOOKEEPER': true,
|
|
|
+ 'HIVE': false,
|
|
|
+ 'HCATALOG': true,
|
|
|
+ 'WEBHCAT': true,
|
|
|
+ 'YARN': true,
|
|
|
+ 'MAPREDUCE2': true
|
|
|
+ },
|
|
|
+ result: {
|
|
|
+ 'MAPREDUCE2': true,
|
|
|
+ 'HCATALOG': false,
|
|
|
+ 'WEBHCAT': false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ {
|
|
|
+ title: 'should set MAPREDUCE2 isSelected to false when YARN is not selected',
|
|
|
+ condition: {
|
|
|
+ 'HBASE': true,
|
|
|
+ 'ZOOKEEPER': true,
|
|
|
+ 'HIVE': true,
|
|
|
+ 'HCATALOG': true,
|
|
|
+ 'WEBHCAT': true,
|
|
|
+ 'YARN': false,
|
|
|
+ 'MAPREDUCE2': true
|
|
|
+ },
|
|
|
+ result: {
|
|
|
+ 'MAPREDUCE2': false,
|
|
|
+ 'HCATALOG': true,
|
|
|
+ 'WEBHCAT': true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ ];
|
|
|
+
|
|
|
+ testCases.forEach(function(testCase){
|
|
|
+ it(testCase.title, function () {
|
|
|
+ controller.clear();
|
|
|
+ for(var id in testCase.condition) {
|
|
|
+ controller.pushObject(Ember.Object.create({
|
|
|
+ 'serviceName':id, 'isSelected': testCase.condition[id], 'canBeSelected': true, 'isInstalled': false
|
|
|
+ }));
|
|
|
+ }
|
|
|
+ controller.checkDependencies();
|
|
|
+ for(var service in testCase.result) {
|
|
|
+ expect(controller.findProperty('serviceName', service).get('isSelected')).to.equal(testCase.result[service]);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }, this);
|
|
|
+ });
|
|
|
+
|
|
|
});
|