Lokasi ngalangkungan proxy:   [ UP ]  
[Ngawartoskeun bug]   [Panyetelan cookie]                
Skip to content

test(DbHandler): make sure auto-increment is reset in between tests - #58501

Closed
joshtrichards wants to merge 2 commits into
masterfrom
jtr/test-dbhandler-truncate-teardown
Closed

joshtrichards wants to merge 2 commits into
masterfrom
jtr/test-dbhandler-truncate-teardown

Conversation

@joshtrichards

@joshtrichards joshtrichards commented Feb 21, 2026 •

Copy link
Copy Markdown
Member

DELETE doesn't reset auto-increment; TRUNCATE does. Also probably faster.

  • Resolves: #

Summary

We're doing DELETE rather than TRUNCATE in tearDown(). The former does not reset auto-increment/identity columns on MySQL. Random failures like below with MySQL may be because of this.

Would not be caught in setUp() by the assert on select() because that's based on count not id.

There was 1 failure:

1) OCA\Federation\Tests\DbHandlerTest::testRemove
Failed asserting that 5 is identical to 0.

/home/runner/actions-runner/_work/server/server/apps/federation/tests/DbHandlerTest.php:95

P.S. Though I'm discovering from looking at DBAL's code that even though DBAL implements getTruncateTableSQL() for all supported databases, it merely does a DELETE in SQLite... so we may need a wrapper function or something to truly take care of this universally across our tests (since I suspect we have other tests want to do real TRUNCATE/equivalents in).

TODO

  • ...

Checklist

DELETE doesn't reset auto-increment; TRUNCATE does. Also probably faster.

Signed-off-by: Josh <josh.t.richards@gmail.com>
@joshtrichards joshtrichards added 2. developing Work in progress tests Related to tests feature: database Database related DB labels Feb 21, 2026
Signed-off-by: Josh <josh.t.richards@gmail.com>
@susnux susnux added the community pull requests from community label Jun 9, 2026
@susnux susnux added this to the Nextcloud 35 milestone Jun 9, 2026
@blizzz blizzz mentioned this pull request Aug 27, 2026
@susnux

susnux commented Dec 2, 2026

Copy link
Copy Markdown
Contributor

Closing this pull request as it has been in draft state without any activity for more than six months.
If you are still interested in this change, feel free to revive it and reopen it (or ask us to reopen it if you cannot).
Thank you for your contribution!

@susnux susnux closed this Dec 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2. developing Work in progress community pull requests from community feature: database Database related DB tests Related to tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants