Repository navigation
[Server] Keep tests' files out of the checkout, and fail CI when they are not - #2334
Merged
Merged
Conversation
…JVM in target refusesASchemaActionSetAsASystemProperty starts a child JVM with the test's classpath, which holds the coverage-instrumented classes, but not the -Djacoco-agent.destfile option that sbt-jacoco gives the test JVM. The child's JaCoCo runtime then writes jacoco.exec to the working directory, and server/jacoco.exec shows up as an untracked file after the server tests. Pass the option on when it is set. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
shba24
requested review from
openinx,
tdas,
timothyw553 and
yili-db
as code owners
November 22, 2026 18:04
…target ignoresTheDeploymentEnvironmentVariables starts a child JVM with the test's classpath but not the test JVM's -Djacoco-agent.destfile, so examples/sample-database/jacoco.exec showed up as an untracked file. Pass the option on when it is set, as HibernateConfiguratorTest does. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
The unit test action records git status before the coverage tests and fails if the tests created or changed a file in the checkout. AGENTS.md says where tests may write and how a child JVM keeps its coverage file in target. Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
shba24
marked this pull request as draft
November 22, 2026 18:27
Collaborator
Author
|
/review |
Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
Collaborator
Author
|
/review |
Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
shba24
marked this pull request as ready for review
November 22, 2026 20:11
Collaborator
|
/review |
yili-db
approved these changes
Nov 23, 2026
yili-db
left a comment
Collaborator
There was a problem hiding this comment.
[AI Assisted] Approve at 97ba66d.
I ran the server and sample-database coverage tests on main and on head in fresh clones. On main, server/jacoco.exec and examples/sample-database/jacoco.exec are left in the checkout and the new check fails. On head, both modules leave nothing behind and the check passes. A Spark connector suite also leaves nothing in the checkout.
Note: #2167 also adds a post-test check to .github/actions/run-uc-unit-tests/action.yml, so the two checks will need reconciling there.
shba24
added a commit
to shba24/unitycatalog
that referenced
this pull request
Nov 24, 2026
No conflicts. Brings in ownership transfer (unitycatalog#2149), pool metrics (unitycatalog#2284) and the check that tests leave the checkout clean (unitycatalog#2334). Co-authored-by: Isaac <[email protected]> Signed-off-by: Shubham Bansal <[email protected]>
2 of 4 tasks
yili-db
added a commit
that referenced
this pull request
Nov 30, 2026
…2167) ## 🥞 Stacked PR Use this [link](https://github.com/unitycatalog/unitycatalog/pull/2167/files) to review incremental changes. - [stack/run_test_followups](#2167) [[Files changed](https://github.com/unitycatalog/unitycatalog/pull/2167/files)] --------- - Stop `BaseCredRenewITTest` from starting two servers per test - Its own `@BeforeEach beforeEach()` called `super.setUp()` after JUnit had already run the inherited `setUp()`, and the first server was never closed - Override `setUp()` instead - `BaseServerTest.setUp()` now fails if a server is already running, so the pattern cannot return silently; `UnityCatalogServerTest` checks that - Drop `REPLACE_EXISTING` from the signing-key copy, which only tolerated the second call - Fail CI when tests write to `etc/conf` - A server built without its own `configurationFolder` writes its signing keys, `certs.json` and `token.txt` there; two tests added on `main` while #2159 was open did exactly that - `project/scripts/check_etc_conf.sh` fails if any `etc/conf` differs from the checkout: a new file, ignored or not, or an edited or deleted tracked one - `run-uc-unit-tests` runs it after the tests, next to the clean-checkout step from #2334, which skips ignored files such as the generated keys; `upgrade-tests.yml` runs it after the upgrade tests - A fresh CI checkout has only tracked files there, so a local server cannot cause a false failure - Give `migrate/TestServer`, used by `RealUpgradeTest` and `SchemaGateTest`, its own `configurationFolder` - Give the three server builds in the OPA tests of `UnityCatalogServerTest` (#2078) their own `configurationFolder`; CI failed this check on them - `project/tests/test_check_etc_conf.py`, run in the "Build Test" job, checks the script in a throwaway git repository, including a deleted tracked file - `dev/run-tests.py` watches every `etc/conf` locally, at the root and in modules up to two levels deep, including hidden files and subdirectories; `test_run_tests.py` checks it Tested with `dev/run-tests.py` on `main` at #2357: 240 suites, 3971 tests, 0 failures; afterwards the checkout was clean and `check_etc_conf.sh` found nothing. `RealUpgradeTest.upgradesAndKeepsTheData` passed with `UC_TEST_UPGRADES=true`. With the old `beforeEach()` pattern restored, every `AwsCredRenewITTest` test fails with the new `setUp()` message. The test timeout changes that were here moved to #2330. Signed-off-by: Yi Li <[email protected]> **PR Checklist** - [x] A description of the changes is added to the description of this PR. - [ ] If there is a related issue, make sure it is linked to this PR. - [x] If you've fixed a bug or added code that should be tested, add tests! - [ ] If you've added or modified a feature, documentation in `docs` is updated **Description of changes** <!-- Please state what you've changed and how it might affect the users. --> This pull request and its description were written by Isaac. --------- Signed-off-by: Yi Li <[email protected]> Co-authored-by: Isaac <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Checklist
docsis updatedDescription of changes
After the tests run,
server/jacoco.execandexamples/sample-database/jacoco.execshow up ingit statusas untracked files. They come from two tests that start a child JVM:HibernateConfiguratorTest.refusesASchemaActionSetAsASystemProperty(added in #2117) andSampleDatabaseTest.ignoresTheDeploymentEnvironmentVariables(added in #2116). Each starts a child JVM with the test's classpath, which holds the coverage-instrumented classes, but not the-Djacoco-agent.destfileoption that sbt-jacoco gives the test JVM. Without it, JaCoCo writes its defaultjacoco.execto the working directory.Both tests now pass the option on to the child when it is set, so the child's coverage goes into the module's
target/jacoco/data/jacoco.execwith the rest. The other tests that start processes are fine: the upgrade tests'OldServerruns a released jar without coverage classes, and thestart-uc-servertests use a fakejava.So it does not come back, the unit test action now records
git statusbefore the coverage tests and fails if they create or change a file in the checkout that git does not ignore (as the Helm workflow does forhelm/), and AGENTS.md's testing conventions say where tests may write.How I checked
build/sbt "server/testOnly io.unitycatalog.server.persist.utils.HibernateConfiguratorTest":main(dcec3cf): 21 passed, thengit statusshows?? server/jacoco.exec. That file lists onlyHibernateConfiguratorandRequestContextDataProvider, the classes the child JVM loads.git statusshows no new file, andserver/target/jacoco/data/jacoco.execnow holds the child'sHibernateConfiguratordata.build/sbt "sampleDatabase/testOnly io.unitycatalog.server.utils.SampleDatabaseTest":main: 65 passed, thengit statusshows?? examples/sample-database/jacoco.exec.git statusshows no new file.server/javafmtCheckAllandsampleDatabase/javafmtCheckAllpass.dev/run-tests.pywith these fixes: 237 suites, 3851 tests, 0 failed, and no file in the checkout is new or changed afterwards, so the new CI check passes onmainplus this PR. The check's comparison was also run on a scratch repository: a file present before the tests passes, a new untracked file fails, and a tracked file that was clean before the tests and changed after fails.This pull request and its description were written by Isaac.