Let the tests choose their database so CI can run PostgreSQL

Open
#39 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
79/100
Issue type
Feature
Clarity
Clearly specified
Activity status
Active
Tech stack
github-actions, postgresql, python

Research direction

Start with get_settings() and Settings.get_test_settings(), then read fastapi-web-server/tests/.env.test and the two relevant cases in tests/test_settings.py. Check the existing CI workflow and how it provisions services before adding the PostgreSQL job. Done when the environment variable selects PostgreSQL while the unset default uses SQLite, both settings tests pass on either database, and CI logs each passing test.

Written by the indexing model from the issue text.

Description

risk:medium type:test

Problem:

  • Under pytest, get_settings() returns Settings.get_test_settings(), which reads only fastapi-web-server/tests/.env.test. That file points at SQLite.
  • So an environment variable or a PostgreSQL service container changes nothing: the tests always run on SQLite.
  • Forced onto PostgreSQL 18.1 by editing that file, the suite gave 52 passed and 2 failed. Both failures are in tests/test_settings.py and assert the SQLite scheme. (Measured at 074f8bb.)

Plan:

  • Let one environment variable choose the test database. The default stays SQLite.
  • The two settings tests accept either scheme.
  • Add a CI job that runs the suite on a pinned PostgreSQL image.

Done when:

  • Setting the variable runs the suite on PostgreSQL, and leaving it unset runs it on SQLite
  • The two settings tests pass on both
  • A CI job runs the suite on PostgreSQL and its log names each passing test

Follows #14.

Dominant language
Python
Stars
2
Forks
3
Avg merge
21h 38m
Merged PRs (30d)
11

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from pnnl/UUDEX

All issues in pnnl/UUDEX

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.