Skip to content
New issue

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

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

Already on GitHub? # to your account

PDS & Feedgen: Testing things that require a database connection #24

Open
rudyfraser opened this issue Oct 20, 2024 · 5 comments
Open

Comments

@rudyfraser
Copy link
Member

Mainly looking to solve the fact that tests are failing in the CI after deployment due to some tests requiring a database connection. Open to this being a mock database connection of some kind -- will need a way to have records created I think during tests but no persisting after tests complete. Folks doing dev work could hopefully not have to manually set up a bunch of services to be able to build and test things.

@daxpryce
Copy link

daxpryce commented Nov 8, 2024

I'm going to take a look into this this weekend, if all works out the way I expect it to!

@TheRipperoni
Copy link
Contributor

Wanted to follow up on this one. As I'm writing a good chunk of code related to ApiErrors, wanted to see if any headway has been made on it. One option could be to setup a docker compose along with the repo that sets up a basic db that can be connected to, as that's what I'm currently doing and that takes very little on system requirements

@rudyfraser
Copy link
Member Author

Kinda sorta. The original pain point is solved for. I moved the blockstore functions into a trait that is implemented by both an in-memory blockstore and postgresql one. All unit tests for the repo use the in-memory blockstore and tests pass successfully https://github.com/blacksky-algorithms/rsky/actions/runs/13167868697/job/36752588269

If you're looking to test things that need the SqlRepo, you'll still face this issue.

If the docker compose option works for local testing and for github actions I'd be cool with that route.

@daxpryce
Copy link

daxpryce commented Feb 6, 2025

I'm realistically not going to get to do this as soon as I'd like as some health problems have come up, so please don't wait on me @TheRipperoni

@TheRipperoni
Copy link
Contributor

Kinda sorta. The original pain point is solved for. I moved the blockstore functions into a trait that is implemented by both an in-memory blockstore and postgresql one. All unit tests for the repo use the in-memory blockstore and tests pass successfully https://github.com/blacksky-algorithms/rsky/actions/runs/13167868697/job/36752588269

If you're looking to test things that need the SqlRepo, you'll still face this issue.

If the docker compose option works for local testing and for github actions I'd be cool with that route.

Sounds good, and yeah I'm looking specifically at the SqlRepo stuff at the moment

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants