Skip to content

Use fixtures to speed up database tests#163

Merged
jbogard merged 4 commits into
jbogard:mainfrom
0xced:Testcontainers-Fixture
Jan 19, 2026
Merged

Use fixtures to speed up database tests#163
jbogard merged 4 commits into
jbogard:mainfrom
0xced:Testcontainers-Fixture

Conversation

@0xced

@0xced 0xced commented Jan 18, 2026

Copy link
Copy Markdown
Contributor

Using a fixture creates and starts a single container per test class instead of creating and starting one container per test.

Comparison of execution times on a MacBook Pro M2 Max.

DB2Tests: from about 1 hour to 6 minutes
MySqlTests: from 2 minutes down to 15 seconds
PostgresTests: from 45 seconds down to 6 seconds
SqlServerTests: from over 3 minutes down to 30 seconds

Note that two Informix tests are already failing with a DB2Exception, even before introducing the fixture (ShouldExcludeSchemas + ShouldIncludeSchemas)

IBM.Data.Db2.DB2Exception
ERROR [IX000] [IBM][IDS/UNIX64] User (a) was not found.

@0xced 0xced force-pushed the Testcontainers-Fixture branch from 6448215 to 8a8d356 Compare January 18, 2026 14:27
@0xced

0xced commented Jan 18, 2026

Copy link
Copy Markdown
Contributor Author

The last commit also adds test reports in GitHub actions so that it's easy to see all the test results in the summary of the action run.

For example: https://github.com/jbogard/Respawn/actions/runs/21113310127?pr=163

Screenshot for when the run expires:
Screenshot of run 21113310127

Using a fixture creates and starts a single container per test class instead of creating and starting one container per test.

Comparison of execution times on a MacBook Pro M2 Max.

DB2Tests: from about 1 hour to 6 minutes
MySqlTests: from 2 minutes down to 15 seconds
PostgresTests: from 45 seconds down to 6 seconds
SqlServerTests: from over 3 minutes down to 30 seconds

Note that two Informix tests are already failing with a DB2Exception, even before introducing the fixture (ShouldExcludeSchemas + ShouldIncludeSchemas)
> IBM.Data.Db2.DB2Exception
> ERROR [IX000] [IBM][IDS/UNIX64] User (a) was not found.
@0xced 0xced force-pushed the Testcontainers-Fixture branch from 8a8d356 to dea3219 Compare January 19, 2026 16:51
0xced added 3 commits January 19, 2026 17:58
Still skipping on CI because it fails with "No space left on device"
@0xced 0xced force-pushed the Testcontainers-Fixture branch from dea3219 to b1f6985 Compare January 19, 2026 16:58
@jbogard

jbogard commented Jan 19, 2026

Copy link
Copy Markdown
Owner

Thanks! Yeah I don't know what's going on with those Informix tests. It was contributed externally so no idea.

@jbogard jbogard merged commit f550203 into jbogard:main Jan 19, 2026
2 checks passed
@0xced 0xced deleted the Testcontainers-Fixture branch January 19, 2026 17:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants