Skip to content

Commit

Permalink
Merge branch '2.x' into backport/backport-736-to-2.x
Browse files Browse the repository at this point in the history
  • Loading branch information
SuZhou-Joe authored Sep 3, 2024
2 parents b62b523 + a0ab375 commit 5bfcbcf
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ if (Cypress.env('SECURITY_ENABLED') && Cypress.env('AGGREGATION_VIEW')) {
ADMIN_AUTH.newUser = Cypress.env('username');
ADMIN_AUTH.newPassword = Cypress.env('password');
CURRENT_TENANT.newTenant = 'private';
cy.deleteIndexPattern('index-pattern1', { failOnStatusCode: false });
cy.deleteIndexPattern('index-pattern2', { failOnStatusCode: false });
});
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { TENANTS_MANAGE_PATH } from '../../../utils/dashboards/constants';
import { SECURITY_PLUGIN_PATH } from '../../../utils/dashboards/constants';

if (Cypress.env('SECURITY_ENABLED') && !Cypress.env('MULTITENANCY_ENABLED')) {
describe('Multi Tenancy Tests: ', () => {
Expand All @@ -12,10 +12,10 @@ if (Cypress.env('SECURITY_ENABLED') && !Cypress.env('MULTITENANCY_ENABLED')) {
});
it('Test Dashboards tenancy features should not be accessible ', () => {
// This test is to ensure tenancy related features are not accessible when opensearch_security.multitenancy.enabled is disabled in the opensearchdashboard.yaml
cy.visit(TENANTS_MANAGE_PATH);
cy.visit(SECURITY_PLUGIN_PATH);
cy.waitForLoader();

cy.contains('You have not enabled multi tenancy').should('exist');
cy.get('[title="Tenants"]').should('not.exist');

// Switch tenants button should not exist when multi-tenancy is disabled.
cy.get('#user-icon-btn').click();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ if (Cypress.env('SECURITY_ENABLED')) {
indexPatternPrivateTenantHeaderSetUp
);
});
after(() => {
cy.deleteIndexPattern('index-pattern1', { failOnStatusCode: false });
cy.deleteIndexPattern('index-pattern2', { failOnStatusCode: false });
});
it('Test 1 Disable Multi Tenancy ', () => {
CURRENT_TENANT.newTenant = 'private';

Expand Down
2 changes: 1 addition & 1 deletion cypress/utils/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ Cypress.Commands.overwrite('visit', (orig, url, options) => {
}

if (waitForGetTenant) {
cy.intercept('GET', '/api/v1/multitenancy/tenant').as('getTenant');
cy.intercept('GET', '/api/v1/multitenancy/tenant*').as('getTenant');
orig(url, newOptions);
supressNoRequestOccurred();
cy.wait('@getTenant');
Expand Down
3 changes: 3 additions & 0 deletions cypress/utils/dashboards/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import { BASE_PATH } from '../base_constants';

// STACK MANAGEMENT PATH
export const STACK_MANAGEMENT_PATH = BASE_PATH + '/app/management';
export const SECURITY_PLUGIN_PATH =
BASE_PATH + '/app/security-dashboards-plugin#/';

export const TENANTS_MANAGE_PATH =
BASE_PATH + '/app/security-dashboards-plugin#/tenants';

Expand Down

0 comments on commit 5bfcbcf

Please sign in to comment.