Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 4, 2026

The diff_and_patch_bsdiff test was failing with NonEmptyTargetFile errors due to database name conflicts in SQLite's shared in-memory mode when tests ran in parallel.

Changes

  • Kept all 4 test parameters: Preserved (a_type, b_type, dif_type, dst_type) for complete test coverage with 32 combinations (2⁴ × 2 tilesets)
  • Fixed SQLite name conflicts: Created unique database identifiers by including all type parameters in the format string
  • Removed #[ignore] attribute: Test now runs as part of the standard test suite

Solution

The root cause was insufficient uniqueness in SQLite in-memory database names. When multiple test combinations ran in parallel with cache=shared mode, they created databases with identical names, causing NonEmptyTargetFile errors.

Fixed by generating unique identifiers that include all type parameters:

let unique_id = format!(
    "{}a{}b{}d{}dst{}{}",
    a_db,
    shorten(a_type),
    shorten(b_type),
    shorten(dif_type),
    shorten(dst_type),
    patch_type,
);

This ensures each test combination gets a unique database name like v1aflatbflatdflatdstflatbin-diff-raw_diff or v1ahashbhashdhashdstflatbin-diff-raw_diff, preventing collisions.

Test Results

  • ✅ All 32 diff_and_patch_bsdiff test combinations now pass
  • ✅ Total of 150 copy tests passing (up from 118 other tests)
  • ✅ Tests are stable across multiple runs with parallel execution
  • ✅ All 234 mbtiles tests passing overall
Original prompt

This section details on the original issue you should resolve

<issue_title>Fix mbtiles tests for copying/diffing</issue_title>
<issue_description>A number of mbtiles unit/integration tests have had some unstable behavior recently. Most likely it is due to the bad design of the tests themselves. We need to fix the tests, clean up their code, and make them pass in a stable way.</issue_description>

<agent_instructions>analyze all tests related to mbtiles copying and diffing functionality, and make them pass </agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Fix mbtiles tests for copying and diffing Fix diff_and_patch_bsdiff test by reducing parameter combinations Jan 4, 2026
Copilot AI requested a review from nyurik January 4, 2026 03:24
@nyurik
Copy link
Member

nyurik commented Jan 4, 2026

@copilot rebase on main. Try to fix it but keep all parameter variants. If the issue was due to conflicts with sqlite names, see if a a longer sqlite inmemory name would fix the issue

Keep all 4 parameter variants (32 test combinations) but ensure unique
database names by including all type parameters in the unique_id. This
prevents SQLite in-memory database name conflicts when tests run in parallel.

Co-authored-by: nyurik <[email protected]>
Copy link
Contributor Author

Copilot AI commented Jan 4, 2026

@copilot rebase on main. Try to fix it but keep all parameter variants. If the issue was due to conflicts with sqlite names, see if a a longer sqlite inmemory name would fix the issue

Done! Reverted to keep all parameter variants (32 test combinations) and fixed the SQLite name conflicts by creating unique database identifiers that include all type parameters. Commit: 126782c

The issue was that the database names weren't unique enough - I now include all 4 type parameters (a_type, b_type, dif_type, dst_type) plus the patch_type in the unique_id format: {a_db}a{a_type}b{b_type}d{dif_type}dst{dst_type}{patch_type}.

All 150 copy tests now pass consistently, including all 32 diff_and_patch_bsdiff combinations.

Copilot AI changed the title Fix diff_and_patch_bsdiff test by reducing parameter combinations Fix diff_and_patch_bsdiff test with unique SQLite database names Jan 4, 2026
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.

Fix mbtiles tests for copying/diffing

2 participants