From a56ae16ff0cb47fe6a589db33252e62ad545c8a5 Mon Sep 17 00:00:00 2001 From: Marcin Gordel Date: Fri, 28 Jun 2024 10:36:52 +0200 Subject: [PATCH 1/2] test: fixed e2e tests for aborting rental --- tests/e2e/resourceRentalPool.spec.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tests/e2e/resourceRentalPool.spec.ts b/tests/e2e/resourceRentalPool.spec.ts index 37eff77da..e245cdda0 100644 --- a/tests/e2e/resourceRentalPool.spec.ts +++ b/tests/e2e/resourceRentalPool.spec.ts @@ -206,6 +206,9 @@ describe("ResourceRentalPool", () => { it("should abort getting 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"), ); @@ -215,6 +218,9 @@ describe("ResourceRentalPool", () => { 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"), @@ -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"), ); @@ -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"), From b28e2b831852f3849d392e11e745e29dea9d4640 Mon Sep 17 00:00:00 2001 From: Marcin Gordel Date: Fri, 28 Jun 2024 10:39:29 +0200 Subject: [PATCH 2/2] test: improved tests titles --- tests/e2e/resourceRentalPool.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/e2e/resourceRentalPool.spec.ts b/tests/e2e/resourceRentalPool.spec.ts index e245cdda0..cd69c1aac 100644 --- a/tests/e2e/resourceRentalPool.spec.ts +++ b/tests/e2e/resourceRentalPool.spec.ts @@ -203,7 +203,7 @@ 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 @@ -214,7 +214,7 @@ describe("ResourceRentalPool", () => { ); }); - 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();