Skip to content
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
10 changes: 9 additions & 1 deletion cypress/e2e/tests/pages/fleet/fleet-clusters.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ describe('Fleet Clusters - bundle manifests are deployed from the BundleDeployme
let removeWorkspace = false;
let disableFeature = false;
let clusterName = '';
let cloudcredentialId = '';
let gitRepo = '';
let customWorkspace = '';
const feature = 'provisioningv2-fleet-workspace-back-population';
Expand Down Expand Up @@ -69,7 +70,9 @@ describe('Fleet Clusters - bundle manifests are deployed from the BundleDeployme
namespace,
},
metadata: { labels: { foo: 'bar' } }
}).then(() => {
}).then((req) => {
cloudcredentialId = req.body.spec.cloudCredentialSecretName;

removeCluster = true;
});
});
Expand Down Expand Up @@ -365,6 +368,11 @@ describe('Fleet Clusters - bundle manifests are deployed from the BundleDeployme
featureFlagsPage.clickCardActionButtonAndWait('Deactivate', feature, false, { waitForModal: true, waitForRequest: true });
featureFlagsPage.list().details(feature, 0).should('include.text', 'Disabled');
}

if (cloudcredentialId) {
// delete cloud credential
cy.deleteRancherResource('v3', 'cloudCredentials', cloudcredentialId, false);
}
});
});

Expand Down
23 changes: 23 additions & 0 deletions cypress/e2e/tests/pages/manager/cloud-credential.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,34 @@ import ClusterManagerCreatePagePo from '@/cypress/e2e/po/edit/provisioning.cattl
import LoadingPo from '@/cypress/e2e/po/components/loading.po';
import HomePagePo from '@/cypress/e2e/po/pages/home.po';

/******
* Running this test will delete all Amazon cloud credentials from the target cluster
******/
describe('Cloud Credential', { tags: ['@manager', '@adminUser'] }, () => {
const clusterList = new ClusterManagerListPagePo();
const doCreatedCloudCredsIds = [];
const azCreatedCloudCredsIds = [];

before(() => {
cy.login();
// Clean up any orphaned Amazon cloud credentials from previous test runs to ensure tests start with a clean state
cy.getRancherResource('v3', 'cloudcredentials', null, null).then((resp: Cypress.Response<any>) => {
const body = resp.body;

if (body.pagination['total'] > 0) {
body.data.forEach((item: any) => {
if (item.amazonec2credentialConfig) {
const id = item.id;

cy.deleteRancherResource('v3', 'cloudcredentials', id, false);
} else {
cy.log('There are no existing amazon cloud credentials to delete');
}
});
}
});
});

beforeEach(() => {
cy.login();
HomePagePo.goTo(); // this is needed to ensure we have a valid authentication session
Expand Down