Skip to content

Commit ce0f829

Browse files
committed
Add automation for overrideTargets based on cluster labels
1 parent eb36192 commit ce0f829

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed

tests/cypress/e2e/unit_tests/p1_2_fleet.spec.ts

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1624,3 +1624,83 @@ describe('Test helm chart dependency download with `disableDependencyUpdate: tru
16241624
})
16251625
)
16261626
});
1627+
1628+
describe('Test bundle deploy with overrideTargets by label availability on clusters.', { tags: '@p1_2'}, () => {
1629+
1630+
qase(92,
1631+
it("Fleet-92: Test bundle did not get deploy on the target mentioned in the GitRepo when `overrideTargets` is set in the `fleet.yaml` when label is missing on cluster.", { tags: '@fleet-92' }, () => {
1632+
1633+
const repoName = 'test-override-targets'
1634+
const path = "qa-test-apps/overrideTargets"
1635+
1636+
cy.addFleetGitRepo({ repoName, repoUrl, branch, path });
1637+
cy.clickButton('Create');
1638+
cy.verifyTableRow(0, 'Active', repoName);
1639+
1640+
// Verify that the GitRepo is not targeting any cluster
1641+
// due to the absence of the label specified in `overrideTargets`.
1642+
cy.verifyTableRow(0, 'Active', repoName);
1643+
cy.contains(repoName).click();
1644+
cy.get('[data-testid="banner-content"]')
1645+
.should('be.visible')
1646+
.should('contain', 'This GitRepo is not targeting any clusters');
1647+
1648+
// Verify `nginx-override-test` deployment/pod is not present on clusters.
1649+
dsAllClusterList.forEach(
1650+
(dsCluster) => {
1651+
// 'false' option in below command is used to check the absence of given resource.
1652+
cy.checkApplicationStatus("nginx-override-test", dsCluster, 'All Namespaces', false);
1653+
}
1654+
)
1655+
})
1656+
)
1657+
1658+
qase(93,
1659+
it("Fleet-93: Test bundle get deploy on the target mentioned in the GitRepo provided that `overrideTargets` is present in the `fleet.yaml` after adding label on cluster.", { tags: '@fleet-93' }, () => {
1660+
1661+
const repoName = 'test-override-targets-with-label'
1662+
const path = "qa-test-apps/overrideTargets"
1663+
const key = 'env'
1664+
const value = 'override'
1665+
1666+
cy.addFleetGitRepo({ repoName, repoUrl, branch, path });
1667+
cy.clickButton('Create');
1668+
cy.verifyTableRow(0, 'Active', repoName);
1669+
1670+
// Verify that the GitRepo is not targeting any cluster
1671+
// due to the absence of the label specified in `overrideTargets`.
1672+
cy.verifyTableRow(0, 'Active', repoName);
1673+
cy.contains(repoName).click();
1674+
cy.get('[data-testid="banner-content"]')
1675+
.should('be.visible')
1676+
.should('contain', 'This GitRepo is not targeting any clusters');
1677+
1678+
// Assign label (similar to label mentioned in fleet.yaml file.) to All the clusters
1679+
dsAllClusterList.forEach(
1680+
(dsCluster) => {
1681+
cy.assignClusterLabel(dsCluster, key, value);
1682+
}
1683+
)
1684+
1685+
cy.continuousDeliveryMenuSelection();
1686+
cy.verifyTableRow(0, 'Active', repoName);
1687+
cy.checkGitRepoStatus(repoName, '1 / 1', '3 / 3');
1688+
1689+
// Verify `nginx-override-test` deployment/pod is present on All clusters with label.
1690+
dsAllClusterList.forEach(
1691+
(dsCluster) => {
1692+
cy.checkApplicationStatus("nginx-override-test", dsCluster, 'All Namespaces');
1693+
}
1694+
)
1695+
1696+
// Remove labels from the clusters.
1697+
dsAllClusterList.forEach(
1698+
(dsCluster) => {
1699+
// Adding wait to load page correctly to avoid interference with hamburger-menu.
1700+
cy.wait(500);
1701+
cy.removeClusterLabels(dsCluster, key, value);
1702+
}
1703+
)
1704+
})
1705+
)
1706+
});

0 commit comments

Comments
 (0)