Skip to content

Commit

Permalink
Cleanup properly after each test
Browse files Browse the repository at this point in the history
  • Loading branch information
JiaweiWu committed May 16, 2023
1 parent 9b526fe commit 694cbea
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ export default function activeMaintenanceWindowTests({ getService }: FtrProvider
for (const scenario of UserAtSpaceScenarios) {
const { user, space } = scenario;
describe(scenario.id, () => {
afterEach(() => objectRemover.removeAll());
it('should handle get active maintenance window request appropriately', async () => {
// Create 2 active and 1 inactive maintenance window
const { body: createdMaintenanceWindow1 } = await supertest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function updateMaintenanceWindowTests({ getService }: FtrProvider
freq: 2, // weekly
},
};
after(() => objectRemover.removeAll());
afterEach(() => objectRemover.removeAll());

for (const scenario of UserAtSpaceScenarios) {
const { user, space } = scenario;
Expand Down Expand Up @@ -144,6 +144,14 @@ export default function updateMaintenanceWindowTests({ getService }: FtrProvider
})
.expect(200);

objectRemover.add(
space1,
createdMaintenanceWindow.id,
'rules/maintenance_window',
'alerting',
true
);

const { body: finish } = await supertest
.post(
`${getUrlPrefix(space1)}/internal/alerting/rules/maintenance_window/${
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default function createMaintenanceWindowTests({ getService }: FtrProvider
freq: 2, // weekly
},
};
after(() => objectRemover.removeAll());
afterEach(() => objectRemover.removeAll());

for (const scenario of UserAtSpaceScenarios) {
const { user, space } = scenario;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default function deleteMaintenanceWindowTests({ getService }: FtrProvider
freq: 2, // weekly
},
};
after(() => objectRemover.removeAll());
afterEach(() => objectRemover.removeAll());

for (const scenario of UserAtSpaceScenarios) {
const { user, space } = scenario;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@ export default function findMaintenanceWindowTests({ getService }: FtrProviderCo
freq: 2, // weekly
},
};
after(() => objectRemover.removeAll());
afterEach(() => objectRemover.removeAll());

for (const scenario of UserAtSpaceScenarios) {
const { user, space } = scenario;
describe(scenario.id, () => {
afterEach(() => objectRemover.removeAll());
it('should handle find maintenance window request appropriately', async () => {
const { body: createdMaintenanceWindow1 } = await supertest
.post(`${getUrlPrefix(space.id)}/internal/alerting/rules/maintenance_window`)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export default function getMaintenanceWindowTests({ getService }: FtrProviderCon
freq: 2, // weekly
},
};
after(() => objectRemover.removeAll());
afterEach(() => objectRemover.removeAll());

for (const scenario of UserAtSpaceScenarios) {
const { user, space } = scenario;
Expand Down

0 comments on commit 694cbea

Please sign in to comment.