Skip to content

Commit

Permalink
Instance cleanup e2e (#1783)
Browse files Browse the repository at this point in the history
* Add instance clean up feature e2e tests

* Add database instance cleanup feature e2e tests

* Update photofinish entries and test descriptions
  • Loading branch information
arbulu89 authored Sep 7, 2023
1 parent b5a4ba3 commit 09bee58
Show file tree
Hide file tree
Showing 6 changed files with 208 additions and 3 deletions.
39 changes: 36 additions & 3 deletions .photofinish.toml
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,42 @@ files = [
"./test/fixtures/scenarios/sap-systems-overview/2ace860d-38e9-55f4-b051-faf4336e71d6_sap_system_discovery_DAA.json",
]

[sap-systems-overview-NWD-00-present]

files = [
"./test/fixtures/scenarios/healthy-27-node-SAP-cluster/7269ee51-5007-5849-aaa7-7c4a98b0c9ce_sap_system_discovery.json",
]

[sap-systems-overview-NWD-00-absent]

files = [
"./test/fixtures/scenarios/sap-systems-overview/7269ee51-5007-5849-aaa7-7c4a98b0c9ce_sap_system_discovery_absent.json",
]

[sap-systems-overview-NWD-01-present]

files = [
"./test/fixtures/scenarios/healthy-27-node-SAP-cluster/9a3ec76a-dd4f-5013-9cf0-5eb4cf89898f_sap_system_discovery.json",
]

[sap-systems-overview-NWD-01-absent]

files = [
"./test/fixtures/scenarios/sap-systems-overview/9a3ec76a-dd4f-5013-9cf0-5eb4cf89898f_sap_system_discovery_absent.json",
]

[sap-systems-overview-HDD-10-present]

files = [
"./test/fixtures/scenarios/healthy-27-node-SAP-cluster/13e8c25c-3180-5a9a-95c8-51ec38e50cfc_sap_system_discovery.json",
]

[sap-systems-overview-HDD-10-absent]

files = [
"./test/fixtures/scenarios/sap-systems-overview/13e8c25c-3180-5a9a-95c8-51ec38e50cfc_sap_system_discovery_absent.json",
]

[cluster-4-SOK]

files = [
Expand Down Expand Up @@ -140,14 +176,12 @@ files = [
"./test/fixtures/scenarios/hana-cluster-details/b767b3e9-e802-587e-a442-541d093b86b9_ha_cluster_discovery_unknown_provider.json",
]


[cluster-kvm-provider]

files = [
"./test/fixtures/scenarios/hana-cluster-details/b767b3e9-e802-587e-a442-541d093b86b9_ha_cluster_discovery_kvm_provider.json",
]


[cluster-vmware-provider]

files = [
Expand Down Expand Up @@ -190,7 +224,6 @@ files = [
"./test/fixtures/scenarios/host-details/9cd46919-5f19-59aa-993e-cf3736c71053_cloud_discovery_vmware.json",
]


[host-details-nutanix]

files = [
Expand Down
63 changes: 63 additions & 0 deletions test/e2e/cypress/e2e/databases_overview.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,67 @@ context('Databases Overview', () => {
});
});
});

describe('Instance deregistration', () => {
const hddDatabase = {
sid: 'HDD',
instance: {
instanceNumber: '10',
row: 1,
},
};

before(() => {
cy.contains(hddDatabase.sid).should('exist');

cy.get('table.table-fixed > tbody > tr').eq(0).click();
});

it('should mark an instance as absent and restore it as present on received respective discovery messages', () => {
cy.loadScenario(
`sap-systems-overview-${hddDatabase.sid}-${hddDatabase.instance.instanceNumber}-absent`
);

cy.get('table.table-fixed > tbody > tr')
.eq(1)
.find('div.table-row-group')
.eq(0)
.find('div.table-row')
.eq(hddDatabase.instance.row)
.contains('Clean up', { timeout: 15000 });

cy.loadScenario(
`sap-systems-overview-${hddDatabase.sid}-${hddDatabase.instance.instanceNumber}-present`
);

cy.get('table.table-fixed > tbody > tr')
.eq(1)
.find('div.table-row-group')
.eq(0)
.find('div.table-row')
.eq(hddDatabase.instance.row)
.should('not.contain', 'Clean up');
});

it('should deregister the database after deregistering an absent primary', () => {
cy.loadScenario(
`sap-systems-overview-${hddDatabase.sid}-${hddDatabase.instance.instanceNumber}-absent`
);

cy.get('table.table-fixed > tbody > tr')
.eq(1)
.find('div.table-row-group')
.eq(0)
.find('div.table-row')
.eq(hddDatabase.instance.row)
.contains('Clean up', { timeout: 15000 })
.click();

cy.get('#headlessui-portal-root').as('modal');

cy.get('@modal').contains('button', 'Clean up').click();

cy.contains(hddDatabase.sid).should('not.exist');
});
});
});
94 changes: 94 additions & 0 deletions test/e2e/cypress/e2e/sap_systems_overview.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,4 +344,98 @@ context('SAP Systems Overview', () => {
cy.contains(sapSystemNwd.sid).should('exist');
});
});

describe('Instance deregistration', () => {
const nwdSystem = {
sid: 'NWD',
messageserverInstance: {
instanceNumber: '00',
row: 0,
},
appInstance: {
instanceNumber: '01',
row: 1,
},
};

before(() => {
cy.contains(nwdSystem.sid).should('exist');

cy.get('table.table-fixed > tbody > tr').eq(0).click();
});

it('should mark an instance as absent and restore it as present on received respective discovery messages', () => {
cy.loadScenario(
`sap-systems-overview-${nwdSystem.sid}-${nwdSystem.appInstance.instanceNumber}-absent`
);

cy.get('table.table-fixed > tbody > tr')
.eq(1)
.find('div.table-row-group')
.eq(0)
.find('div.table-row')
.eq(nwdSystem.appInstance.row)
.contains('Clean up', { timeout: 15000 });

cy.loadScenario(
`sap-systems-overview-${nwdSystem.sid}-${nwdSystem.appInstance.instanceNumber}-present`
);

cy.get('table.table-fixed > tbody > tr')
.eq(1)
.find('div.table-row-group')
.eq(0)
.find('div.table-row')
.eq(nwdSystem.appInstance.row)
.should('not.contain', 'Clean up');
});

it('should deregister an application instance', () => {
cy.loadScenario(
`sap-systems-overview-${nwdSystem.sid}-${nwdSystem.appInstance.instanceNumber}-absent`
);

cy.get('table.table-fixed > tbody > tr')
.eq(1)
.find('div.table-row-group')
.eq(0)
.find('div.table-row')
.eq(nwdSystem.appInstance.row)
.contains('Clean up', { timeout: 15000 })
.click();

cy.get('#headlessui-portal-root').as('modal');

cy.get('@modal').contains('button', 'Clean up').click();

cy.get('table.table-fixed > tbody > tr')
.eq(1)
.find('div.table-row-group')
.eq(0)
.find('div.table-row')
.its('length')
.should('eq', 3);
});

it('should deregister the SAP system after deregistering an absent messageserver', () => {
cy.loadScenario(
`sap-systems-overview-${nwdSystem.sid}-${nwdSystem.messageserverInstance.instanceNumber}-absent`
);

cy.get('table.table-fixed > tbody > tr')
.eq(1)
.find('div.table-row-group')
.eq(0)
.find('div.table-row')
.eq(nwdSystem.messageserverInstance.row)
.contains('Clean up', { timeout: 15000 })
.click();

cy.get('#headlessui-portal-root').as('modal');

cy.get('@modal').contains('button', 'Clean up').click();

cy.contains(nwdSystem.sid).should('not.exist');
});
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"agent_id": "13e8c25c-3180-5a9a-95c8-51ec38e50cfc",
"discovery_type": "sap_system_discovery",
"payload": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"agent_id": "7269ee51-5007-5849-aaa7-7c4a98b0c9ce",
"discovery_type": "sap_system_discovery",
"payload": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"agent_id": "9a3ec76a-dd4f-5013-9cf0-5eb4cf89898f",
"discovery_type": "sap_system_discovery",
"payload": []
}

0 comments on commit 09bee58

Please sign in to comment.