sailfork / t3code-github / .repos/ alchemy-effect/ packages/ integration-tests/ test/ AWS/ EC2/ VpcTest.ts

import * as Test from "@alchemy.run/test/Alchemy";
import { makeEc2VpcCapacityLease } from "./VpcCapacity.ts";

/** Test adapter for files that create custom VPCs. */
export const make = <ROut = any>(options: Test.MakeOptions<ROut>, permits: 1 | 2 = 1) => {
  const api = Test.make(options);
  const lease = makeEc2VpcCapacityLease(permits);

  // Waiting is intentional scheduling across the full AWS run, not a cloud
  // operation, so it uses the run's hard wall rather than a per-test budget.
  api.beforeAll(lease.acquire, { timeout: 3_600_000 });
  api.afterAll(lease.release);

  return api;
};