Skip to content

fix(test): Use in-memory H2 database instead of file-based in TestGravitinoMetricsUpdater#10563

Merged
roryqi merged 1 commit intoapache:mainfrom
puchengy:pyang/metric-update-temp
Mar 27, 2026
Merged

fix(test): Use in-memory H2 database instead of file-based in TestGravitinoMetricsUpdater#10563
roryqi merged 1 commit intoapache:mainfrom
puchengy:pyang/metric-update-temp

Conversation

@puchengy
Copy link
Copy Markdown
Contributor

What changes were proposed in this pull request?

Changed testInitializeDefaultUsesGenericJdbcRepository to use an in-memory H2 database (jdbc:h2:mem:) instead of a file-based H2 database
(jdbc:h2:file:).

Why are the changes needed?

The test was creating file-based H2 databases at data/test-metrics-updater-default-.db that were never cleaned up, leaving leftover .db files
on disk after each test run. The other similar test (testInitializeWithJdbcConfigStillUsesGenericJdbcRepository) already uses in-memory H2 correctly.

Fix: #

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Ran ./gradlew :maintenance:optimizer:test --tests "org.apache.gravitino.maintenance.optimizer.updater.metrics.TestGravitinoMetricsUpdater" -PskipITs —
all 8 tests pass.

…vitinoMetricsUpdater

The testInitializeDefaultUsesGenericJdbcRepository test was creating
file-based H2 databases that were never cleaned up, leaving leftover
.db files on disk after each test run.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

Code Coverage Report

Overall Project 72.8% 🟢
Files changed No Java source files changed -

Module Coverage
jobs 66.17% 🟢
optimizer 82.95% 🟢
optimizer-api 21.95% 🔴

@roryqi roryqi merged commit 2d43de2 into apache:main Mar 27, 2026
21 checks passed
@roryqi
Copy link
Copy Markdown
Contributor

roryqi commented Mar 27, 2026

@puchengy LGTM. Merged to the branch main.

diqiu50 pushed a commit to diqiu50/gravitino that referenced this pull request Mar 27, 2026
…based in TestGravitinoMetricsUpdater (apache#10563)

##  What changes were proposed in this pull request?
Changed testInitializeDefaultUsesGenericJdbcRepository to use an
in-memory H2 database (jdbc:h2:mem:) instead of a file-based H2 database
(jdbc:h2:file:).
   
## Why are the changes needed?
                                                                  
The test was creating file-based H2 databases at
data/test-metrics-updater-default-<nanoTime>.db that were never cleaned
up, leaving leftover .db files
on disk after each test run. The other similar test
(testInitializeWithJdbcConfigStillUsesGenericJdbcRepository) already
uses in-memory H2 correctly.
  Fix: #                                                          

##  Does this PR introduce any user-facing change?

  No.

##  How was this patch tested?

Ran ./gradlew :maintenance:optimizer:test --tests
"org.apache.gravitino.maintenance.optimizer.updater.metrics.TestGravitinoMetricsUpdater"
-PskipITs —
  all 8 tests pass.
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