Skip to content

Commit

Permalink
Merge pull request #1004 from golemfactory/mgordel/JST-991/e2e-tests-…
Browse files Browse the repository at this point in the history
…fixes

Fixed e2e tests for aborting rental
  • Loading branch information
grisha87 authored Jun 28, 2024
2 parents f069135 + b28e2b8 commit 1021373
Showing 1 changed file with 10 additions and 2 deletions.
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

0 comments on commit 1021373

Please sign in to comment.