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

Use databasesList slice properly to get db instances #1980

Merged
merged 3 commits into from
Nov 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions assets/js/components/ClustersList.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ describe('ClustersList component', () => {
applicationInstances: [],
databaseInstances: [],
},
databasesList: {
databaseInstances: [],
},
};

const scenarios = [
Expand Down
4 changes: 2 additions & 2 deletions assets/js/state/selectors/sapSystem.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const getEnrichedApplicationInstances = createSelector(
);

export const getEnrichedDatabaseInstances = createSelector(
[(state) => enrichInstances(state.sapSystemsList.databaseInstances)(state)],
[(state) => enrichInstances(state.databasesList.databaseInstances)(state)],
(enrichedInstances) => enrichedInstances
);

Expand Down Expand Up @@ -110,7 +110,7 @@ export const getInstancesOnHost = createSelector(
export const getAllSAPInstances = createSelector(
[
(state) => state.sapSystemsList.applicationInstances,
(state) => state.sapSystemsList.databaseInstances,
(state) => state.databasesList.databaseInstances,
],
(applicationInstances, databaseInstances) =>
applicationInstances
Expand Down
4 changes: 3 additions & 1 deletion assets/js/state/selectors/sapSystem.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ describe('sapSystem selector', () => {
];

const state = {
sapSystemsList: {
databasesList: {
databaseInstances,
},
hostsList: {
Expand Down Expand Up @@ -232,6 +232,8 @@ describe('sapSystem selector', () => {
{ id: 1, name: 'APP1' },
{ id: 2, name: 'APP2' },
],
},
databasesList: {
databaseInstances: [
{ id: 3, name: 'DB1' },
{ id: 4, name: 'DB2' },
Expand Down
16 changes: 16 additions & 0 deletions test/e2e/cypress/e2e/databases_overview.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,13 @@ context('Databases Overview', () => {
],
};

const nwqSystem = {
sid: 'NWQ',
ascsInstance: {
id: '25677e37-fd33-5005-896c-9275b1284534',
},
};

it(`should not display DB ${hdqDatabase.sid} after deregistering the primary instance`, () => {
cy.deregisterHost(hdqDatabase.instances[0].id);
cy.contains(hdqDatabase.sid).should('not.exist');
Expand All @@ -47,6 +54,15 @@ context('Databases Overview', () => {
});
});
});

it('should not deregister database instances if the SAP system using the database is deregistered', () => {
cy.deregisterHost(nwqSystem.ascsInstance.id);
cy.contains(
'p',
`The SAP System ${nwqSystem.sid} has been deregistered.`
);
cy.get('.table-row-group > div.table-row').should('have.length', 6);
});
});

describe('Instance deregistration', () => {
Expand Down