From 6b804219b80ca8712c36d2974ac8b72e506ca710 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Torrero=20Marijnissen?= Date: Fri, 14 Jul 2023 14:37:01 +0100 Subject: [PATCH 01/11] Add new command to deregister host --- test/e2e/cypress/support/commands.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/test/e2e/cypress/support/commands.js b/test/e2e/cypress/support/commands.js index d5784e3a9b..892d5d78c1 100644 --- a/test/e2e/cypress/support/commands.js +++ b/test/e2e/cypress/support/commands.js @@ -212,3 +212,26 @@ Cypress.Commands.add('requestChecksExecution', (clusterId) => { }); }); }); + +Cypress.Commands.add('deregisterHost', (hostId) => { + const [webAPIHost, webAPIPort] = [ + Cypress.env('web_api_host'), + Cypress.env('web_api_port'), + ]; + + const headers = { + 'Content-Type': 'application/json;charset=UTF-8', + }; + + apiLogin().then(({ accessToken }) => { + const url = `http://${webAPIHost}:${webAPIPort}/api/v1/hosts/${hostId}`; + cy.request({ + method: 'DELETE', + url: url, + headers: headers, + auth: { + bearer: accessToken, + }, + }); + }); +}); From 4ca2be2704ed52b37e73ba41e4b1c9aff06b37cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Torrero=20Marijnissen?= Date: Tue, 18 Jul 2023 16:33:43 +0100 Subject: [PATCH 02/11] Add deregistration tests for clusters,databases & sapsystems overviews --- test/e2e/cypress/e2e/clusters_overview.cy.js | 71 +++++++++++++------ test/e2e/cypress/e2e/databases_overview.cy.js | 24 +++++++ .../cypress/e2e/sap_systems_overview.cy.js | 18 +++++ 3 files changed, 90 insertions(+), 23 deletions(-) create mode 100644 test/e2e/cypress/e2e/databases_overview.cy.js diff --git a/test/e2e/cypress/e2e/clusters_overview.cy.js b/test/e2e/cypress/e2e/clusters_overview.cy.js index 88f331e358..1cb003e150 100644 --- a/test/e2e/cypress/e2e/clusters_overview.cy.js +++ b/test/e2e/cypress/e2e/clusters_overview.cy.js @@ -8,7 +8,7 @@ const clusterIdByName = (clusterName) => availableClusters.find(({ name }) => name === clusterName).id; context('Clusters Overview', () => { - beforeEach(() => { + before(() => { cy.visit('/clusters'); cy.url().should('include', '/clusters'); }); @@ -122,31 +122,56 @@ context('Clusters Overview', () => { .should('have.class', 'fill-red-500'); }); }); + }); - describe('Clusters Tagging', () => { - before(() => { - cy.removeTagsFromView(); - }); - const clustersByMatchingPattern = (pattern) => (clusterName) => - clusterName.includes(pattern); - const taggingRules = [ - ['hana_cluster_1', 'env1'], - ['hana_cluster_2', 'env2'], - ['hana_cluster_3', 'env3'], - ]; - - taggingRules.forEach(([pattern, tag]) => { - describe(`Add tag '${tag}' to all clusters with '${pattern}' in the cluster name`, () => { - availableClusters - .map(({ name }) => name) - .filter(clustersByMatchingPattern(pattern)) - .forEach((clusterName) => { - it(`should tag cluster '${clusterName}'`, () => { - cy.addTagByColumnValue(clusterName, tag); - }); + describe('Clusters Tagging', () => { + before(() => { + cy.removeTagsFromView(); + }); + const clustersByMatchingPattern = (pattern) => (clusterName) => + clusterName.includes(pattern); + const taggingRules = [ + ['hana_cluster_1', 'env1'], + ['hana_cluster_2', 'env2'], + ['hana_cluster_3', 'env3'], + ]; + + taggingRules.forEach(([pattern, tag]) => { + describe(`Add tag '${tag}' to all clusters with '${pattern}' in the cluster name`, () => { + availableClusters + .map(({ name }) => name) + .filter(clustersByMatchingPattern(pattern)) + .forEach((clusterName) => { + it(`should tag cluster '${clusterName}'`, () => { + cy.addTagByColumnValue(clusterName, tag); }); - }); + }); }); }); }); + + describe('Deregistration', () => { + const hana_cluster_1 = { + name: 'hana_cluster_1', + hosts: [ + { + id: '13e8c25c-3180-5a9a-95c8-51ec38e50cfc', + name: 'vmhdbdev01', + }, + { + id: '0a055c90-4cb6-54ce-ac9c-ae3fedaf40d4', + name: 'vmhdbdev02', + }, + ], + }; + + before(() => { + cy.deregisterHost(hana_cluster_1.hosts[0].id); + cy.deregisterHost(hana_cluster_1.hosts[1].id); + }); + + it(`should not display '${hana_cluster_1.name}' after deregistering all its nodes`, () => { + cy.contains(hana_cluster_1.name).should('not.exist'); + }); + }); }); diff --git a/test/e2e/cypress/e2e/databases_overview.cy.js b/test/e2e/cypress/e2e/databases_overview.cy.js new file mode 100644 index 0000000000..29754171ca --- /dev/null +++ b/test/e2e/cypress/e2e/databases_overview.cy.js @@ -0,0 +1,24 @@ +context('Databases Overview', () => { + before(() => { + cy.visit('/databases'); + cy.url().should('include', '/databases'); + }); + + describe('Deregistration', () => { + const hdq_database = { + sid: 'HDQ', + hana_primary: { + name: 'vmhdbqas01', + id: '99cf8a3a-48d6-57a4-b302-6e4482227ab6', + }, + }; + + before(() => { + cy.deregisterHost(hdq_database.hana_primary.id); + }); + + it(`should not display DB ${hdq_database.hana_primary.name} after deregistering the primary instance`, () => { + cy.contains(hdq_database.sid).should('not.exist'); + }); + }); +}); diff --git a/test/e2e/cypress/e2e/sap_systems_overview.cy.js b/test/e2e/cypress/e2e/sap_systems_overview.cy.js index 4c407bd233..62cf87d9f2 100644 --- a/test/e2e/cypress/e2e/sap_systems_overview.cy.js +++ b/test/e2e/cypress/e2e/sap_systems_overview.cy.js @@ -291,4 +291,22 @@ context('SAP Systems Overview', () => { cy.get('table.table-fixed').should('not.contain', 'DAA'); }); }); + + describe('Deregistration', () => { + const sap_system_nwp = { + sid: 'NWP', + hana_primary: { + name: 'vmhdbprd01', + id: '9cd46919-5f19-59aa-993e-cf3736c71053', + }, + }; + + before(() => { + cy.deregisterHost(sap_system_nwp.hana_primary.id); + }); + + it(`should not display SAP System ${sap_system_nwp.sid} after deregistering the primary instance`, () => { + cy.contains(sap_system_nwp.sid).should('not.exist'); + }); + }); }); From 8a257c2405a56d94cbbf3bf77d8293cc334d3f8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Torrero=20Marijnissen?= Date: Wed, 19 Jul 2023 10:22:28 +0100 Subject: [PATCH 03/11] Add sap system details e2e test --- test/e2e/cypress/e2e/sap_system_details.cy.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/e2e/cypress/e2e/sap_system_details.cy.js b/test/e2e/cypress/e2e/sap_system_details.cy.js index c4c6e50424..bca05e26f5 100644 --- a/test/e2e/cypress/e2e/sap_system_details.cy.js +++ b/test/e2e/cypress/e2e/sap_system_details.cy.js @@ -132,4 +132,21 @@ context('SAP system details', () => { }); }); }); + + describe('Deregistration', () => { + const hostToDeregister = { + name: 'vmnwdev02', + id: 'fb2c6b8a-9915-5969-a6b7-8b5a42de1971', + }; + + before(() => { + cy.visit(`/sap_systems/${selectedSystem.Id}`); + cy.url().should('include', `/sap_systems/${selectedSystem.Id}`); + cy.deregisterHost(hostToDeregister.id); + }); + + it(`should not include ${hostToDeregister.name} in the list of hosts`, () => { + cy.contains(hostToDeregister.name).should('not.exist'); + }); + }); }); From 81665827e9e04c66c03ad28557d4f513b5844eb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Torrero=20Marijnissen?= Date: Wed, 19 Jul 2023 11:31:44 +0100 Subject: [PATCH 04/11] Add hana cluster details e2e test --- .../cypress/e2e/hana_cluster_details.cy.js | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/e2e/cypress/e2e/hana_cluster_details.cy.js b/test/e2e/cypress/e2e/hana_cluster_details.cy.js index 5d1f15b889..5e52f8ef85 100644 --- a/test/e2e/cypress/e2e/hana_cluster_details.cy.js +++ b/test/e2e/cypress/e2e/hana_cluster_details.cy.js @@ -263,4 +263,24 @@ context('HANA cluster details', () => { cy.get('li').first().contains(5000); }); }); + + describe('Deregistration', () => { + const hostToDeregister = { + name: 'vmhdbprd02', + id: 'b767b3e9-e802-587e-a442-541d093b86b9', + sid: 'WDF', + }; + + before(() => { + cy.deregisterHost(hostToDeregister.id); + cy.visit(`/clusters/${availableHanaCluster.id}`); + cy.url().should('include', `/clusters/${availableHanaCluster.id}`); + }); + + it(`should not include a working link to ${hostToDeregister.name} in the list of sites`, () => { + cy.get(`.tn-site-details-${hostToDeregister.sid}`) + .contains('a', hostToDeregister.name) + .should('not.exist'); + }); + }); }); From 334494ed1f9fa84654e50d5b69143c1f4e41c1f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Torrero=20Marijnissen?= Date: Wed, 19 Jul 2023 12:02:30 +0100 Subject: [PATCH 05/11] Add e2e test for hana db details --- test/e2e/cypress/e2e/hana_database_details.cy.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/e2e/cypress/e2e/hana_database_details.cy.js b/test/e2e/cypress/e2e/hana_database_details.cy.js index a19c83e097..d7baf643a5 100644 --- a/test/e2e/cypress/e2e/hana_database_details.cy.js +++ b/test/e2e/cypress/e2e/hana_database_details.cy.js @@ -128,4 +128,14 @@ context('HANA database details', () => { }); }); }); + + describe('Deregistration', () => { + before(() => { + cy.deregisterHost(attachedHosts[0].AgentId); + }); + + it(`should not include host ${attachedHosts[0].Name} in the list of hosts`, () => { + cy.contains(attachedHosts[0].Name).should('not.exist'); + }); + }); }); From 43428324ab02a497537dfe4b308583169a581cdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Torrero=20Marijnissen?= Date: Wed, 19 Jul 2023 15:41:39 +0100 Subject: [PATCH 06/11] Move deregistration out of before() and fix style --- test/e2e/cypress/e2e/clusters_overview.cy.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/test/e2e/cypress/e2e/clusters_overview.cy.js b/test/e2e/cypress/e2e/clusters_overview.cy.js index 1cb003e150..a4be6b60a7 100644 --- a/test/e2e/cypress/e2e/clusters_overview.cy.js +++ b/test/e2e/cypress/e2e/clusters_overview.cy.js @@ -151,7 +151,7 @@ context('Clusters Overview', () => { }); describe('Deregistration', () => { - const hana_cluster_1 = { + const hanaCluster1 = { name: 'hana_cluster_1', hosts: [ { @@ -165,13 +165,12 @@ context('Clusters Overview', () => { ], }; - before(() => { - cy.deregisterHost(hana_cluster_1.hosts[0].id); - cy.deregisterHost(hana_cluster_1.hosts[1].id); - }); + before(() => {}); - it(`should not display '${hana_cluster_1.name}' after deregistering all its nodes`, () => { - cy.contains(hana_cluster_1.name).should('not.exist'); + it(`should not display '${hanaCluster1.name}' after deregistering all its nodes`, () => { + cy.deregisterHost(hanaCluster1.hosts[0].id); + cy.deregisterHost(hanaCluster1.hosts[1].id); + cy.contains(hanaCluster1.name).should('not.exist'); }); }); }); From e342c32fdcd100a3fc88a8e5dd4d82da40a75aaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Torrero=20Marijnissen?= Date: Wed, 19 Jul 2023 15:42:55 +0100 Subject: [PATCH 07/11] camelCase all the things --- test/e2e/cypress/e2e/databases_overview.cy.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/e2e/cypress/e2e/databases_overview.cy.js b/test/e2e/cypress/e2e/databases_overview.cy.js index 29754171ca..7ca54b2591 100644 --- a/test/e2e/cypress/e2e/databases_overview.cy.js +++ b/test/e2e/cypress/e2e/databases_overview.cy.js @@ -5,7 +5,7 @@ context('Databases Overview', () => { }); describe('Deregistration', () => { - const hdq_database = { + const hdqDatabase = { sid: 'HDQ', hana_primary: { name: 'vmhdbqas01', @@ -14,11 +14,11 @@ context('Databases Overview', () => { }; before(() => { - cy.deregisterHost(hdq_database.hana_primary.id); + cy.deregisterHost(hdqDatabase.hana_primary.id); }); - it(`should not display DB ${hdq_database.hana_primary.name} after deregistering the primary instance`, () => { - cy.contains(hdq_database.sid).should('not.exist'); + it(`should not display DB ${hdqDatabase.sid} after deregistering the primary instance`, () => { + cy.contains(hdqDatabase.sid).should('not.exist'); }); }); }); From 99a9b4389ad4e9ad9f6b1652a2decb33e0b67a1e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Torrero=20Marijnissen?= Date: Wed, 19 Jul 2023 15:43:06 +0100 Subject: [PATCH 08/11] Add additional sap systems e2e tests --- .../cypress/e2e/sap_systems_overview.cy.js | 42 ++++++++++++++++--- 1 file changed, 36 insertions(+), 6 deletions(-) diff --git a/test/e2e/cypress/e2e/sap_systems_overview.cy.js b/test/e2e/cypress/e2e/sap_systems_overview.cy.js index 62cf87d9f2..becc37ac73 100644 --- a/test/e2e/cypress/e2e/sap_systems_overview.cy.js +++ b/test/e2e/cypress/e2e/sap_systems_overview.cy.js @@ -293,20 +293,50 @@ context('SAP Systems Overview', () => { }); describe('Deregistration', () => { - const sap_system_nwp = { + const sapSystemNwp = { sid: 'NWP', - hana_primary: { + hanaPrimary: { name: 'vmhdbprd01', id: '9cd46919-5f19-59aa-993e-cf3736c71053', }, }; - before(() => { - cy.deregisterHost(sap_system_nwp.hana_primary.id); + const sapSystemNwq = { + sid: 'NWQ', + messageserverInstance: { + name: 'vmnwqas01', + id: '25677e37-fd33-5005-896c-9275b1284534', + }, + }; + + const sapSystemNwd = { + sid: 'NWD', + applicationInstances: [ + { + name: 'vmnwdev03', + id: '9a3ec76a-dd4f-5013-9cf0-5eb4cf89898f', + }, + { + name: 'vmnwdev04', + id: '1b0e9297-97dd-55d6-9874-8efde4d84c90', + }, + ], + }; + + it(`should not display SAP System ${sapSystemNwp.sid} after deregistering the primary instance`, () => { + cy.deregisterHost(sapSystemNwp.hanaPrimary.id); + cy.contains(sapSystemNwp.sid).should('not.exist'); + }); + + it(`should not display SAP System ${sapSystemNwq.sid} after deregistering the instance running the messageserver`, () => { + cy.deregisterHost(sapSystemNwq.messageserverInstance.id); + cy.contains(sapSystemNwq.sid).should('not.exist'); }); - it(`should not display SAP System ${sap_system_nwp.sid} after deregistering the primary instance`, () => { - cy.contains(sap_system_nwp.sid).should('not.exist'); + it(`should not display SAP System ${sapSystemNwd.sid} after deregistering both application instances`, () => { + cy.deregisterHost(sapSystemNwd.applicationInstances[0].id); + cy.deregisterHost(sapSystemNwd.applicationInstances[1].id); + cy.contains(sapSystemNwd.sid).should('not.exist'); }); }); }); From c0c7e46621faeb8566a3f4468e18a8d7f6b9c467 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Torrero=20Marijnissen?= Date: Thu, 20 Jul 2023 07:56:51 +0100 Subject: [PATCH 09/11] Additional clean-ups --- test/e2e/cypress/e2e/clusters_overview.cy.js | 16 ++++------------ test/e2e/cypress/e2e/databases_overview.cy.js | 7 ++----- test/e2e/cypress/e2e/sap_system_details.cy.js | 2 +- 3 files changed, 7 insertions(+), 18 deletions(-) diff --git a/test/e2e/cypress/e2e/clusters_overview.cy.js b/test/e2e/cypress/e2e/clusters_overview.cy.js index a4be6b60a7..e5eca2ca67 100644 --- a/test/e2e/cypress/e2e/clusters_overview.cy.js +++ b/test/e2e/cypress/e2e/clusters_overview.cy.js @@ -154,22 +154,14 @@ context('Clusters Overview', () => { const hanaCluster1 = { name: 'hana_cluster_1', hosts: [ - { - id: '13e8c25c-3180-5a9a-95c8-51ec38e50cfc', - name: 'vmhdbdev01', - }, - { - id: '0a055c90-4cb6-54ce-ac9c-ae3fedaf40d4', - name: 'vmhdbdev02', - }, + '13e8c25c-3180-5a9a-95c8-51ec38e50cfc', + '0a055c90-4cb6-54ce-ac9c-ae3fedaf40d4', ], }; - before(() => {}); - it(`should not display '${hanaCluster1.name}' after deregistering all its nodes`, () => { - cy.deregisterHost(hanaCluster1.hosts[0].id); - cy.deregisterHost(hanaCluster1.hosts[1].id); + cy.deregisterHost(hanaCluster1.hosts[0]); + cy.deregisterHost(hanaCluster1.hosts[1]); cy.contains(hanaCluster1.name).should('not.exist'); }); }); diff --git a/test/e2e/cypress/e2e/databases_overview.cy.js b/test/e2e/cypress/e2e/databases_overview.cy.js index 7ca54b2591..af337204fd 100644 --- a/test/e2e/cypress/e2e/databases_overview.cy.js +++ b/test/e2e/cypress/e2e/databases_overview.cy.js @@ -7,17 +7,14 @@ context('Databases Overview', () => { describe('Deregistration', () => { const hdqDatabase = { sid: 'HDQ', - hana_primary: { + hanaPrimary: { name: 'vmhdbqas01', id: '99cf8a3a-48d6-57a4-b302-6e4482227ab6', }, }; - before(() => { - cy.deregisterHost(hdqDatabase.hana_primary.id); - }); - it(`should not display DB ${hdqDatabase.sid} after deregistering the primary instance`, () => { + cy.deregisterHost(hdqDatabase.hanaPrimary.id); cy.contains(hdqDatabase.sid).should('not.exist'); }); }); diff --git a/test/e2e/cypress/e2e/sap_system_details.cy.js b/test/e2e/cypress/e2e/sap_system_details.cy.js index bca05e26f5..ec64f314c4 100644 --- a/test/e2e/cypress/e2e/sap_system_details.cy.js +++ b/test/e2e/cypress/e2e/sap_system_details.cy.js @@ -142,10 +142,10 @@ context('SAP system details', () => { before(() => { cy.visit(`/sap_systems/${selectedSystem.Id}`); cy.url().should('include', `/sap_systems/${selectedSystem.Id}`); - cy.deregisterHost(hostToDeregister.id); }); it(`should not include ${hostToDeregister.name} in the list of hosts`, () => { + cy.deregisterHost(hostToDeregister.id); cy.contains(hostToDeregister.name).should('not.exist'); }); }); From a7b6c7765c61d878d76e5df3c3fbfb60dc1ba37e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Torrero=20Marijnissen?= Date: Thu, 20 Jul 2023 09:36:56 +0100 Subject: [PATCH 10/11] Move host deregistration out of the before --- test/e2e/cypress/e2e/hana_cluster_details.cy.js | 2 +- test/e2e/cypress/e2e/hana_database_details.cy.js | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/test/e2e/cypress/e2e/hana_cluster_details.cy.js b/test/e2e/cypress/e2e/hana_cluster_details.cy.js index 5e52f8ef85..8bcbdc6820 100644 --- a/test/e2e/cypress/e2e/hana_cluster_details.cy.js +++ b/test/e2e/cypress/e2e/hana_cluster_details.cy.js @@ -272,12 +272,12 @@ context('HANA cluster details', () => { }; before(() => { - cy.deregisterHost(hostToDeregister.id); cy.visit(`/clusters/${availableHanaCluster.id}`); cy.url().should('include', `/clusters/${availableHanaCluster.id}`); }); it(`should not include a working link to ${hostToDeregister.name} in the list of sites`, () => { + cy.deregisterHost(hostToDeregister.id); cy.get(`.tn-site-details-${hostToDeregister.sid}`) .contains('a', hostToDeregister.name) .should('not.exist'); diff --git a/test/e2e/cypress/e2e/hana_database_details.cy.js b/test/e2e/cypress/e2e/hana_database_details.cy.js index d7baf643a5..f5723147db 100644 --- a/test/e2e/cypress/e2e/hana_database_details.cy.js +++ b/test/e2e/cypress/e2e/hana_database_details.cy.js @@ -130,11 +130,8 @@ context('HANA database details', () => { }); describe('Deregistration', () => { - before(() => { - cy.deregisterHost(attachedHosts[0].AgentId); - }); - it(`should not include host ${attachedHosts[0].Name} in the list of hosts`, () => { + cy.deregisterHost(attachedHosts[0].AgentId); cy.contains(attachedHosts[0].Name).should('not.exist'); }); }); From fe7d617b61b79961898707981f0398ad9d983d8e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rub=C3=A9n=20Torrero=20Marijnissen?= Date: Thu, 20 Jul 2023 09:37:43 +0100 Subject: [PATCH 11/11] Avoid visit and confirm instance removal on layout --- test/e2e/cypress/e2e/sap_system_details.cy.js | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/test/e2e/cypress/e2e/sap_system_details.cy.js b/test/e2e/cypress/e2e/sap_system_details.cy.js index ec64f314c4..2e90c7dcaa 100644 --- a/test/e2e/cypress/e2e/sap_system_details.cy.js +++ b/test/e2e/cypress/e2e/sap_system_details.cy.js @@ -137,16 +137,13 @@ context('SAP system details', () => { const hostToDeregister = { name: 'vmnwdev02', id: 'fb2c6b8a-9915-5969-a6b7-8b5a42de1971', + features: 'ENQREP', }; - before(() => { - cy.visit(`/sap_systems/${selectedSystem.Id}`); - cy.url().should('include', `/sap_systems/${selectedSystem.Id}`); - }); - it(`should not include ${hostToDeregister.name} in the list of hosts`, () => { cy.deregisterHost(hostToDeregister.id); cy.contains(hostToDeregister.name).should('not.exist'); + cy.contains(hostToDeregister.features).should('not.exist'); }); }); });