Skip to content

Commit

Permalink
Updates unit tests and reverts a change in cypress test
Browse files Browse the repository at this point in the history
Signed-off-by: Darshit Chanpura <[email protected]>
  • Loading branch information
DarshitChanpura committed Mar 29, 2024
1 parent a04c5b8 commit 2f7e07d
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,25 @@ const closeToast = () => {
};

const deleteAllDataSources = () => {
cy.visit('http://localhost:5601/app/management/opensearch-dashboards/dataSources');

closeToast();

cy.get('[data-test-subj="checkboxSelectAll"]').should('exist');
cy.get('[data-test-subj="checkboxSelectAll"]').click();
cy.get('[data-test-subj="checkboxSelectAll"]').should('be.checked');
cy.get('[data-test-subj="deleteDataSourceConnections"]').click();
cy.get('[data-test-subj="confirmModalConfirmButton"]').click();
cy.request(
'GET',
`${Cypress.config(
'baseUrl'
)}/api/saved_objects/_find?fields=id&fields=description&fields=title&per_page=10000&type=data-source`
).then((resp) => {
if (resp && resp.body && resp.body.saved_objects) {
resp.body.saved_objects.map(({ id }) => {
cy.request({
method: 'DELETE',
url: `${Cypress.config('baseUrl')}/api/saved_objects/data-source/${id}`,
body: { force: false },
headers: {
'osd-xsrf': true,
},
});
});
}
});
};

describe('Multi-datasources enabled', () => {
Expand Down
11 changes: 11 additions & 0 deletions test/jest_integration/security_entity_api.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,17 @@ describe('start OpenSearch Dashboards server multi datasources enabled', () => {
'some_allowed_action'
);

// verify that this AG is not created in Local Cluster
const getActionGroupsResponseLocalCluster = await getAllEntitiesAsAdminWithDataSource(
root,
entityType,
''
);
expect(getActionGroupsResponseLocalCluster.status).toEqual(200);
expect(getActionGroupsResponseLocalCluster.body.data?.hasOwnProperty(testActionGroupName)).toBe(
false
);

const updatePermissionResponse = await createOrUpdateEntityAsAdminWithDataSource(
root,
entityType,
Expand Down

0 comments on commit 2f7e07d

Please sign in to comment.