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

E2e test deregistration cascading #1634

Merged
merged 11 commits into from
Jul 20, 2023
Merged

Conversation

rtorrero
Copy link
Contributor

@rtorrero rtorrero commented Jul 14, 2023

Description

This PR adds tests to confirm that a deregistration of a host also removes the affected data from other views. Included in this PR are tests for:

  • clusters overview: a cluster should be removed when all its hosts are removed
  • databases overview: deregistering a primary instance should remove the database
  • hana cluster details: linking to a unregistered host should be disabled
  • hana db details: a deregistered host should not be present in the list of hosts
  • sap system details: a deregistered host should not be present in the list of hosts
  • sap system overview: deregistering the primary instance of the db should remove the sap system

@rtorrero rtorrero force-pushed the e2e-test-deregistration-cascading branch from e639652 to 25bbde9 Compare July 18, 2023 15:34
@rtorrero rtorrero force-pushed the e2e-test-deregistration-cascading branch from 25bbde9 to 334494e Compare July 19, 2023 11:01
@rtorrero rtorrero marked this pull request as ready for review July 19, 2023 11:06
Copy link
Contributor

@arbulu89 arbulu89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rtorrero The tests look good in general.
I think that we should apply the deregisterHost command in the test itself, and not in the before, as the deregistration is the most important part of the test itself, and not a "setup` thing.

Cypress.env('web_api_port'),
];

const headers = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could have this headers in a default constant.
Maybe food for a tech debt

],
};

before(() => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this in a before?
This is the most important part of the test and it should be done in the test itself, right?

hosts: [
{
id: '13e8c25c-3180-5a9a-95c8-51ec38e50cfc',
name: 'vmhdbdev01',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These names are not used, maybe we could remove them?
And have a list of ids

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kept them there for reference, so that when reading the test you at least know which host is being deregistered, what do you think? maybe better a comment or nothing at all?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Up to you. If it was me I wouldn't have it, but if it helps you, it is not harmful at least

cy.deregisterHost(hdq_database.hana_primary.id);
});

it(`should not display DB ${hdq_database.hana_primary.name} after deregistering the primary instance`, () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This interpolation doesn't make much sense. This should be hdq_database.sid I guess

});

describe('Deregistration', () => {
const hdq_database = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hdq_database -> hdqDatabase

@@ -291,4 +291,22 @@ context('SAP Systems Overview', () => {
cy.get('table.table-fixed').should('not.contain', 'DAA');
});
});

describe('Deregistration', () => {
const sap_system_nwp = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sapSystemNwp
hanaPrimary

id: '9cd46919-5f19-59aa-993e-cf3736c71053',
},
};

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I miss a test here where we check that the SAP system is deregistered when the ASCS or PAS instances are deregistered

});
});
});

describe('Deregistration', () => {
const hana_cluster_1 = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hanaCluster1

@rtorrero rtorrero requested a review from arbulu89 July 19, 2023 14:45
cy.deregisterHost(hana_cluster_1.hosts[0].id);
cy.deregisterHost(hana_cluster_1.hosts[1].id);
});
before(() => {});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this required?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, @rtorrero , you can remove it

Copy link
Contributor

@arbulu89 arbulu89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job @rtorrero
Some last nitpicks. Specially, move the deregisterHost to the test, and we are ready to merge

cy.deregisterHost(hana_cluster_1.hosts[0].id);
cy.deregisterHost(hana_cluster_1.hosts[1].id);
});
before(() => {});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope, @rtorrero , you can remove it

hosts: [
{
id: '13e8c25c-3180-5a9a-95c8-51ec38e50cfc',
name: 'vmhdbdev01',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Up to you. If it was me I wouldn't have it, but if it helps you, it is not harmful at least

test/e2e/cypress/e2e/clusters_overview.cy.js Outdated Show resolved Hide resolved
},
};

before(() => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should go in the test as well

describe('Deregistration', () => {
const hdqDatabase = {
sid: 'HDQ',
hana_primary: {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why this in snake_case yet?

before(() => {
cy.visit(`/sap_systems/${selectedSystem.Id}`);
cy.url().should('include', `/sap_systems/${selectedSystem.Id}`);
cy.deregisterHost(hostToDeregister.id);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This to the test

@rtorrero rtorrero requested a review from arbulu89 July 20, 2023 06:57
Copy link
Contributor

@arbulu89 arbulu89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More things 😅

};

before(() => {
cy.deregisterHost(hostToDeregister.id);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deregisterHost move to the test


describe('Deregistration', () => {
before(() => {
cy.deregisterHost(attachedHosts[0].AgentId);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Move to the test

cy.url().should('include', `/sap_systems/${selectedSystem.Id}`);
});

it(`should not include ${hostToDeregister.name} in the list of hosts`, () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could improve this test (or add a new) to check that the SAP instance belonging to this SAP system is not there. @abravosuse reported some potential issue on this?

@rtorrero rtorrero requested a review from arbulu89 July 20, 2023 08:36
Copy link
Contributor

@arbulu89 arbulu89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔝

@rtorrero rtorrero merged commit 5d1295e into main Jul 20, 2023
14 of 16 checks passed
@rtorrero rtorrero deleted the e2e-test-deregistration-cascading branch July 20, 2023 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants