Skip to content

Commit

Permalink
Fix: test failures related to saved objects(tenant) (opensearch-proje…
Browse files Browse the repository at this point in the history
…ct#1321) (opensearch-project#1325)

* 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]>
(cherry picked from commit 71116ec)

Co-authored-by: SuZhou-Joe <[email protected]>
  • Loading branch information
opensearch-trigger-bot[bot] and SuZhou-Joe authored May 11, 2024
1 parent ca7ab80 commit 5f51add
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,7 @@ const indexSet = [
describe('discover app', { scrollBehavior: false }, () => {
before(() => {
CURRENT_TENANT.newTenant = 'global';
if (Cypress.env('SECURITY_ENABLED')) {
/**
* Security plugin is using private tenant as default.
* So here we'd need to set global tenant as default manually.
*/
cy.changeDefaultTenant({
multitenancy_enabled: true,
private_tenant_enabled: true,
default_tenant: 'global',
});
}
cy.fleshTenantSettings();
// import logstash functional
testFixtureHandler.importJSONDocIfNeeded(
indexSet,
Expand Down Expand Up @@ -66,6 +56,11 @@ describe('discover app', { scrollBehavior: false }, () => {
cy.switchDiscoverTable('new');
});

beforeEach(() => {
CURRENT_TENANT.newTenant = 'global';
cy.fleshTenantSettings();
});

after(() => {});

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

before(() => {
CURRENT_TENANT.newTenant = 'global';
cy.fleshTenantSettings();
cy.switchDiscoverTable('new');
cy.setTopNavDate(fromTime, toTime);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@ describe('discover_advanced_setting', () => {
cy.waitForSearch();
});

beforeEach(() => {
CURRENT_TENANT.newTenant = 'global';
cy.fleshTenantSettings();
});

describe('maxHeight advanced setting for legacy table', () => {
it('checks if the table respects maxHeight setting of no truncation', function () {
cy.setAdvancedSetting({
Expand Down Expand Up @@ -191,6 +196,8 @@ describe('discover_advanced_setting', () => {

describe('Number of rows advanced setting', () => {
before(() => {
CURRENT_TENANT.newTenant = 'global';
cy.fleshTenantSettings();
cy.setAdvancedSetting({
'discover:sampleSize': 5,
});
Expand Down Expand Up @@ -222,6 +229,8 @@ describe('discover_advanced_setting', () => {

describe('Number of terms advanced setting', () => {
before(() => {
CURRENT_TENANT.newTenant = 'global';
cy.fleshTenantSettings();
cy.setAdvancedSetting({
'discover:aggs:terms:size': 5,
});
Expand Down Expand Up @@ -250,6 +259,8 @@ describe('discover_advanced_setting', () => {

describe('hideTimeColumn advanced setting', () => {
before(() => {
CURRENT_TENANT.newTenant = 'global';
cy.fleshTenantSettings();
cy.setAdvancedSetting({
'doc_table:hideTimeColumn': true,
});
Expand Down Expand Up @@ -299,6 +310,8 @@ describe('discover_advanced_setting', () => {

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

describe('defaultColumns advanced setting', () => {
before(() => {
CURRENT_TENANT.newTenant = 'global';
cy.fleshTenantSettings();
cy.get('[data-test-subj="comboBoxSearchInput"]')
.type('logstash')
.then(() => {
Expand Down Expand Up @@ -400,6 +415,8 @@ describe('discover_advanced_setting', () => {

describe('searchOnPageLoad advanced setting', () => {
before(() => {
CURRENT_TENANT.newTenant = 'global';
cy.fleshTenantSettings();
cy.setAdvancedSetting({
'discover:searchOnPageLoad': false,
});
Expand All @@ -420,6 +437,8 @@ describe('discover_advanced_setting', () => {

describe('modifyColumnsOnSwitch advanced setting', () => {
before(() => {
CURRENT_TENANT.newTenant = 'global';
cy.fleshTenantSettings();
cy.setAdvancedSetting({
'discover:modifyColumnsOnSwitch': false,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ describe('index pattern without field spec', () => {
cy.waitForLoader();
});

beforeEach(() => {
CURRENT_TENANT.newTenant = 'global';
cy.fleshTenantSettings();
});

after(() => {
testFixtureHandler.clearJSONMapping(
'cypress/fixtures/dashboard/opensearch_dashboards/data_explorer/index_pattern_without_timefield/mappings.json.txt'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,11 @@ describe('shared links', () => {
cy.waitForSearch();
});

beforeEach(() => {
CURRENT_TENANT.newTenant = 'global';
cy.fleshTenantSettings();
});

describe('shared links with state in query', () => {
it('should allow for copying the snapshot URL', function () {
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:''))`;
Expand Down Expand Up @@ -107,6 +112,8 @@ describe('shared links', () => {

describe('shared links with state in sessionStorage', () => {
before(() => {
CURRENT_TENANT.newTenant = 'global';
cy.fleshTenantSettings();
cy.setAdvancedSetting({
'state:storeInSessionStorage': true,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ if (Cypress.env('VISBUILDER_ENABLED')) {
cy.importSavedObjects(VB_PATH_SO_DATA);
});

beforeEach(() => {
CURRENT_TENANT.newTenant = 'global';
cy.fleshTenantSettings();
});

it('Show existing visualizations in Visualize and navigate to it', () => {
cy.visit(`${BASE_PATH}/app/visualize`);
cy.get('input[type="search"]').type(`${VB_METRIC_VIS_TITLE}{enter}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ if (Cypress.env('VISBUILDER_ENABLED')) {
cy.setTopNavDate(VB_INDEX_START_TIME, VB_INDEX_END_TIME);
});

beforeEach(() => {
CURRENT_TENANT.newTenant = 'global';
cy.fleshTenantSettings();
});

it('Should have valid visualizations', () => {
cy.getElementByTestId(
`embeddablePanelHeading-${toTestId(VB_METRIC_VIS_TITLE, '')}`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,7 @@ const DEFAULT_SIZE = 10;
describe('Dump test data', () => {
beforeEach(() => {
CURRENT_TENANT.newTenant = 'global';
if (Cypress.env('SECURITY_ENABLED')) {
/**
* Security plugin is using private tenant as default.
* So here we'd need to set global tenant as default manually.
*/
cy.changeDefaultTenant({
multitenancy_enabled: true,
private_tenant_enabled: true,
default_tenant: 'global',
});
}
cy.fleshTenantSettings();
});

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

0 comments on commit 5f51add

Please sign in to comment.