bacalhau-project / bacalhau

Compute over Data framework for public, transparent, and optionally verifiable computation
https://docs.bacalhau.org
Apache License 2.0
711 stars 89 forks source link

Support TestContainers PoC #4627

Closed jamlo closed 1 month ago

jamlo commented 1 month ago

This PR adds a test suite utilizing TestContainers. It support spinning up docker compose stacks with all bacalhau components, thus resembling production setup.

This is not a complete TestSuite, but a big initial step towards consolidating out testing and evaluating TestContainers usage.

  1. Allow us to run integration tests against a docker compose deployment of bacalhau

  2. Bacalhau compute/requestor configuration can be injected in the container before start. We do not need to rebuild it every time

  3. Tests are separated into suites which allows the combination of similar tests together that will use the same docker compose deployment. Help speed up things

  4. Docker compose deployment has a local registry as well as a minio server running. This expands out testing ability and scope.

  5. Test Suite Works with Github Actions

Linear issue tracker: ENG-263 Github Issue: https://github.com/bacalhau-project/bacalhau/issues/4597

jamlo commented 1 month ago

Looks good overall. Nice work! Though taking 4 minutes to run just two scenarios seem too long and I hope we can improve things in upcoming iterations

@wdbaruni Thank you. I agree that the timing needs to be significantly lowered. Currently, these are the steps that occur when the suite runs:

  1. The bacalhau project is being compiled (1 to 2 minutes). This is a temporary step that will be totally removed when we choose our CI system, which will have a build step before these tests run, and the binary will be passed down. The integraion tests will not be compiling their own bacalhau binary.

  2. The container base images build: This step is only done one in the whole test, but still I am thinking about a way to use prebuilt container images, pull them from an image registry, and only inject them with tests assets (bacalhau binary, other specs) when the container starts. Thus reducing the overall time.

  3. Each Test suite run is designed to run against a dedicated doeck compose stack, in series. This way if we have 20 tests in a suite, they will be using the same docker compose deployment, and not standing 20 docker compose stacks. This will show more as we add more tests.