storacha / freeway

🛣 Experimental IPFS HTTP gateway providing access to UnixFS data via CAR CIDs.
Other
14 stars 5 forks source link

chore: integration tests setup #116

Closed fforbeck closed 1 month ago

fforbeck commented 2 months ago

Integration Test Setup for Cloudflare Local Worker

In this PR, I have implemented an integration test setup to verify the functionality of our Cloudflare Worker. This setup involves running the worker locally with all the bindings enabled in wrangler.toml (integration environment), and performing a series of HTTP requests to ensure the worker behaves as expected under various conditions.

By running the worker locally, we avoid the complexities and overhead associated with handling authentication for deploying a remote worker via CI. This makes the testing process more straightforward.

Key Components

  1. Worker Fixture:

    • Purpose: The fixture file contains the setup and teardown logic for the Cloudflare Worker used in our tests.
    • Functions:
      • setupWorker: Deploys the worker and starts the local Wrangler dev server.
      • teardownWorker: Stops the local Wrangler dev server.
      • getWorkerState: Provides the current state of the worker, including IP, port, and output.
  2. Integration Test Folder:

    • Purpose: This folder will contain the actual test files with logic to verify the worker's various functionalities.

Configuration