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

Bump cleanup to 2 hours ago #3056

Merged
merged 2 commits into from
Aug 26, 2024
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
18 changes: 9 additions & 9 deletions cypress/e2e/awx/cleanup/awx-cleanup.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import { getJobsAPIUrl } from '../../../../frontend/awx/views/jobs/jobUtils';
import { cyLabel } from '../../../support/cyLabel';
import { awxAPI } from '../../../support/formatApiPathForAwx';

const tenMinutesAgo = new Date(Date.now() - 10 * 60 * 1000).toISOString();
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=${tenMinutesAgo}`
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 });
Expand All @@ -26,7 +26,7 @@ cyLabel(['upstream'], () => {

it('cleanup inventories', () => {
cy.requestGet<AwxItemsResponse<Inventory>>(
awxAPI`/inventories?name__startswith=E2E&page=1&page_size=200&created__lt=${tenMinutesAgo}`
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 });
Expand All @@ -36,7 +36,7 @@ cyLabel(['upstream'], () => {

it('cleanup organizations', () => {
cy.requestGet<AwxItemsResponse<Organization>>(
awxAPI`/organizations?name__startswith=E2E&page=1&page_size=200&created__lt=${tenMinutesAgo}`
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 });
Expand All @@ -46,7 +46,7 @@ cyLabel(['upstream'], () => {

it('cleanup users', () => {
cy.requestGet<AwxItemsResponse<AwxUser>>(
awxAPI`/users?username__startswith=e2e-&page=1&page_size=200&created__lt=${tenMinutesAgo}`
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 });
Expand All @@ -56,7 +56,7 @@ cyLabel(['upstream'], () => {

it('cleanup templates', () => {
cy.requestGet<AwxItemsResponse<JobTemplate>>(
awxAPI`/unified_job_templates/?name__startswith=E2E&page=1&page_size=200&created__lt=${tenMinutesAgo}`
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 });
Expand All @@ -66,7 +66,7 @@ cyLabel(['upstream'], () => {

it('cleanup jobs', () => {
cy.requestGet<AwxItemsResponse<Job>>(
awxAPI`/unified_jobs/?name__startswith=E2E&page=1&page_size=200&created__lt=${tenMinutesAgo}`
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 ?? '');
Expand All @@ -77,7 +77,7 @@ cyLabel(['upstream'], () => {

it('cleanup instance groups', () => {
cy.requestGet<AwxItemsResponse<Job>>(
awxAPI`/instance_groups/?name__startswith=E2E&page=1&page_size=200&created__lt=${tenMinutesAgo}`
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()}/`, {
Expand All @@ -89,7 +89,7 @@ cyLabel(['upstream'], () => {

it('cleanup workflow approvals', () => {
cy.requestGet<AwxItemsResponse<WorkflowApproval>>(
awxAPI`/workflow_approvals/?name__startswith=E2E&page=1&page_size=200&created__lt=${tenMinutesAgo}`
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);
Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/eda/cleanup/eda-cleanup.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ cyLabel(['aaas-unsupported'], function () {

if (!resource.created_at) return false;
const created = new Date(resource.created_at);
const beforeTime = new Date(Date.now() - 10 * 60 * 1000);
const beforeTime = new Date(Date.now() - 2 * 60 * 60 * 1000);

return created < beforeTime;
}
Expand Down
Loading