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

Documentation / Testing: Mock unit test calls to postgres, remove PG start in contributing #524

Open
KwilLuke opened this issue Feb 22, 2024 · 1 comment
Labels
documentation Improvements or additions to documentation testing

Comments

@KwilLuke
Copy link
Contributor

Suggestion

Right now, some of the unit tests call Postgres directly; this requires that the tester is running a Postgres instance.

To close this issue, we will need to:

  1. Mock the PG response in the unit tests that are currently calling PG.
  2. Remove the instruction in Contributing.md that tells the tester to start PG before running the unit tests.
@KwilLuke KwilLuke added documentation Improvements or additions to documentation testing labels Feb 22, 2024
@jchappelow
Copy link
Member

jchappelow commented Feb 22, 2024

For certain packages we will mock a higher level type that provides say a Datastore, and in others the resolution will be to mock the actual pg response if the code in question is tightly coupled with the database backend (internal/sql/pg package) and/or pgx.

It depends what we are aiming to test in a given unit tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation testing
Projects
None yet
Development

No branches or pull requests

2 participants