Skip to content

test: bootstrap DB props in DowngradeAdminsIT and DeletePlayersIT#837

Merged
ismisepaul merged 1 commit into
dev#536from
dev#536-it-bootstrap-fix
May 10, 2026
Merged

test: bootstrap DB props in DowngradeAdminsIT and DeletePlayersIT#837
ismisepaul merged 1 commit into
dev#536from
dev#536-it-bootstrap-fix

Conversation

@ismisepaul
Copy link
Copy Markdown
Member

Summary

Two IT files under src/it/java/servlets/admin/userManagement/ were calling into Getter/Setter without first writing the test database.properties file. The other 42 IT files in the suite do this via a standard @BeforeAll block. These two were missed.

Pre-pool (#816) this worked: application code read the properties file lazily on every DB call, and the test runtime arranged for the file to exist via other means.

Post-pool, ConnectionPool.initialize() runs once per JVM on the first getConnection() call and reads the props file exactly once. If the file is missing, the pool is marked unusable for the entire JVM and every subsequent test in that fork throws Connection pool not available.

In CI this looked like a flood of FATAL FileNotFoundException stack traces drowning out the actual leak signal we're hunting in the integration-tests job. Example seen on the post-#834 dev#536 run:

FileNotFoundException: /home/runner/.../target/test-classes/conf/database.properties (No such file or directory)
  at ConnectionPool.loadDatabaseProperties(ConnectionPool.java:257)
  at ConnectionPool.initialize(ConnectionPool.java:73)
  ...
  at servlets.admin.userManagement.DowngradeAdminsIT.testWithAdminAuthValidUser

Attribution

This is a latent IT-bootstrap gap that #816's pool-init model surfaced, not a regression from any specific recent PR:

A strategic fix would be to make TestProperties auto-bootstrap on any first DB call from a test JVM, but that is much bigger scope than needed.

Changes

File Change
DowngradeAdminsIT.java Add @BeforeAll resetDatabase() with createMysqlResource + ensureSchemaReady + reseedTestData. Keep existing @BeforeEach (per-test mock request/response reset).
DeletePlayersIT.java Same.

26 lines added across the two files. No behavior change beyond the bootstrap.

Verification

mvn -Dit.test='DowngradeAdminsIT,DeletePlayersIT' failsafe:integration-test
Tests run: 8, Failures: 0, Errors: 0, Skipped: 0

All 8 tests now pass (4 per file). Before this fix every one of them FATAL'd at pool init.

Why this matters now

After #834 and #836 closed the high-impact core-pool leaks in Setter and Setup, the integration-tests job on dev#536 still failed — but with two distinct failure modes interleaved:

  1. Real remaining leaks in challenge servlets / other paths (the actual signal).
  2. This IT-bootstrap bug producing hundreds of lines of FATAL log per failing test method (noise).

Removing the noise lets us see which challenge family to tackle next.

Test plan

  • Local: 8 tests pass across both files
  • CI integration-tests run cleaner (no Connection pool not available cascade from these two classes)

These two ITs called into Getter/Setter without first writing the test
database.properties file. Pre-pool (#816) this worked because the
application code read the properties file lazily on every call, and
the test runtime arranged for the file to exist via other means. Post-
pool, ConnectionPool.initialize() is called once per JVM on the first
getConnection() and reads the props file exactly once; if it is
missing, the pool is marked unusable for the entire JVM and every
subsequent test in that fork throws "Connection pool not available".

Symptom in CI: every test method in both classes FATAL'd with a long
FileNotFoundException stack trace pointing at
target/test-classes/conf/database.properties, drowning out any real
leak signal in the IT log.

Add the standard @BeforeAll bootstrap used by the other 42 IT files
(createMysqlResource + ensureSchemaReady + reseedTestData) to both
files. Keep the existing @beforeeach for per-test request/response
reset.

Verified locally: 8 tests pass across the two files (4 each); prior
to this fix all 8 failed at pool init.
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds the standard integration-test database bootstrap to two previously-missed servlet IT classes so the test database.properties exists before any Getter/Setter DB call triggers one-shot ConnectionPool.initialize().

Changes:

  • Added a @BeforeAll resetDatabase() block to DowngradeAdminsIT to create the MySQL test properties resource and reseed the DB.
  • Added the same @BeforeAll resetDatabase() block to DeletePlayersIT.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/it/java/servlets/admin/userManagement/DowngradeAdminsIT.java Adds @BeforeAll DB/property bootstrap (create MySQL resource, ensure schema, reseed) to prevent pool init failures when this class runs early in a fork.
src/it/java/servlets/admin/userManagement/DeletePlayersIT.java Same @BeforeAll bootstrap to ensure database.properties exists before any DB access.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@ismisepaul ismisepaul merged commit d6bb465 into dev#536 May 10, 2026
9 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

2 participants