/** * This method attempts to validate all loopback addresses in the pool by trying to * bind to each one. It returns an object containing arrays of successfully bound * loopback addresses and those that failed along with their errors. * * It will check all loopback addresses from 127.0.0.2 to 127.0.0.33 (by default). * * Use the HARPER_INTEGRATION_TEST_LOOPBACK_POOL_COUNT environment variable to * adjust the number of loopback addresses to validate (up to 254). */ export declare function validateLoopbackAddressPool(): Promise<{ successful: string[]; failed: { loopbackAddress: string; error: Error; }[]; }>; /** * Retrieves the next available loopback address from the pool using a file-based * locking mechanism to safely allocate addresses across concurrent test processes. * * **How it works:** * 1. Acquires a file-based lock to prevent race conditions with other processes * 2. Reads the pool state (a JSON array of process IDs, with null for available slots) * 3. Finds the first available (null) slot and assigns the current process PID to it * 4. Writes the updated pool back to disk and releases the lock * 5. Validates that the allocated address can actually be bound to * 6. Returns the loopback address (e.g., "127.0.0.2") * * If no addresses are available, waits and retries until one becomes available. * * **Pool file location:** `${tmpdir()}/harper-integration-test-loopback-pool.json` * **Lock file location:** `${tmpdir()}/harper-integration-test-loopback-pool.lock` * * @returns A promise that resolves with an allocated loopback address * @throws {LoopbackAddressValidationError} If the allocated address cannot be bound to */ export declare function getNextAvailableLoopbackAddress(): Promise; /** * Releases a loopback address back to the pool, making it available for other processes. * * @param address The loopback address to release (e.g., "127.0.0.2") * @throws InvalidLoopbackAddressError if the address format is invalid */ export declare function releaseLoopbackAddress(address: string): Promise; /** * Releases all loopback addresses assigned to the current process. * Useful for cleanup during graceful shutdown. */ export declare function releaseAllLoopbackAddressesForCurrentProcess(): Promise;