Skip to content

Commit

Permalink
fix: [M3-8726] - Users unable to upgrade Kubernetes version from land…
Browse files Browse the repository at this point in the history
…ing page (#11056)

* fix dialog unmounting during upgrade and add cypress test

* fix cypress test

* add changeset

---------

Co-authored-by: Banks Nussman <banks@nussman.us>
  • Loading branch information
bnussman-akamai and bnussman authored Oct 8, 2024
1 parent 2667f23 commit 3e6d480
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 3 deletions.
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-11056-fixed-1728428139880.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Fixed
---

Users unable to upgrade Kubernetes version from landing page ([#11056](https://github.com/linode/manager/pull/11056))
59 changes: 58 additions & 1 deletion packages/manager/cypress/e2e/core/kubernetes/lke-update.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
mockRecycleAllNodes,
mockGetDashboardUrl,
mockGetApiEndpoints,
mockGetClusters,
} from 'support/intercepts/lke';
import {
mockGetLinodeType,
Expand Down Expand Up @@ -113,7 +114,7 @@ describe('LKE cluster updates', () => {
* - Confirms that Kubernetes upgrade prompt is shown when not up-to-date.
* - Confirms that Kubernetes upgrade prompt is hidden when up-to-date.
*/
it('can upgrade Kubernetes engine version', () => {
it('can upgrade kubernetes version from the details page', () => {
const oldVersion = '1.25';
const newVersion = '1.26';

Expand Down Expand Up @@ -215,6 +216,62 @@ describe('LKE cluster updates', () => {
ui.toast.findByMessage('Recycle started successfully.');
});

it('can upgrade the kubernetes version from the landing page', () => {
const oldVersion = '1.25';
const newVersion = '1.26';

const cluster = kubernetesClusterFactory.build({
k8s_version: oldVersion,
});

const updatedCluster = { ...cluster, k8s_version: newVersion };

mockGetClusters([cluster]).as('getClusters');
mockGetKubernetesVersions([newVersion, oldVersion]).as('getVersions');
mockUpdateCluster(cluster.id, updatedCluster).as('updateCluster');
mockRecycleAllNodes(cluster.id).as('recycleAllNodes');

cy.visitWithLogin(`/kubernetes/clusters`);

cy.wait(['@getClusters', '@getVersions']);

cy.findByText(oldVersion).should('be.visible');

cy.findByText('UPGRADE').should('be.visible').should('be.enabled').click();

ui.dialog
.findByTitle(
`Step 1: Upgrade ${cluster.label} to Kubernetes ${newVersion}`
)
.should('be.visible');

mockGetClusters([updatedCluster]).as('getClusters');

ui.button
.findByTitle('Upgrade Version')
.should('be.visible')
.should('be.enabled')
.click();

cy.wait(['@updateCluster', '@getClusters']);

ui.dialog
.findByTitle('Step 2: Recycle All Cluster Nodes')
.should('be.visible');

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

cy.wait('@recycleAllNodes');

ui.toast.assertMessage('Recycle started successfully.');

cy.findByText(newVersion).should('be.visible');
});

/*
* - Confirms node, node pool, and cluster recycling UI flow using mocked API data.
* - Confirms that user is warned that recycling recreates nodes and may take a while.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export const KubernetesLanding = () => {

const isRestricted = profile?.restricted ?? false;

const { data, error, isFetching } = useKubernetesClustersQuery(
const { data, error, isLoading } = useKubernetesClustersQuery(
{
page: pagination.page,
page_size: pagination.pageSize,
Expand Down Expand Up @@ -157,7 +157,7 @@ export const KubernetesLanding = () => {
);
}

if (isFetching) {
if (isLoading) {
return <CircleProgress />;
}

Expand Down

0 comments on commit 3e6d480

Please sign in to comment.