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

Fixed e2e tests for aborting rental #1004

Merged
merged 2 commits into from
Jun 28, 2024
Merged
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
12 changes: 10 additions & 2 deletions tests/e2e/resourceRentalPool.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,18 +203,24 @@ describe("ResourceRentalPool", () => {
});
});

it("should abort getting exe-unit by timeout", async () => {
it("should abort getting the newly created exe-unit by timeout", async () => {
const pool = glm.rental.createResourceRentalPool(proposalPool, allocation, { poolSize: 1 });
const rental = await pool.acquire();
// wait for init and destroy the exe-unit created automatically on startup renatl
await rental.getExeUnit();
await rental.destroyExeUnit();
await expect(rental.getExeUnit(10)).rejects.toThrow(
new GolemAbortError("Initializing of the exe-unit has been aborted due to a timeout"),
);
});

it("should abort getting exe-unit by signal", async () => {
it("should abort getting the newly created exe-unit by signal", async () => {
const pool = glm.rental.createResourceRentalPool(proposalPool, allocation, { poolSize: 1 });
const abortController = new AbortController();
const rental = await pool.acquire();
// wait for init and destroy the exe-unit created automatically on startup renatl
await rental.getExeUnit();
await rental.destroyExeUnit();
abortController.abort();
await expect(rental.getExeUnit(abortController.signal)).rejects.toThrow(
new GolemAbortError("Initializing of the exe-unit has been aborted"),
Expand All @@ -224,6 +230,7 @@ describe("ResourceRentalPool", () => {
it("should abort finalizing resource rental by timeout", async () => {
const pool = glm.rental.createResourceRentalPool(proposalPool, allocation, { poolSize: 1 });
const rental = await pool.acquire();
await rental.getExeUnit();
await expect(rental.stopAndFinalize(10)).rejects.toThrow(
new GolemAbortError("The finalization of payment process has been aborted due to a timeout"),
);
Expand All @@ -233,6 +240,7 @@ describe("ResourceRentalPool", () => {
const pool = glm.rental.createResourceRentalPool(proposalPool, allocation, { poolSize: 1 });
const abortController = new AbortController();
const rental = await pool.acquire();
await rental.getExeUnit();
abortController.abort();
await expect(rental.stopAndFinalize(abortController.signal)).rejects.toThrow(
new GolemAbortError("The finalization of payment process has been aborted"),
Expand Down
Loading