Skip to content

Commit

Permalink
test: [M3-9035] - Reduce flakiness in lke-update pool tag test (#11458
Browse files Browse the repository at this point in the history
)

* Wait for requests and UI to resolve node pool tag test flake

* Added changeset: Add Cypress test for LKE node pool tagging

* Point changeset to original feature PR
  • Loading branch information
jdamore-linode authored Jan 2, 2025
1 parent 6368f20 commit 260903f
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 2 deletions.
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-11458-tests-1734984299850.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Tests
---

Add Cypress test for LKE node pool tagging ([#11368](https://github.com/linode/manager/pull/11368))
45 changes: 43 additions & 2 deletions packages/manager/cypress/e2e/core/kubernetes/lke-update.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
linodeFactory,
kubernetesControlPlaneACLFactory,
kubernetesControlPlaneACLOptionsFactory,
linodeTypeFactory,
} from 'src/factories';
import { extendType } from 'src/utilities/extendType';
import { mockGetAccount } from 'support/intercepts/account';
Expand Down Expand Up @@ -43,6 +44,7 @@ import { getRegionById } from 'support/util/regions';
import { dcPricingMockLinodeTypes } from 'support/constants/dc-specific-pricing';
import { mockAppendFeatureFlags } from 'support/intercepts/feature-flags';
import { randomString } from 'support/util/random';
import { buildArray } from 'support/util/arrays';

const mockNodePools = nodePoolFactory.buildList(2);

Expand Down Expand Up @@ -1068,27 +1070,66 @@ describe('LKE cluster updates', () => {
k8s_version: latestKubernetesVersion,
});

const mockType = linodeTypeFactory.build();

const mockNodePoolInstances = buildArray(3, () =>
linodeFactory.build({ label: randomLabel() })
);

const mockNodes = mockNodePoolInstances.map((linode, i) =>
kubeLinodeFactory.build({
id: `id-${i * 5000}`,
instance_id: linode.id,
status: 'ready',
})
);

const mockNodePoolNoTags = nodePoolFactory.build({
id: 1,
type: 'g6-dedicated-4',
type: mockType.id,
nodes: mockNodes,
});

const mockNodePoolWithTags = {
...mockNodePoolNoTags,
tags: ['test-tag'],
};

mockGetLinodes(mockNodePoolInstances);
mockGetLinodeType(linodeTypeFactory.build({ id: mockType.id })).as(
'getType'
);
mockGetCluster(mockCluster).as('getCluster');
mockGetClusterPools(mockCluster.id, [mockNodePoolNoTags]).as(
'getNodePoolsNoTags'
);
mockGetKubernetesVersions().as('getVersions');
mockGetControlPlaneACL(mockCluster.id, { acl: { enabled: false } }).as(
'getControlPlaneAcl'
);
mockUpdateNodePool(mockCluster.id, mockNodePoolWithTags).as('addTag');
mockGetDashboardUrl(mockCluster.id);
mockGetApiEndpoints(mockCluster.id);

cy.visitWithLogin(`/kubernetes/clusters/${mockCluster.id}`);
cy.wait(['@getCluster', '@getNodePoolsNoTags', '@getVersions']);
cy.wait([
'@getCluster',
'@getNodePoolsNoTags',
'@getVersions',
'@getType',
'@getControlPlaneAcl',
]);

// Confirm that Linode instance info has finished loading before attempting
// to interact with the tag button.
mockNodePoolInstances.forEach((linode) => {
cy.findByText(linode.label)
.should('be.visible')
.closest('tr')
.within(() => {
cy.findByText('Running').should('be.visible');
});
});

cy.get(`[data-qa-node-pool-id="${mockNodePoolNoTags.id}"]`).within(() => {
ui.button.findByTitle('Add a tag').should('be.visible').click();
Expand Down

0 comments on commit 260903f

Please sign in to comment.