Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Improvement]: Use testcontainers to spawn postgres docker containers in integration tests #1479

Closed
1 task done
iulianbarbu opened this issue Dec 8, 2023 · 2 comments
Closed
1 task done
Labels
S-Blocked Implementing this is currently blocked by other issues and/or upstream dependencies S-Triage Awaiting decision for what to do T-Improvement Improvement or addition to existing features

Comments

@iulianbarbu
Copy link
Contributor

iulianbarbu commented Dec 8, 2023

Describe the improvement

A few of our services (logger, provisioner & soon auth) integration tests are using a postgres instance in a docker container, communicating with it to exercise their business logic in the context of integration tests. We'd like to not maintain test logic that sets up a postgres Docker container, but use instead testcontainers [1].

Definition of done:

  • use testcontainers to spawn the postgres docker instance where needed
  • provide APIs to get unique connection strings bound to unique databases, that can be used by test cases in parallel if needed
  • Ensure the postgres instance container is removed at the end of the test cases
  • Ensure the postgres instance container is returned only after it is ready to serve requests
  • ideally, split the work into separate PRs (one per service, where the first one will contain the testcontainers-related changes too).

[1] https://docs.rs/testcontainers/latest/testcontainers/#:~:text=The%20testcontainers%20ecosystem%20facilitates%20self,actual%20database%20to%20be%20present.

Duplicate declaration

  • I have searched the issues and this improvement has not been requested before.
@iulianbarbu iulianbarbu added T-Improvement Improvement or addition to existing features S-Triage Awaiting decision for what to do labels Dec 8, 2023
@oddgrd oddgrd added the S-Blocked Implementing this is currently blocked by other issues and/or upstream dependencies label Dec 17, 2023
@jonaro00
Copy link
Member

I attempted this recently, but it causes dependency conflicts on bollard-stubs. When gateway is no longer using bollard, it might work (c-s will still use it).

@jonaro00
Copy link
Member

testcontainers are being used in the new backend 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-Blocked Implementing this is currently blocked by other issues and/or upstream dependencies S-Triage Awaiting decision for what to do T-Improvement Improvement or addition to existing features
Projects
None yet
Development

No branches or pull requests

3 participants