Skip to content

Commit

Permalink
Remove unnecessary labels from spec files (#3060)
Browse files Browse the repository at this point in the history
  • Loading branch information
akus062381 authored Aug 27, 2024
1 parent 1eae3c6 commit f4420a1
Show file tree
Hide file tree
Showing 8 changed files with 1,001 additions and 1,076 deletions.
502 changes: 249 additions & 253 deletions cypress/e2e/awx/access/teams/teams.cy.ts

Large diffs are not rendered by default.

143 changes: 70 additions & 73 deletions cypress/e2e/awx/cleanup/awx-cleanup.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,97 +7,94 @@ import { Project } from '../../../../frontend/awx/interfaces/Project';
import { AwxUser } from '../../../../frontend/awx/interfaces/User';
import { WorkflowApproval } from '../../../../frontend/awx/interfaces/WorkflowApproval';
import { getJobsAPIUrl } from '../../../../frontend/awx/views/jobs/jobUtils';
import { cyLabel } from '../../../support/cyLabel';
import { awxAPI } from '../../../support/formatApiPathForAwx';

const twoHoursAgo = new Date(Date.now() - 2 * 60 * 60 * 1000).toISOString();

cyLabel(['upstream'], () => {
describe('AWX Cleanup', () => {
it('cleanup projects', () => {
cy.requestGet<AwxItemsResponse<Project>>(
awxAPI`/projects?name__startswith=E2E&page=1&page_size=200&created__lt=${twoHoursAgo}`
).then((result) => {
for (const resource of result.results ?? []) {
cy.deleteAwxProject(resource, { failOnStatusCode: false });
}
});
describe('AWX Cleanup', () => {
it('cleanup projects', () => {
cy.requestGet<AwxItemsResponse<Project>>(
awxAPI`/projects?name__startswith=E2E&page=1&page_size=200&created__lt=${twoHoursAgo}`
).then((result) => {
for (const resource of result.results ?? []) {
cy.deleteAwxProject(resource, { failOnStatusCode: false });
}
});
});

it('cleanup inventories', () => {
cy.requestGet<AwxItemsResponse<Inventory>>(
awxAPI`/inventories?name__startswith=E2E&page=1&page_size=200&created__lt=${twoHoursAgo}`
).then((result) => {
for (const resource of result.results ?? []) {
cy.deleteAwxInventory(resource, { failOnStatusCode: false });
}
});
it('cleanup inventories', () => {
cy.requestGet<AwxItemsResponse<Inventory>>(
awxAPI`/inventories?name__startswith=E2E&page=1&page_size=200&created__lt=${twoHoursAgo}`
).then((result) => {
for (const resource of result.results ?? []) {
cy.deleteAwxInventory(resource, { failOnStatusCode: false });
}
});
});

it('cleanup organizations', () => {
cy.requestGet<AwxItemsResponse<Organization>>(
awxAPI`/organizations?name__startswith=E2E&page=1&page_size=200&created__lt=${twoHoursAgo}`
).then((result) => {
for (const resource of result.results ?? []) {
cy.deleteAwxOrganization(resource, { failOnStatusCode: false });
}
});
it('cleanup organizations', () => {
cy.requestGet<AwxItemsResponse<Organization>>(
awxAPI`/organizations?name__startswith=E2E&page=1&page_size=200&created__lt=${twoHoursAgo}`
).then((result) => {
for (const resource of result.results ?? []) {
cy.deleteAwxOrganization(resource, { failOnStatusCode: false });
}
});
});

it('cleanup users', () => {
cy.requestGet<AwxItemsResponse<AwxUser>>(
awxAPI`/users?username__startswith=e2e-&page=1&page_size=200&created__lt=${twoHoursAgo}`
).then((result) => {
for (const resource of result.results ?? []) {
cy.deleteAwxUser(resource, { failOnStatusCode: false });
}
});
it('cleanup users', () => {
cy.requestGet<AwxItemsResponse<AwxUser>>(
awxAPI`/users?username__startswith=e2e-&page=1&page_size=200&created__lt=${twoHoursAgo}`
).then((result) => {
for (const resource of result.results ?? []) {
cy.deleteAwxUser(resource, { failOnStatusCode: false });
}
});
});

it('cleanup templates', () => {
cy.requestGet<AwxItemsResponse<JobTemplate>>(
awxAPI`/unified_job_templates/?name__startswith=E2E&page=1&page_size=200&created__lt=${twoHoursAgo}`
).then((result) => {
for (const resource of result.results ?? []) {
cy.deleteAwxJobTemplate(resource, { failOnStatusCode: false });
}
});
it('cleanup templates', () => {
cy.requestGet<AwxItemsResponse<JobTemplate>>(
awxAPI`/unified_job_templates/?name__startswith=E2E&page=1&page_size=200&created__lt=${twoHoursAgo}`
).then((result) => {
for (const resource of result.results ?? []) {
cy.deleteAwxJobTemplate(resource, { failOnStatusCode: false });
}
});
});

it('cleanup jobs', () => {
cy.requestGet<AwxItemsResponse<Job>>(
awxAPI`/unified_jobs/?name__startswith=E2E&page=1&page_size=200&created__lt=${twoHoursAgo}`
).then((result) => {
for (const resource of result.results ?? []) {
const url = getJobsAPIUrl(resource.job_type ?? '');
cy.requestDelete(`${url}${resource.id}/`, { failOnStatusCode: false });
}
});
it('cleanup jobs', () => {
cy.requestGet<AwxItemsResponse<Job>>(
awxAPI`/unified_jobs/?name__startswith=E2E&page=1&page_size=200&created__lt=${twoHoursAgo}`
).then((result) => {
for (const resource of result.results ?? []) {
const url = getJobsAPIUrl(resource.job_type ?? '');
cy.requestDelete(`${url}${resource.id}/`, { failOnStatusCode: false });
}
});
});

it('cleanup instance groups', () => {
cy.requestGet<AwxItemsResponse<Job>>(
awxAPI`/instance_groups/?name__startswith=E2E&page=1&page_size=200&created__lt=${twoHoursAgo}`
).then((result) => {
for (const resource of result.results ?? []) {
cy.requestDelete(awxAPI`/instance_groups/${resource.id.toString()}/`, {
failOnStatusCode: false,
});
}
});
it('cleanup instance groups', () => {
cy.requestGet<AwxItemsResponse<Job>>(
awxAPI`/instance_groups/?name__startswith=E2E&page=1&page_size=200&created__lt=${twoHoursAgo}`
).then((result) => {
for (const resource of result.results ?? []) {
cy.requestDelete(awxAPI`/instance_groups/${resource.id.toString()}/`, {
failOnStatusCode: false,
});
}
});
});

it('cleanup workflow approvals', () => {
cy.requestGet<AwxItemsResponse<WorkflowApproval>>(
awxAPI`/workflow_approvals/?name__startswith=E2E&page=1&page_size=200&created__lt=${twoHoursAgo}`
).then((result) => {
for (const resource of result.results ?? []) {
cy.requestPost(awxAPI`/workflow_approvals/${resource.id.toString()}/deny/`, {}, false);
cy.requestDelete(awxAPI`/workflow_approvals/${resource.id.toString()}/`, {
failOnStatusCode: false,
});
}
});
it('cleanup workflow approvals', () => {
cy.requestGet<AwxItemsResponse<WorkflowApproval>>(
awxAPI`/workflow_approvals/?name__startswith=E2E&page=1&page_size=200&created__lt=${twoHoursAgo}`
).then((result) => {
for (const resource of result.results ?? []) {
cy.requestPost(awxAPI`/workflow_approvals/${resource.id.toString()}/deny/`, {}, false);
cy.requestDelete(awxAPI`/workflow_approvals/${resource.id.toString()}/`, {
failOnStatusCode: false,
});
}
});
});
});
Loading

0 comments on commit f4420a1

Please sign in to comment.