Repository navigation
[Server] Keep test servers out of etc/conf and speed up Spark tests - #2159
Conversation
- Add `UnityCatalogServer.Builder.configurationFolder(Path)`, defaulting to `etc/conf` - Server starts rewrote `etc/conf/certs.json` and `token.txt` in place, shared by all tests - Give each `BaseServerTest` its own `@TempDir` `configurationFolder` - Signing keys are generated once per JVM and copied in - Tests that sign tokens or read `token.txt` use that folder - Add test-only Spark settings to the `spark` project - Spark UI off, `spark.databricks.delta.snapshotPartitions=2` - Cuts the slowest Delta suites by about a third Signed-off-by: Yi Li <[email protected]>
|
/review |
timothyw553
left a comment
There was a problem hiding this comment.
LGTM. Two small nits and the approval remains after addressing.
| setDefaults(unityCatalogServerBuilder); | ||
| this.shutdownTimeout = unityCatalogServerBuilder.serverProperties.getShutdownTimeout(); | ||
| Path configurationFolder = Path.of("etc", "conf"); | ||
| Path configurationFolder = unityCatalogServerBuilder.configurationFolder; |
There was a problem hiding this comment.
nit: missing direct test for the new output folder
|
|
||
| /** | ||
| * Sets the folder holding the signing keys, which the server creates if missing, and the {@code | ||
| * certs.json} and {@code token.txt} it writes on every start. Defaults to {@code etc/conf}; |
There was a problem hiding this comment.
nit: not during every start() - during construction. Calling start() again on the same server does not rewrite them.
Signed-off-by: Yi Li <[email protected]>
shba24
left a comment
There was a problem hiding this comment.
Thanks Yi, this looks good to me; nothing blocks. One small nit inline. I also checked the REPLACE_EXISTING comment: without it, all 6 AwsCredRenewITTest tests fail with FileAlreadyExistsException, so it's needed.
|
|
||
| @Test | ||
| public void startFailsWhenThePortIsTaken() throws Exception { | ||
| // The server setUp() built writes certs.json and token.txt to configurationFolder, next to the |
There was a problem hiding this comment.
Nit (not a blocker): these configurationFolder checks and the null check aren't about the port, so if one fails the report names startFailsWhenThePortIsTaken. How about a separate method in this class, e.g. serverWritesCertsAndTokenToConfigurationFolder? Feel free to take or skip.
There was a problem hiding this comment.
[AI Assisted] Thanks! I folded them in on purpose: every test method here starts its own server in setUp(), so a separate method would add one more server start just for a few assertions on the server setUp() already started. The comment above the checks says what they verify, so a failure there should still be easy to place. Happy to split it if you feel strongly.
There was a problem hiding this comment.
Makes sense, saving a server start is worth it. Fine as is, thanks!
|
[AI Assisted] On the AI review note about the Spark test settings: I timed each one on
So |
shba24
left a comment
There was a problem hiding this comment.
LGTM, approving. The full suite also passes on top of this in #2160 (212 suites, 3152 tests, 0 failed through dev/run-tests.py), which runs 16 server JVMs at once, so the per-test configurationFolder holds up under parallel runs.
…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]>
🥞 Stacked PR
Use this link to review incremental changes.
UnityCatalogServer.Builder.configurationFolder(Path), defaulting toetc/confetc/conf/certs.jsonandtoken.txtin place, shared by all testscerts.jsonandtoken.txtmove;server.properties,hibernate.propertiesand the log4j configuration are still read frometc/confBaseServerTestits own@TempDirconfigurationFoldertoken.txtuse that folderUnityCatalogServerTestchecks that the server writescerts.jsonandtoken.txttheresparkprojectspark.databricks.delta.snapshotPartitions=2: Delta's default of 50 snapshot partitions dominates small test tables; cuts the slowest Delta suites by a fifth to a thirdspark.ui.enabled=falseandspark.ui.showConsoleProgress=false: no web UI port per Spark session and no progress bars in the test outputSigned-off-by: Yi Li [email protected]
PR Checklist
docsis updatedDescription of changes
This pull request and its description were written by Isaac.