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

test: [M3-9023] - Add coverage for Kube version upgrades in landing page #11478

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-11478-tests-1736180178602.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Tests
---

Add coverage for Kube version upgrades in landing page ([#11478](https://github.com/linode/manager/pull/11478))
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import {
mockGetClusters,
mockGetClusterPools,
mockGetKubeconfig,
mockGetKubernetesVersions,
mockGetTieredKubernetesVersions,
mockRecycleAllNodes,
mockUpdateCluster,
} from 'support/intercepts/lke';
import {
accountFactory,
Expand Down Expand Up @@ -165,4 +169,186 @@ describe('LKE landing page', () => {
cy.wait('@getKubeconfig');
readDownload(mockKubeconfigFilename).should('eq', mockKubeconfigContents);
});

it('does not show an Upgrade chip when there is no new kubernetes standard version', () => {
const oldVersion = '1.25';
const newVersion = '1.26';

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

mockGetClusters([cluster]).as('getClusters');
mockGetKubernetesVersions([newVersion, oldVersion]).as('getVersions');

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

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

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

cy.findByText('UPGRADE').should('not.exist');
});

it('does not show an Upgrade chip when there is no new kubernetes enterprise version', () => {
const oldVersion = '1.31.1+lke1';
const newVersion = '1.32.1+lke2';

mockGetAccount(
accountFactory.build({
capabilities: ['Kubernetes Enterprise'],
})
).as('getAccount');

// TODO LKE-E: Remove once feature is in GA
mockAppendFeatureFlags({
lkeEnterprise: { enabled: true, la: true },
});

const cluster = kubernetesClusterFactory.build({
k8s_version: newVersion,
tier: 'enterprise',
});

mockGetClusters([cluster]).as('getClusters');
mockGetTieredKubernetesVersions('enterprise', [
{ id: newVersion, tier: 'enterprise' },
{ id: oldVersion, tier: 'enterprise' },
]).as('getTieredVersions');

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

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

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

cy.findByText('UPGRADE').should('not.exist');
});

it('can upgrade the standard 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');
});

it('can upgrade the enterprise kubernetes version from the landing page', () => {
const oldVersion = '1.31.1+lke1';
const newVersion = '1.32.1+lke2';

mockGetAccount(
accountFactory.build({
capabilities: ['Kubernetes Enterprise'],
})
).as('getAccount');

// TODO LKE-E: Remove once feature is in GA
mockAppendFeatureFlags({
lkeEnterprise: { enabled: true, la: true },
});

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

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

mockGetClusters([cluster]).as('getClusters');
mockGetTieredKubernetesVersions('enterprise', [
{ id: newVersion, tier: 'enterprise' },
{ id: oldVersion, tier: 'enterprise' },
]).as('getTieredVersions');
mockUpdateCluster(cluster.id, updatedCluster).as('updateCluster');
mockRecycleAllNodes(cluster.id).as('recycleAllNodes');

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

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

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');
});
});
134 changes: 0 additions & 134 deletions packages/manager/cypress/e2e/core/kubernetes/lke-update.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import {
mockRecycleAllNodes,
mockGetDashboardUrl,
mockGetApiEndpoints,
mockGetClusters,
mockUpdateControlPlaneACL,
mockGetControlPlaneACL,
mockUpdateControlPlaneACLError,
Expand Down Expand Up @@ -238,65 +237,6 @@ describe('LKE cluster updates', () => {
ui.toast.findByMessage('Recycle started successfully.');
});

it('can upgrade the standard 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 UI flow of upgrading Kubernetes enterprise version using mocked API requests.
* - Confirms that Kubernetes upgrade prompt is shown when not up-to-date.
Expand Down Expand Up @@ -425,80 +365,6 @@ describe('LKE cluster updates', () => {
ui.toast.findByMessage('Recycle started successfully.');
});

it('can upgrade the enterprise kubernetes version from the landing page', () => {
const oldVersion = '1.31.1+lke1';
const newVersion = '1.32.1+lke2';

mockGetAccount(
accountFactory.build({
capabilities: ['Kubernetes Enterprise'],
})
).as('getAccount');

// TODO LKE-E: Remove once feature is in GA
mockAppendFeatureFlags({
lkeEnterprise: { enabled: true, la: true },
});

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

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

mockGetClusters([cluster]).as('getClusters');
mockGetTieredKubernetesVersions('enterprise', [
{ id: newVersion, tier: 'enterprise' },
{ id: oldVersion, tier: 'enterprise' },
]).as('getTieredVersions');
mockUpdateCluster(cluster.id, updatedCluster).as('updateCluster');
mockRecycleAllNodes(cluster.id).as('recycleAllNodes');

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

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

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
Loading