• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Unleash / unleash / 13262410208
87%
master: 91%

Build:
Build:
LAST BUILD BRANCH: main
DEFAULT BRANCH: master
Ran 11 Feb 2025 12:06PM UTC
Jobs 1
Files 712
Run time 233min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

11 Feb 2025 12:01PM UTC coverage: 87.226% (-0.02%) from 87.244%
13262410208

push

github

web-flow
chore: Create test db from template (#9265)

## About the changes
Based on the first hypothesis from
https://github.com/Unleash/unleash/pull/9264, I decided to find an
alternative way of initializing the DB, mainly trying to run migrations
only once and removing that from the actual test run.

I found in [Postgres template
databases](https://www.postgresql.org/docs/current/manage-ag-templatedbs.html)
an interesting option in combination with jest global initializer.

### Changes on how we use DBs for testing

Previously, we were relying on a single DB with multiple schemas to
isolate tests, but each schema was empty and required migrations or
custom DB initialization scripts.

With this method, we don't need to use different schema names
(apparently there's no templating for schemas), and we can use new
databases. We can also eliminate custom initialization code.

### Legacy tests

This method also highlighted some wrong assumptions in existing tests.
One example is the existence of `default` environment, that because of
being deprecated is no longer available, but because tests are creating
the expected db state manually, they were not updated to match the
existing db state.

To keep tests running green, I've added a configuration to use the
`legacy` test setup (24 tests). By migrating these, we'll speed up
tests, but the code of these tests has to be modified, so I leave this
for another PR.

## Downsides
1. The template db initialization happens at the beginning of any test,
so local development may suffer from slower unit tests. As a workaround
we could define an environment variable to disable the db migration
2. Proliferation of test dbs. In ephemeral environments, this is not a
problem, but for local development we should clean up from time to time.
There's the possibility of cleaning up test dbs using the db name as a
pattern:
https://github.com/Unleash/unleash/blob/2ed2e1c27418b92e815d06c351504005cf083... (continued)

2881 of 3808 branches covered (75.66%)

15 of 15 new or added lines in 1 file covered. (100.0%)

8 existing lines in 3 files now uncovered.

14845 of 17019 relevant lines covered (87.23%)

668.4 hits per line

Coverage Regressions

Lines Coverage ∆ File
6
74.12
-7.06% src/lib/features/playground/feature-evaluator/constraint.ts
1
83.91
-1.15% src/lib/features/playground/feature-evaluator/client.ts
1
97.54
-0.41% src/lib/features/export-import-toggles/export-import-service.ts
Jobs
ID Job ID Ran Files Coverage
1 13262410208.1 11 Feb 2025 12:06PM UTC 712
87.23
GitHub Action Run
Source Files on build 13262410208
  • Tree
  • List 712
  • Changed 0
  • Source Changed 0
  • Coverage Changed 0
Coverage ∆ File Lines Relevant Covered Missed Hits/Line Branch Hits Branch Misses
  • Back to Repo
  • 5e9698fe on github
  • Prev Build on main (#13261309654)
  • Next Build on main (#13262832402)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE TRIAL · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc