Skip to content

Commit

Permalink
Merge pull request elastic#7369 from LeeDr/elasticDumpDiscover
Browse files Browse the repository at this point in the history
Switch Discover and Settings tests to use esClient to wipe .kibana
  • Loading branch information
Lee Drengenberg committed Jun 6, 2016
2 parents 36beb93 + 2462b49 commit 4a49885
Show file tree
Hide file tree
Showing 14 changed files with 120 additions and 82 deletions.
8 changes: 2 additions & 6 deletions test/functional/apps/dashboard/_dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,8 @@ import {

common.debug('Starting dashboard before method');
var logstash = scenarioManager.loadIfEmpty('logstashFunctional');
return esClient.delete('.kibana')
.then(function () {
return common.try(function () {
return esClient.updateConfigDoc({'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*'});
});
})
// delete .kibana index and update configDoc
return esClient.deleteAndUpdateConfigDoc({'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*'})
// and load a set of makelogs data
.then(function loadkibanaVisualizations() {
common.debug('load kibana index with visualizations');
Expand Down
18 changes: 8 additions & 10 deletions test/functional/apps/discover/_collapse_expand.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import {
headerPage,
scenarioManager,
settingsPage,
esClient,
elasticDump
} from '../../../support';

(function () {
Expand All @@ -18,20 +20,16 @@ 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 and update configDoc
return esClient.deleteAndUpdateConfigDoc({'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');
Expand Down
18 changes: 8 additions & 10 deletions test/functional/apps/discover/_discover.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import {
discoverPage,
settingsPage,
headerPage,
esClient,
elasticDump
} from '../../../support';

(function () {
Expand All @@ -16,20 +18,16 @@ 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 and update configDoc
return esClient.deleteAndUpdateConfigDoc({'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');
Expand Down
20 changes: 9 additions & 11 deletions test/functional/apps/discover/_field_data.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ import {
discoverPage,
headerPage,
scenarioManager,
settingsPage
settingsPage,
esClient,
elasticDump
} from '../../../support';

(function () {
Expand All @@ -16,20 +18,16 @@ 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 and update configDoc
return esClient.deleteAndUpdateConfigDoc({'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');
Expand Down
27 changes: 16 additions & 11 deletions test/functional/apps/discover/_shared_links.js
Original file line number Diff line number Diff line change
@@ -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');
Expand All @@ -18,20 +27,16 @@ 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 and update configDoc
return esClient.deleteAndUpdateConfigDoc({'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');
Expand Down
8 changes: 5 additions & 3 deletions test/functional/apps/settings/_advanced_settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import {
bdd,
common,
settingsPage,
scenarioManager
scenarioManager,
esClient
} from '../../../support';

(function () {
Expand All @@ -11,7 +12,8 @@ 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.deleteAndUpdateConfigDoc()
.then(function () {
return settingsPage.navigateTo();
});
Expand All @@ -25,7 +27,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() {
Expand Down
4 changes: 3 additions & 1 deletion test/functional/apps/settings/_creation_form_changes.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import {
common,
settingsPage,
scenarioManager,
esClient
} from '../../../support';

(function () {
Expand All @@ -11,7 +12,8 @@ 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.deleteAndUpdateConfigDoc()
.then(function () {
return settingsPage.navigateTo();
});
Expand Down
6 changes: 4 additions & 2 deletions test/functional/apps/settings/_index_pattern_create_delete.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ import {
common,
remote,
scenarioManager,
settingsPage
settingsPage,
esClient
} from '../../../support';

(function () {
Expand All @@ -12,7 +13,8 @@ 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.deleteAndUpdateConfigDoc()
.then(function () {
return settingsPage.navigateTo();
});
Expand Down
6 changes: 4 additions & 2 deletions test/functional/apps/settings/_index_pattern_popularity.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import {
bdd,
common,
scenarioManager,
settingsPage
settingsPage,
esClient
} from '../../../support';

(function () {
Expand All @@ -11,7 +12,8 @@ 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.deleteAndUpdateConfigDoc()
.then(function () {
return settingsPage.navigateTo();
});
Expand Down
4 changes: 3 additions & 1 deletion test/functional/apps/settings/_index_pattern_results_sort.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import {
defaultTimeout,
settingsPage,
scenarioManager,
esClient
} from '../../../support';

(function () {
Expand All @@ -12,7 +13,8 @@ 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.deleteAndUpdateConfigDoc();
});

var columns = [{
Expand Down
6 changes: 4 additions & 2 deletions test/functional/apps/settings/_initial_state.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import {
bdd,
common,
scenarioManager,
settingsPage
settingsPage,
esClient
} from '../../../support';

(function () {
Expand All @@ -11,7 +12,8 @@ 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.deleteAndUpdateConfigDoc()
.then(function () {
return settingsPage.navigateTo();
});
Expand Down
9 changes: 3 additions & 6 deletions test/functional/apps/settings/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { bdd, defaultTimeout, scenarioManager } from '../../../support';
import { bdd, defaultTimeout, scenarioManager, esClient, common } from '../../../support';

(function () {
bdd.describe('settings app', function () {
Expand All @@ -7,16 +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')
.then(function () {
return scenarioManager.loadIfEmpty('makelogs');
});
return scenarioManager.loadIfEmpty('makelogs');
});

bdd.after(function () {
return scenarioManager.unload('makelogs')
.then(function () {
scenarioManager.unload('emptyKibana');
return esClient.delete('.kibana');
});
});

Expand Down
8 changes: 2 additions & 6 deletions test/functional/apps/visualize/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,8 @@ import {

common.debug('Starting visualize before method');
var logstash = scenarioManager.loadIfEmpty('logstashFunctional');
return esClient.delete('.kibana')
.then(function () {
return common.try(function () {
return esClient.updateConfigDoc({'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*'});
});
})
// delete .kibana index and update configDoc
return esClient.deleteAndUpdateConfigDoc({'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*'})
.then(function loadkibanaIndexPattern() {
common.debug('load kibana index with default index pattern');
return elasticDump.elasticLoad('visualize','.kibana');
Expand Down
Loading

0 comments on commit 4a49885

Please sign in to comment.