Skip to content

test(files_external): call parent::setUp() in BackendServiceTest - #64174

Open
solracsf wants to merge 1 commit into
masterfrom
fix/files-external-backendservicetest-setup
Open

test(files_external): call parent::setUp() in BackendServiceTest#64174
solracsf wants to merge 1 commit into
masterfrom
fix/files-external-backendservicetest-setup

Conversation

@solracsf

Copy link
Copy Markdown
Member

BackendServiceTest skipped parent::setUp() but still ran TestCase::tearDown(), which re-registers IDBConnection as TestCase::$realDatabase. That property is only set in the parent setUp(), so when this test is the first non-DB test in a run it stays null and every later test gets a null database connection.

CI doesn't hit this because the full files_external suite runs other tests first. Running apps/files_external/tests/Service on its own reproduces it: 112 of 138 tests error with IDBConnection, null given without this change, and all pass with it, on MariaDB 11.8 and PostgreSQL 16.

BackendServiceTest overrode setUp() without calling the parent, but
still ran TestCase::tearDown(). For a test outside the DB group that
tearDown re-registers IDBConnection as TestCase::$realDatabase, which
only the parent setUp() initialises. When BackendServiceTest was the
first non-DB test in a run, $realDatabase stayed null and every later
test in the process got a null database connection.

This showed up when running apps/files_external/tests/Service on its
own: 112 of 138 tests errored with "IDBConnection, null given". The
full files_external suite hides it because earlier tests set
$realDatabase first.

Signed-off-by: Git'Fellow <12234510+solracsf@users.noreply.github.com>
@solracsf
solracsf requested a review from a team as a code owner September 10, 2026 10:18
@solracsf
solracsf requested review from Altahrim, come-nc, icewind1991 and leftybournes and removed request for a team September 10, 2026 10:18
@solracsf solracsf added 3. to review Waiting for reviews tests Related to tests labels Sep 10, 2026
@solracsf solracsf added this to the Nextcloud 36 milestone Sep 10, 2026
@solracsf
solracsf enabled auto-merge September 10, 2026 10:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

3. to review Waiting for reviews tests Related to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants