Skip to content

Commit 71116ec

Browse files
authored
Fix: test failures related to saved objects(tenant) (#1321)
* fix: data source error Signed-off-by: SuZhou-Joe <[email protected]> * fix: data source error Signed-off-by: SuZhou-Joe <[email protected]> * fix: data source error Signed-off-by: SuZhou-Joe <[email protected]> * fix: data source error Signed-off-by: SuZhou-Joe <[email protected]> * fix: data source error Signed-off-by: SuZhou-Joe <[email protected]> * fix: data source error Signed-off-by: SuZhou-Joe <[email protected]> * fix: data source error Signed-off-by: SuZhou-Joe <[email protected]> * fix: data source error Signed-off-by: SuZhou-Joe <[email protected]> * fix: data source error Signed-off-by: SuZhou-Joe <[email protected]> * fix: data source error Signed-off-by: SuZhou-Joe <[email protected]> * fix: data source error Signed-off-by: SuZhou-Joe <[email protected]> * fix: data source error Signed-off-by: SuZhou-Joe <[email protected]> * fix: data source error Signed-off-by: SuZhou-Joe <[email protected]> * fix: data source error Signed-off-by: SuZhou-Joe <[email protected]> * fix: data source error Signed-off-by: SuZhou-Joe <[email protected]> --------- Signed-off-by: SuZhou-Joe <[email protected]>
1 parent d9460de commit 71116ec

File tree

7 files changed

+50
-22
lines changed

7 files changed

+50
-22
lines changed

cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/discover.spec.js

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,17 +27,7 @@ const indexSet = [
2727
describe('discover app', { scrollBehavior: false }, () => {
2828
before(() => {
2929
CURRENT_TENANT.newTenant = 'global';
30-
if (Cypress.env('SECURITY_ENABLED')) {
31-
/**
32-
* Security plugin is using private tenant as default.
33-
* So here we'd need to set global tenant as default manually.
34-
*/
35-
cy.changeDefaultTenant({
36-
multitenancy_enabled: true,
37-
private_tenant_enabled: true,
38-
default_tenant: 'global',
39-
});
40-
}
30+
cy.fleshTenantSettings();
4131
// import logstash functional
4232
testFixtureHandler.importJSONDocIfNeeded(
4333
indexSet,
@@ -66,6 +56,11 @@ describe('discover app', { scrollBehavior: false }, () => {
6656
cy.switchDiscoverTable('new');
6757
});
6858

59+
beforeEach(() => {
60+
CURRENT_TENANT.newTenant = 'global';
61+
cy.fleshTenantSettings();
62+
});
63+
6964
after(() => {});
7065

7166
describe('save search', () => {
@@ -147,6 +142,8 @@ describe('discover app', { scrollBehavior: false }, () => {
147142
const toTime = 'Jun 12, 1999 @ 11:21:04.000';
148143

149144
before(() => {
145+
CURRENT_TENANT.newTenant = 'global';
146+
cy.fleshTenantSettings();
150147
cy.switchDiscoverTable('new');
151148
cy.setTopNavDate(fromTime, toTime);
152149
});

cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/discover_advanced_settings.spec.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@ describe('discover_advanced_setting', () => {
7070
cy.waitForSearch();
7171
});
7272

73+
beforeEach(() => {
74+
CURRENT_TENANT.newTenant = 'global';
75+
cy.fleshTenantSettings();
76+
});
77+
7378
describe('maxHeight advanced setting for legacy table', () => {
7479
it('checks if the table respects maxHeight setting of no truncation', function () {
7580
cy.setAdvancedSetting({
@@ -191,6 +196,8 @@ describe('discover_advanced_setting', () => {
191196

192197
describe('Number of rows advanced setting', () => {
193198
before(() => {
199+
CURRENT_TENANT.newTenant = 'global';
200+
cy.fleshTenantSettings();
194201
cy.setAdvancedSetting({
195202
'discover:sampleSize': 5,
196203
});
@@ -222,6 +229,8 @@ describe('discover_advanced_setting', () => {
222229

223230
describe('Number of terms advanced setting', () => {
224231
before(() => {
232+
CURRENT_TENANT.newTenant = 'global';
233+
cy.fleshTenantSettings();
225234
cy.setAdvancedSetting({
226235
'discover:aggs:terms:size': 5,
227236
});
@@ -250,6 +259,8 @@ describe('discover_advanced_setting', () => {
250259

251260
describe('hideTimeColumn advanced setting', () => {
252261
before(() => {
262+
CURRENT_TENANT.newTenant = 'global';
263+
cy.fleshTenantSettings();
253264
cy.setAdvancedSetting({
254265
'doc_table:hideTimeColumn': true,
255266
});
@@ -299,6 +310,8 @@ describe('discover_advanced_setting', () => {
299310

300311
describe('doc_table:highlight advanced setting', () => {
301312
before(() => {
313+
CURRENT_TENANT.newTenant = 'global';
314+
cy.fleshTenantSettings();
302315
// Selecting a field and adding a search filter for a value
303316
cy.get('[data-test-subj="fieldToggle-index"]')
304317
.click()
@@ -355,6 +368,8 @@ describe('discover_advanced_setting', () => {
355368

356369
describe('defaultColumns advanced setting', () => {
357370
before(() => {
371+
CURRENT_TENANT.newTenant = 'global';
372+
cy.fleshTenantSettings();
358373
cy.get('[data-test-subj="comboBoxSearchInput"]')
359374
.type('logstash')
360375
.then(() => {
@@ -400,6 +415,8 @@ describe('discover_advanced_setting', () => {
400415

401416
describe('searchOnPageLoad advanced setting', () => {
402417
before(() => {
418+
CURRENT_TENANT.newTenant = 'global';
419+
cy.fleshTenantSettings();
403420
cy.setAdvancedSetting({
404421
'discover:searchOnPageLoad': false,
405422
});
@@ -420,6 +437,8 @@ describe('discover_advanced_setting', () => {
420437

421438
describe('modifyColumnsOnSwitch advanced setting', () => {
422439
before(() => {
440+
CURRENT_TENANT.newTenant = 'global';
441+
cy.fleshTenantSettings();
423442
cy.setAdvancedSetting({
424443
'discover:modifyColumnsOnSwitch': false,
425444
});

cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/index_pattern_without_field.spec.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,11 @@ describe('index pattern without field spec', () => {
3636
cy.waitForLoader();
3737
});
3838

39+
beforeEach(() => {
40+
CURRENT_TENANT.newTenant = 'global';
41+
cy.fleshTenantSettings();
42+
});
43+
3944
after(() => {
4045
testFixtureHandler.clearJSONMapping(
4146
'cypress/fixtures/dashboard/opensearch_dashboards/data_explorer/index_pattern_without_timefield/mappings.json.txt'

cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/shared_links.spec.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ describe('shared links', () => {
5353
cy.waitForSearch();
5454
});
5555

56+
beforeEach(() => {
57+
CURRENT_TENANT.newTenant = 'global';
58+
cy.fleshTenantSettings();
59+
});
60+
5661
describe('shared links with state in query', () => {
5762
it('should allow for copying the snapshot URL', function () {
5863
const url = `http://localhost:5601/app/data-explorer/discover#/?_a=(discover:(columns:!(_source),isDirty:!f,sort:!()),metadata:(indexPattern:'logstash-*',view:discover))&_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:'2015-09-19T13:31:44.000Z',to:'2015-09-24T01:31:44.000Z'))&_q=(filters:!(),query:(language:kuery,query:''))`;
@@ -107,6 +112,8 @@ describe('shared links', () => {
107112

108113
describe('shared links with state in sessionStorage', () => {
109114
before(() => {
115+
CURRENT_TENANT.newTenant = 'global';
116+
cy.fleshTenantSettings();
110117
cy.setAdvancedSetting({
111118
'state:storeInSessionStorage': true,
112119
});

cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/vis_builder/basic.spec.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ if (Cypress.env('VISBUILDER_ENABLED')) {
2929
cy.importSavedObjects(VB_PATH_SO_DATA);
3030
});
3131

32+
beforeEach(() => {
33+
CURRENT_TENANT.newTenant = 'global';
34+
cy.fleshTenantSettings();
35+
});
36+
3237
it('Show existing visualizations in Visualize and navigate to it', () => {
3338
cy.visit(`${BASE_PATH}/app/visualize`);
3439
cy.get('input[type="search"]').type(`${VB_METRIC_VIS_TITLE}{enter}`);

cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/vis_builder/dashboard.spec.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ if (Cypress.env('VISBUILDER_ENABLED')) {
3838
cy.setTopNavDate(VB_INDEX_START_TIME, VB_INDEX_END_TIME);
3939
});
4040

41+
beforeEach(() => {
42+
CURRENT_TENANT.newTenant = 'global';
43+
cy.fleshTenantSettings();
44+
});
45+
4146
it('Should have valid visualizations', () => {
4247
cy.getElementByTestId(
4348
`embeddablePanelHeading-${toTestId(VB_METRIC_VIS_TITLE, '')}`

cypress/integration/plugins/gantt-chart-dashboards/gantt_ui.spec.js

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,7 @@ const DEFAULT_SIZE = 10;
2222
describe('Dump test data', () => {
2323
beforeEach(() => {
2424
CURRENT_TENANT.newTenant = 'global';
25-
if (Cypress.env('SECURITY_ENABLED')) {
26-
/**
27-
* Security plugin is using private tenant as default.
28-
* So here we'd need to set global tenant as default manually.
29-
*/
30-
cy.changeDefaultTenant({
31-
multitenancy_enabled: true,
32-
private_tenant_enabled: true,
33-
default_tenant: 'global',
34-
});
35-
}
25+
cy.fleshTenantSettings();
3626
});
3727

3828
it('Indexes test data for gantt chart', () => {

0 commit comments

Comments
 (0)