Switch Discover and Settings tests to use esClient to wipe ,kibana

This commit is contained in:
LeeDr 2016-06-03 13:49:00 -05:00
parent 70cae37480
commit c39217480b
12 changed files with 148 additions and 66 deletions

View file

@ -5,6 +5,8 @@ import {
headerPage,
scenarioManager,
settingsPage,
esClient,
elasticDump
} from '../../../support';
(function () {
@ -18,20 +20,22 @@ import {
var fromTime = '2015-09-19 06:31:44.000';
var toTime = '2015-09-23 18:31:44.000';
// start each test with an empty kibana index
return scenarioManager.reload('emptyKibana')
// delete .kibana index
return esClient.delete('.kibana')
.then(function () {
// wait for Kibana to re-create it and add UTC and defaultIndex
return common.try(function () {
return esClient.updateConfigDoc({'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*'});
});
})
.then(function loadkibanaIndexPattern() {
common.debug('load kibana index with default index pattern');
return elasticDump.elasticLoad('visualize','.kibana');
})
// and load a set of makelogs data
.then(function loadIfEmptyMakelogs() {
return scenarioManager.loadIfEmpty('logstashFunctional');
})
.then(function () {
common.debug('navigateTo');
return settingsPage.navigateTo();
})
.then(function () {
common.debug('createIndexPattern');
return settingsPage.createIndexPattern();
})
.then(function () {
common.debug('discover');
return common.navigateToApp('discover');

View file

@ -5,6 +5,8 @@ import {
discoverPage,
settingsPage,
headerPage,
esClient,
elasticDump
} from '../../../support';
(function () {
@ -16,20 +18,22 @@ import {
var fromTime = '2015-09-19 06:31:44.000';
var toTime = '2015-09-23 18:31:44.000';
// start each test with an empty kibana index
return scenarioManager.reload('emptyKibana')
// delete .kibana index
return esClient.delete('.kibana')
.then(function () {
// wait for Kibana to re-create it and add UTC and defaultIndex
return common.try(function () {
return esClient.updateConfigDoc({'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*'});
});
})
.then(function loadkibanaIndexPattern() {
common.debug('load kibana index with default index pattern');
return elasticDump.elasticLoad('visualize','.kibana');
})
// and load a set of makelogs data
.then(function loadIfEmptyMakelogs() {
return scenarioManager.loadIfEmpty('logstashFunctional');
})
.then(function (navigateTo) {
common.debug('navigateTo');
return settingsPage.navigateTo();
})
.then(function () {
common.debug('createIndexPattern');
return settingsPage.createIndexPattern();
})
.then(function () {
common.debug('discover');
return common.navigateToApp('discover');

View file

@ -4,7 +4,9 @@ import {
discoverPage,
headerPage,
scenarioManager,
settingsPage
settingsPage,
esClient,
elasticDump
} from '../../../support';
(function () {
@ -16,20 +18,22 @@ import {
var fromTime = '2015-09-19 06:31:44.000';
var toTime = '2015-09-23 18:31:44.000';
// start each test with an empty kibana index
return scenarioManager.reload('emptyKibana')
// delete .kibana index
return esClient.delete('.kibana')
.then(function () {
// wait for Kibana to re-create it and add UTC and defaultIndex
return common.try(function () {
return esClient.updateConfigDoc({'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*'});
});
})
.then(function loadkibanaIndexPattern() {
common.debug('load kibana index with default index pattern');
return elasticDump.elasticLoad('visualize','.kibana');
})
// and load a set of makelogs data
.then(function loadIfEmptyMakelogs() {
return scenarioManager.loadIfEmpty('logstashFunctional');
})
.then(function (navigateTo) {
common.debug('navigateTo');
return settingsPage.navigateTo();
})
.then(function () {
common.debug('createIndexPattern');
return settingsPage.createIndexPattern();
})
.then(function () {
common.debug('discover');
return common.navigateToApp('discover');

View file

@ -1,4 +1,13 @@
import { bdd, common, discoverPage, headerPage, settingsPage, scenarioManager } from '../../../support';
import {
bdd,
common,
discoverPage,
headerPage,
settingsPage,
scenarioManager,
esClient,
elasticDump
} from '../../../support';
(function () {
var expect = require('expect.js');
@ -18,20 +27,22 @@ import { bdd, common, discoverPage, headerPage, settingsPage, scenarioManager }
var fromTime = '2015-09-19 06:31:44.000';
var toTime = '2015-09-23 18:31:44.000';
// start each test with an empty kibana index
return scenarioManager.reload('emptyKibana')
// delete .kibana index
return esClient.delete('.kibana')
.then(function () {
// wait for Kibana to re-create it and add UTC and defaultIndex
return common.try(function () {
return esClient.updateConfigDoc({'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*'});
});
})
.then(function loadkibanaIndexPattern() {
common.debug('load kibana index with default index pattern');
return elasticDump.elasticLoad('visualize','.kibana');
})
// and load a set of makelogs data
.then(function loadIfEmptyMakelogs() {
return scenarioManager.loadIfEmpty('logstashFunctional');
})
.then(function (navigateTo) {
common.debug('navigateTo');
return settingsPage.navigateTo();
})
.then(function () {
common.debug('createIndexPattern');
return settingsPage.createIndexPattern();
})
.then(function () {
common.debug('discover');
return common.navigateToApp('discover');

View file

@ -2,7 +2,8 @@ import {
bdd,
common,
settingsPage,
scenarioManager
scenarioManager,
esClient
} from '../../../support';
(function () {
@ -11,7 +12,13 @@ import {
(function () {
bdd.describe('creating and deleting default index', function describeIndexTests() {
bdd.before(function () {
return scenarioManager.reload('emptyKibana')
// delete .kibana index and then wait for Kibana to re-create it
return esClient.delete('.kibana')
.then(function () {
return common.try(function () {
return esClient.getConfigId();
});
})
.then(function () {
return settingsPage.navigateTo();
});
@ -25,7 +32,7 @@ import {
bdd.it('should allow setting advanced settings', function () {
return settingsPage.clickAdvancedTab()
.then(function TestCallSetAdvancedSettingsForTimezone() {
common.log('calling setAdvancedSetting');
common.debug('calling setAdvancedSetting');
return settingsPage.setAdvancedSettings('dateFormat:tz', 'America/Phoenix');
})
.then(function GetAdvancedSetting() {

View file

@ -3,6 +3,7 @@ import {
common,
settingsPage,
scenarioManager,
esClient
} from '../../../support';
(function () {
@ -11,7 +12,13 @@ import {
(function () {
bdd.describe('user input reactions', function () {
bdd.beforeEach(function () {
return scenarioManager.reload('emptyKibana')
// delete .kibana index and then wait for Kibana to re-create it
return esClient.delete('.kibana')
.then(function () {
return common.try(function () {
return esClient.getConfigId();
});
})
.then(function () {
return settingsPage.navigateTo();
});

View file

@ -3,7 +3,8 @@ import {
common,
remote,
scenarioManager,
settingsPage
settingsPage,
esClient
} from '../../../support';
(function () {
@ -12,7 +13,13 @@ import {
(function () {
bdd.describe('creating and deleting default index', function describeIndexTests() {
bdd.before(function () {
return scenarioManager.reload('emptyKibana')
// delete .kibana index and then wait for Kibana to re-create it
return esClient.delete('.kibana')
.then(function () {
return common.try(function () {
return esClient.getConfigId();
});
})
.then(function () {
return settingsPage.navigateTo();
});

View file

@ -2,7 +2,8 @@ import {
bdd,
common,
scenarioManager,
settingsPage
settingsPage,
esClient
} from '../../../support';
(function () {
@ -11,7 +12,13 @@ import {
(function () {
bdd.describe('index result popularity', function describeIndexTests() {
bdd.before(function () {
return scenarioManager.reload('emptyKibana')
// delete .kibana index and then wait for Kibana to re-create it
return esClient.delete('.kibana')
.then(function () {
return common.try(function () {
return esClient.getConfigId();
});
})
.then(function () {
return settingsPage.navigateTo();
});

View file

@ -4,6 +4,7 @@ import {
defaultTimeout,
settingsPage,
scenarioManager,
esClient
} from '../../../support';
(function () {
@ -12,7 +13,13 @@ import {
(function () {
bdd.describe('index result field sort', function describeIndexTests() {
bdd.before(function () {
return scenarioManager.reload('emptyKibana');
// delete .kibana index and then wait for Kibana to re-create it
return esClient.delete('.kibana')
.then(function () {
return common.try(function () {
return esClient.getConfigId();
});
});
});
var columns = [{

View file

@ -2,7 +2,8 @@ import {
bdd,
common,
scenarioManager,
settingsPage
settingsPage,
esClient
} from '../../../support';
(function () {
@ -11,7 +12,13 @@ import {
(function () {
bdd.describe('initial state', function () {
bdd.before(function () {
return scenarioManager.reload('emptyKibana')
// delete .kibana index and then wait for Kibana to re-create it
return esClient.delete('.kibana')
.then(function () {
return common.try(function () {
return esClient.getConfigId();
});
})
.then(function () {
return settingsPage.navigateTo();
});

View file

@ -1,4 +1,4 @@
import { bdd, defaultTimeout, scenarioManager } from '../../../support';
import { bdd, defaultTimeout, scenarioManager, esClient, common } from '../../../support';
(function () {
bdd.describe('settings app', function () {
@ -7,7 +7,13 @@ import { bdd, defaultTimeout, scenarioManager } from '../../../support';
// on setup, we create an settingsPage instance
// that we will use for all the tests
bdd.before(function () {
return scenarioManager.reload('emptyKibana')
// delete .kibana index and then wait for Kibana to re-create it
return esClient.delete('.kibana')
.then(function () {
return common.try(function () {
return esClient.getConfigId();
});
})
.then(function () {
return scenarioManager.loadIfEmpty('makelogs');
});
@ -16,7 +22,7 @@ import { bdd, defaultTimeout, scenarioManager } from '../../../support';
bdd.after(function () {
return scenarioManager.unload('makelogs')
.then(function () {
scenarioManager.unload('emptyKibana');
return esClient.delete('.kibana');
});
});

View file

@ -42,16 +42,12 @@ export default (function () {
});
},
/**
* Add fields to the config doc (like setting timezone and defaultIndex)
* @return {Promise} A promise that is resolved when elasticsearch has a response
/*
** Gets configId which is needed when we're going to update the config doc.
** Also used after deleting .kibana index to know Kibana has recreated it.
*/
updateConfigDoc: function (docMap) {
// first we need to get the config doc's id so we can use it in our _update call
var self = this;
getConfigId: function () {
var configId;
var docMapString = JSON.stringify(docMap);
return this.client.search({
index: '.kibana',
@ -70,11 +66,26 @@ export default (function () {
} else {
configId = response.hits.hits[0]._id;
common.debug('config._id =' + configId);
return configId;
}
})
});
},
/**
* Add fields to the config doc (like setting timezone and defaultIndex)
* @return {Promise} A promise that is resolved when elasticsearch has a response
*/
updateConfigDoc: function (docMap) {
// first we need to get the config doc's id so we can use it in our _update call
var self = this;
var configId;
var docMapString = JSON.stringify(docMap);
return this.getConfigId()
// now that we have the id, we can update
// return scenarioManager.updateConfigDoc({'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*'});
.then(function (response) {
.then(function (configId) {
common.debug('updating config with ' + docMapString);
return self.client.update({
index: '.kibana',