-
Notifications
You must be signed in to change notification settings - Fork 334
tweak kontainer tests to reduce flake #17736
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
Open
mantis-toboggan-md
wants to merge
4
commits into
rancher:master
Choose a base branch
from
mantis-toboggan-md:17735-kontainer-flake
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+40
−32
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
4350dd2
tweak kontainer tests to reduce flake
mantis-toboggan-md b9d4594
update delete driver test to assert driver is actually gone
mantis-toboggan-md 6a4bf54
fix activate driver test
mantis-toboggan-md 51f3560
remove check for activating in activate driver test
mantis-toboggan-md File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,7 +5,7 @@ import DeactivateDriverDialogPo from '@/cypress/e2e/po/prompts/deactivateDriverD | |
| import ClusterManagerListPagePo from '@/cypress/e2e/po/pages/cluster-manager/cluster-manager-list.po'; | ||
| import ClusterManagerCreatePagePo from '@/cypress/e2e/po/edit/provisioning.cattle.io.cluster/create/cluster-create.po'; | ||
| import PromptRemove from '@/cypress/e2e/po/prompts/promptRemove.po'; | ||
| import { MEDIUM_TIMEOUT_OPT } from '@/cypress/support/utils/timeouts'; | ||
| import { LONG_TIMEOUT_OPT, MEDIUM_TIMEOUT_OPT, VERY_LONG_TIMEOUT_OPT } from '@/cypress/support/utils/timeouts'; | ||
|
|
||
| describe('Kontainer Drivers', { testIsolation: 'off', tags: ['@manager', '@adminUser'] }, () => { | ||
| const driversPage = new KontainerDriversPagePo(); | ||
|
|
@@ -85,7 +85,7 @@ describe('Kontainer Drivers', { testIsolation: 'off', tags: ['@manager', '@admin | |
| }); | ||
|
|
||
| driversPage.list().details(exampleDriver, 1).should('contain', 'Activating'); | ||
| driversPage.list().details(exampleDriver, 1).contains('Active', { timeout: 60000 }); | ||
| driversPage.list().details(exampleDriver, 1).should('contain', 'Active', LONG_TIMEOUT_OPT ); | ||
|
|
||
| // Verify the driver tile appears on the cluster create page. | ||
| // Legacy ember-based kontainer drivers are shown disabled with an informational tooltip | ||
|
|
@@ -144,12 +144,9 @@ describe('Kontainer Drivers', { testIsolation: 'off', tags: ['@manager', '@admin | |
| driversPage.list().activate().click(); | ||
| cy.wait('@activateOpenTelekomDriver').its('response.statusCode').should('eq', 200); | ||
| cy.wait('@activateOracleDriver').its('response.statusCode').should('eq', 200); | ||
| // wait for drivers to be activating | ||
| driversPage.list().details(openTelekomDriver, 1).should('contain', 'Activating'); | ||
| driversPage.list().details(oracleDriver, 1).should('contain', 'Activating'); | ||
| // wait for drivers to be active | ||
| driversPage.list().details(openTelekomDriver, 1).should('contain', 'Active'); | ||
| driversPage.list().details(oracleDriver, 1).should('contain', 'Active'); | ||
| driversPage.list().details(openTelekomDriver, 1).should('contain', 'Active', VERY_LONG_TIMEOUT_OPT); | ||
| driversPage.list().details(oracleDriver, 1).should('contain', 'Active', VERY_LONG_TIMEOUT_OPT); | ||
|
|
||
| // check options on cluster create page | ||
| ClusterManagerListPagePo.navTo(); | ||
|
|
@@ -205,6 +202,8 @@ describe('Kontainer Drivers', { testIsolation: 'off', tags: ['@manager', '@admin | |
| expect(isMatch(request.body, requestData)).to.equal(true); | ||
| }); | ||
|
|
||
| driversPage.list().details(exampleDriver, 1).should('contain', 'Inactive'); | ||
|
|
||
| // check options on cluster create page | ||
| ClusterManagerListPagePo.navTo(); | ||
| clusterList.waitForPage(); | ||
|
|
@@ -222,6 +221,21 @@ describe('Kontainer Drivers', { testIsolation: 'off', tags: ['@manager', '@admin | |
| driversPage.list().resourceTable().sortableTable().checkVisible(); | ||
| driversPage.list().resourceTable().sortableTable().checkLoadingIndicatorNotVisible(); | ||
|
|
||
| // Ensure driver is inactive before attempting to activate | ||
| driversPage.list().details(exampleDriver, 1).then(($el) => { | ||
| if ($el.text().includes('Active')) { | ||
| cy.intercept('POST', `/v3/kontainerDrivers/*?action=deactivate`).as('deactivateForSetup'); | ||
| driversPage.list().actionMenu(downloadUrl).getMenuItem('Deactivate').click(); | ||
| const deactivateDialog = new DeactivateDriverDialogPo(); | ||
|
|
||
| deactivateDialog.deactivate(); | ||
| cy.wait('@deactivateForSetup'); | ||
| driversPage.list().details(exampleDriver, 1).should('contain', 'Inactive'); | ||
| } | ||
| }); | ||
|
|
||
| driversPage.list().details(exampleDriver, 1).should('contain', 'Inactive'); | ||
|
|
||
| cy.intercept('POST', `/v3/kontainerDrivers/*?action=activate`).as('activateDriver'); | ||
|
|
||
| driversPage.list().actionMenu(downloadUrl).getMenuItem('Activate').click(); | ||
|
|
@@ -231,6 +245,9 @@ describe('Kontainer Drivers', { testIsolation: 'off', tags: ['@manager', '@admin | |
| expect(isMatch(request.body, requestData)).to.equal(true); | ||
| }); | ||
|
|
||
| // wait for driver to be active | ||
| driversPage.list().details(exampleDriver, 1).should('contain', 'Active'); | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No check for Activating->Active status here because the driver may be updated to Active too quickly, introducing some flakiness |
||
|
|
||
| // check options on cluster create page | ||
| ClusterManagerListPagePo.navTo(); | ||
| clusterList.waitForPage(); | ||
|
|
@@ -329,31 +346,22 @@ describe('Kontainer Drivers', { testIsolation: 'off', tags: ['@manager', '@admin | |
| body: { } | ||
| }).as('deleteDriver'); | ||
|
|
||
| // Scroll element into view and select with force | ||
| driversPage.list().resourceTable().sortableTable().rowElementWithName(exampleDriver) | ||
| .scrollIntoView(); | ||
| driversPage.list().resourceTable().sortableTable().rowSelectCtlWithName(exampleDriver) | ||
| .set(); | ||
| driversPage.list().resourceTable().sortableTable().bulkActionDropDownOpen(); | ||
| driversPage.list().resourceTable().sortableTable().bulkActionDropDownButton('Delete') | ||
| .click({ force: true }); | ||
|
|
||
| driversPage.list().resourceTable().sortableTable().rowNames() | ||
| .then((rows: any) => { | ||
| const promptRemove = new PromptRemove(); | ||
|
|
||
| promptRemove.remove(); | ||
|
|
||
| cy.wait('@deleteDriver').then(({ response }) => { | ||
| expect(response?.statusCode).to.eq(200); | ||
| if (response?.statusCode === 200) { | ||
| removeDriver = false; | ||
| } | ||
| driversPage.waitForPage(); | ||
| driversPage.list().resourceTable().sortableTable().rowNames() | ||
| .should('not.contain', exampleDriver); | ||
| }); | ||
| }); | ||
| driversPage.list().actionMenu(exampleDriver).getMenuItem('Delete').click(); | ||
|
|
||
| const promptRemove = new PromptRemove(); | ||
|
|
||
| promptRemove.remove(); | ||
|
|
||
| cy.wait('@deleteDriver').then(({ response }) => { | ||
| expect(response?.statusCode).to.eq(200); | ||
| }); | ||
|
|
||
| driversPage.waitForPage(); | ||
| driversPage.list().resourceTable().sortableTable().rowElementWithName(exampleDriver, MEDIUM_TIMEOUT_OPT) | ||
| .should('not.exist'); | ||
|
|
||
| // only mark removeDriver false once tests assert the driver is actually gone | ||
| removeDriver = false; | ||
| }); | ||
|
|
||
| after(() => { | ||
|
|
||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question
I think the LONG_TIMEOUT_OPT cannot be used on the .should.
That is for most of the cases here. Are you sure it is actually applying the timeout?
I faced this problem before. (And I think I still have similar codes not working)
I usually change to something like this.
I am happy to discuss if you are not sure. I did some tests but we can check together.