Skip to content

Commit

Permalink
fix: [M3-7630] - Fix Kubernetes Upgrade Flow (#10057)
Browse files Browse the repository at this point in the history
* fix bug and add test

* remove `.only`

* Added changeset: Kubernetes upgrade flow on Kubernetes details page

* Added changeset: Improved Kubernetes version upgrade Cypress test

---------

Co-authored-by: Banks Nussman <banks@nussman.us>
  • Loading branch information
bnussman-akamai and bnussman authored Jan 11, 2024
1 parent 14e6d00 commit a4ed4cf
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 4 deletions.
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-10057-fixed-1704983627685.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Fixed
---

Kubernetes upgrade flow on Kubernetes details page ([#10057](https://github.com/linode/manager/pull/10057))
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-10057-tests-1704983693919.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Tests
---

Improved Kubernetes version upgrade Cypress test ([#10057](https://github.com/linode/manager/pull/10057))
40 changes: 40 additions & 0 deletions packages/manager/cypress/e2e/core/kubernetes/lke-update.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,47 @@ describe('LKE cluster updates', () => {

// Wait for API response and assert toast message is shown.
cy.wait('@updateCluster');

// Verify the banner goes away because the version update has happened
cy.findByText(upgradePrompt).should('not.exist');

mockRecycleAllNodes(mockCluster.id).as('recycleAllNodes');

const stepTwoDialogTitle = 'Step 2: Recycle All Cluster Nodes';

ui.dialog
.findByTitle(stepTwoDialogTitle)
.should('be.visible')
.within(() => {
cy.findByText('Kubernetes version has been updated successfully.', {
exact: false,
}).should('be.visible');

cy.findByText(
'For the changes to take full effect you must recycle the nodes in your cluster.',
{ exact: false }
).should('be.visible');

ui.button
.findByTitle('Recycle All Nodes')
.should('be.visible')
.should('be.enabled')
.click();
});

// Verify clicking the "Recycle All Nodes" makes an API call
cy.wait('@recycleAllNodes');

// Verify the upgrade dialog closed
cy.findByText(stepTwoDialogTitle).should('not.exist');

// Verify the banner is still gone after the flow
cy.findByText(upgradePrompt).should('not.exist');

// Verify the version is correct after the update
cy.findByText(`Version ${newVersion}`);

ui.toast.findByMessage('Recycle started successfully.');
});

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ export const UpgradeDialog = (props: Props) => {
}
}, [isOpen]);

if (nextVersion === null) {
return null;
}

const onSubmitUpgradeDialog = () => {
if (!nextVersion) {
setError('Your Kubernetes Cluster is already on the latest version.');
return;
}
setSubmitting(true);
setError(undefined);
updateKubernetesCluster({
Expand Down

0 comments on commit a4ed4cf

Please sign in to comment.