Skip to content

Commit 4a29ba8

Browse files
authored
Automate helm-app valuesFrom and valuesFiles tests (#315)
* Automate helm-app valuesFrom and valuesFiles tests * Moved function to command for future use Signed-off-by: Satyajit Bulage <[email protected]> * Updated resource count, using ConfigMap now --------- Signed-off-by: Satyajit Bulage <[email protected]>
1 parent 368e9fa commit 4a29ba8

File tree

4 files changed

+73
-0
lines changed

4 files changed

+73
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apiVersion: v1
2+
kind: ConfigMap
3+
metadata:
4+
name: test-map
5+
namespace: default
6+
data:
7+
values.yaml: |
8+
key: mykey,
9+
value: values123

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

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,3 +1414,48 @@ describe('Test move cluster to newly created workspace and deploy application to
14141414
})
14151415
)
14161416
});
1417+
1418+
describe('Test Helm app with Custom Values', { tags: '@p1' }, () => {
1419+
const configMapName = "test-map"
1420+
const repoTestData: testData[] = [
1421+
{qase_id: 173, message: '`valuesFrom` with empty', path:'qa-test-apps/helm-app/values-from-with-empty-values' },
1422+
{qase_id: 174, message: '`valuesFrom` with NO', path:'qa-test-apps/helm-app/values-from-with-no-values' },
1423+
{qase_id: 175, message: '`valuesFiles` with empty', path: 'qa-test-apps/helm-app/values-files-with-empty-values' },
1424+
{qase_id: 176, message: '`valuesFiles` with NO', path: 'qa-test-apps/helm-app/values-files-with-no-values' }
1425+
]
1426+
1427+
beforeEach('Cleanup leftover GitRepo and ConfigMap if any.', () => {
1428+
cy.login();
1429+
cy.visit('/');
1430+
cy.deleteConfigMap(configMapName);
1431+
cy.deleteAllFleetRepos();
1432+
})
1433+
1434+
repoTestData.forEach(({ qase_id, message, path }) => {
1435+
qase(qase_id,
1436+
it(`FLEET-${qase_id}: Test helm-app using "${message}" values in the fleet.yaml file.`, { tags: `@fleet-${qase_id}`}, () => {
1437+
const repoName = `local-cluster-fleet-${qase_id}`
1438+
1439+
// Create ConfigMap before create GitRepo
1440+
if (qase_id === 173 || qase_id === 174) {
1441+
cy.createConfigMap(configMapName);
1442+
}
1443+
1444+
// Create GitRepo
1445+
cy.accesMenuSelection('Continuous Delivery', 'Git Repos');
1446+
cy.fleetNamespaceToggle('fleet-local')
1447+
cy.addFleetGitRepo({ repoName, repoUrl, branch, path });
1448+
cy.clickButton('Create');
1449+
cy.verifyTableRow(0, 'Active', repoName);
1450+
cy.checkGitRepoStatus(repoName, '1 / 1', '1 / 1');
1451+
1452+
// Create ConfigMap before create GitRepo
1453+
if (qase_id === 173 || qase_id === 174) {
1454+
cy.deleteConfigMap(configMapName);
1455+
}
1456+
// Delete GitRepo
1457+
cy.deleteAllFleetRepos();
1458+
})
1459+
);
1460+
});
1461+
});

tests/cypress/support/commands.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,3 +1005,20 @@ Cypress.Commands.add('moveClusterToWorkspace', (clusterName, workspaceName, time
10051005
Cypress.Commands.add('restoreClusterToDefaultWorkspace', (clusterName, timeout, defaultWorkspaceName='fleet-default', ) => {
10061006
cy.moveClusterToWorkspace(clusterName, defaultWorkspaceName, timeout);
10071007
})
1008+
1009+
Cypress.Commands.add('createConfigMap', (configMapName) => {
1010+
cy.accesMenuSelection('local', 'Storage', 'ConfigMaps');
1011+
cy.clickButton('Create');
1012+
cy.clickButton('Edit as YAML');
1013+
cy.addYamlFile('assets/helm-app-test-map-configmap.yaml');
1014+
cy.clickButton('Create');
1015+
cy.filterInSearchBox(configMapName);
1016+
cy.verifyTableRow(0, configMapName);
1017+
})
1018+
1019+
1020+
Cypress.Commands.add('deleteConfigMap', (configMapName) => {
1021+
cy.accesMenuSelection('local', 'Storage', 'ConfigMaps');
1022+
cy.filterInSearchBox(configMapName);
1023+
cy.deleteAll(false);
1024+
})

tests/cypress/support/e2e.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@ declare global {
6464
moveClusterToWorkspace(clusterName: string, workspaceName: string, timeout: number): Chainable<Element>;
6565
restoreClusterToDefaultWorkspace(clusterName: string, timeout: number, defaultWorkspaceName?: string): Chainable<Element>;
6666
createNewFleetWorkspace(newWorkspaceName: string): Chainable<Element>;
67+
createConfigMap(configMapName: string): Chainable<Element>;
68+
deleteConfigMap(configMapName: string): Chainable<Element>;
6769
}
6870
}
6971
}

0 commit comments

Comments
 (0)