Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport 2.x] Allow URL params for Security plugin intercept calls (#1276) #1332

Merged
merged 5 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions cypress.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"SECURITY_ENABLED": false,
"MULTITENANCY_ENABLED": true,
"AGGREGATION_VIEW": false,
"MULTITENANCY_ENABLED": true,
SuZhou-Joe marked this conversation as resolved.
Show resolved Hide resolved
"username": "admin",
"password": "myStrongPassword123!",
"ENDPOINT_WITH_PROXY": false,
Expand Down
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 @@ -90,7 +90,7 @@ Cypress.Commands.overwrite('visit', (orig, url, options) => {
}
newOptions.qs = { security_tenant: CURRENT_TENANT.defaultTenant };
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
Loading