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

automation: add step to ensure aks is enabled #13113

Merged
merged 1 commit into from
Jan 18, 2025
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
31 changes: 30 additions & 1 deletion cypress/e2e/tests/pages/manager/cluster-manager.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ const clusterNamePartial = `${ runPrefix }-create`;
const rke1CustomName = `${ clusterNamePartial }-rke1-custom`;
const rke2CustomName = `${ clusterNamePartial }-rke2-custom`;
const importGenericName = `${ clusterNamePartial }-import-generic`;
let reenableAKS = false;

IsaSih marked this conversation as resolved.
Show resolved Hide resolved
const downloadsFolder = Cypress.config('downloadsFolder');

Expand Down Expand Up @@ -91,16 +92,35 @@ describe('Cluster Manager', { testIsolation: 'off', tags: ['@manager', '@adminUs
});

it('deactivating a kontainer driver should hide its card from the cluster creation page', () => {
cy.intercept('GET', '/v3/kontainerdrivers').as('getKontainerDrivers');
cy.intercept('POST', 'v3/kontainerDrivers/azurekubernetesservice?action=deactivate').as('deactivateDriver');
cy.intercept('POST', 'v3/kontainerDrivers/azurekubernetesservice?action=activate').as('activateDriver');

const driversPage = new KontainerDriversPagePo();
const clusterCreatePage = new ClusterManagerCreatePagePo();

// deactivate the AKS driver
KontainerDriversPagePo.navTo();
driversPage.waitForPage();

// assert AKS kontainer driver is in Active state
cy.wait('@getKontainerDrivers').then(({ response }) => {
response.body.data.forEach((item: any) => {
if (item.id === 'azurekubernetesservice') {
const state = item['active'];
IsaSih marked this conversation as resolved.
Show resolved Hide resolved

expect(state).to.eq(true);
}
});
});

// deactivate the AKS driver
driversPage.list().actionMenu('Azure AKS').getMenuItem('Deactivate').click();
const deactivateDialog = new DeactivateDriverDialogPo();

deactivateDialog.deactivate();
cy.wait('@deactivateDriver').its('response.statusCode').should('eq', 200).then(() => {
reenableAKS = true;
IsaSih marked this conversation as resolved.
Show resolved Hide resolved
});

// verify that the AKS card is not shown
clusterList.goTo();
Expand All @@ -112,6 +132,9 @@ describe('Cluster Manager', { testIsolation: 'off', tags: ['@manager', '@adminUs
KontainerDriversPagePo.navTo();
driversPage.waitForPage();
driversPage.list().actionMenu('Azure AKS').getMenuItem('Activate').click();
cy.wait('@activateDriver').its('response.statusCode').should('eq', 200).then(() => {
reenableAKS = false;
});

// verify that the AKS card is back
clusterList.goTo();
Expand Down Expand Up @@ -828,4 +851,10 @@ describe('Cluster Manager', { testIsolation: 'off', tags: ['@manager', '@adminUs
});
});
});

after(() => {
if (reenableAKS) {
IsaSih marked this conversation as resolved.
Show resolved Hide resolved
cy.createRancherResource('v3', 'kontainerDrivers/azurekubernetesservice?action=activate', {});
}
});
});
4 changes: 2 additions & 2 deletions cypress/support/commands/rancher-api-commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -497,8 +497,8 @@ Cypress.Commands.add('createRancherResource', (prefix, resourceType, body) => {
body
})
.then((resp) => {
// Expect 201, Created HTTP status code
expect(resp.status).to.eq(201);
// Expect 200 or 201, Created HTTP status code
expect(resp.status).to.be.oneOf([200, 201]);
});
});

Expand Down
Loading