Skip to content

Fix the integration tests checkstyles. - #1149

Merged
tdas merged 8 commits into
unitycatalog:mainfrom
openinx:1142-integration-tests-checkstyle
Nov 5, 2025
Merged

tdas merged 8 commits into
unitycatalog:mainfrom
openinx:1142-integration-tests-checkstyle

Conversation

@openinx

@openinx openinx commented Oct 31, 2025

Copy link
Copy Markdown
Collaborator

PR Checklist

  • 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.
  • 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

@openinx
openinx requested a review from tdas as a code owner October 31, 2025 22:34
Comment thread .github/workflows/unit-tests.yml Outdated
distribution: 'temurin'

- name: Compile integration tests to verify compilation and checkstyle issues.
run: build/sbt integrationTests/compile

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we don't run integrationTests when build/sbt test, so usually we don't add the integrationTests module in the root here. https://github.com/unitycatalog/unitycatalog/pull/1149/files#diff-5634c415cd8c8504fdb973a3ed092300b43c4b8fc1e184f7249eb29a55511f91R661

But we still need to verify the integrationTests's checkstyle and compilation issues when running CI .

@openinx
openinx force-pushed the 1142-integration-tests-checkstyle branch from c64a464 to ae50960 Compare November 3, 2025 17:32
Comment thread build.sbt Outdated
javafmtCheckSettings,
javaCheckstyleSettings("dev/checkstyle-config.xml"),
// Since integrationTests don't have main sources, so checking the test code when compiling.
(Compile / compile) := ((Test / compile) dependsOn testJavastyle).value,

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tdas , this line is the key change to enable the checkstyle. Since the integrationTests module does not have the main java source code, so the ./build/sbt compile won't do any checkstyle check.

Also we usually don't run ./build/sbt test for integrationTests module, since integrationTests is not a module that will be triggered for every PR changes. Then we have no change to enforce the checkstyle check for integrationTests.

Here we just make the compile depends on the integrationTests's Test/compile --- (just compile the test code, not run it). Then we can successfully dectect the invalidation.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And the ./build/sbt compile won't check it also, the correct command to check it is: ./build/sbt integrationTest/compile. That's why I made this change in Github CI.

https://github.com/unitycatalog/unitycatalog/pull/1149/files#diff-cd0effce06f425599e96952f4d5f684641a683f46d9909e7c74a9f8b2f03ccd3R29

@openinx openinx closed this Nov 3, 2025
@openinx openinx reopened this Nov 3, 2025
@openinx openinx closed this Nov 3, 2025
@openinx openinx reopened this Nov 3, 2025
@openinx openinx closed this Nov 3, 2025
@openinx openinx reopened this Nov 3, 2025
@openinx
openinx force-pushed the 1142-integration-tests-checkstyle branch from 70b4bbd to 5ea0374 Compare November 4, 2025 05:58
distribution: 'temurin'

- name: Compile integration tests to verify compilation and checkstyle issues.
run: build/sbt integrationTests/test:compile

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the command to build the integrationTests which is included in the sbt's root .

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add this after the main tests have run?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alternatively... why not add integrationTests to the root so that its always compiled like other modules?

@openinx openinx Nov 4, 2025 •

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alternatively... why not add integrationTests to the root so that its always compiled like other modules?

Because we don't expect the integrationTests to be run if we do ./build/sbt test, rigtht ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thats a good point. we dont want any one to run the integration test with the simple command of sbt test.
then i am okay with integration test being outside the root. please add a comment in the build file saying the reason why.

and then this github workflow can test the integration tests.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good to me, let me add the context. I think it will better to have it in the first step, so that it won't waste resource to run all unit tests if there is any compliation error or checkstyle issue in integrationTests module.

@@ -1,85 +1,91 @@
package io.unitycatalog.integrationtests;

import lombok.Getter;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those are just code reformat, to match the checkstyle rules.

@@ -1,5 +1,10 @@
package io.unitycatalog.integrationtests;

import static java.lang.String.format;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those are checkstyles alignments.

@@ -1,5 +1,11 @@
package io.unitycatalog.integrationtests;

import static java.lang.String.format;

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto.

run: build/sbt integrationTests/test:compile

- name: Run tests with coverage
run: build/sbt -J-Xmx2G +jacoco

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i feel something is horribly wrong here. what is running tests in this command?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it just run all unit tests under the sbt's root project here.

The jacoco says:

+jacoco

The + is a cross-building operator in SBT. It tells SBT to run the task for all crossScalaVersions defined in the project. For example, if your project supports Scala 2.13 and 3.3, it will run the task for both.

jacoco is likely a custom SBT task added via a plugin (usually the sbt-jacoco plugin
) for code coverage reporting.

Jacoco measures test coverage for your code.

Running +jacoco will compile, run tests, and generate coverage reports for all Scala versions your project supports

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think, here we can just use the ./build/sbt -J-Xmx2G test.

Comment thread project/Checkstyle.scala Resolved
Comment thread build.sbt
javaOptions ++= Seq(
"--add-exports=java.base/sun.nio.ch=ALL-UNNAMED",
),
javafmtCheckSettings,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not add integrationTests to the root as well?
wouldnt that solve a lot of the problems?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Signed-off-by: Zheng Hu <[email protected]>
Signed-off-by: Zheng Hu <[email protected]>
Signed-off-by: Zheng Hu <[email protected]>
Signed-off-by: Zheng Hu <[email protected]>
Signed-off-by: Zheng Hu <[email protected]>
@openinx
openinx force-pushed the 1142-integration-tests-checkstyle branch from 4b2d597 to a292f8c Compare November 4, 2025 23:21
@openinx

openinx commented Nov 4, 2025

Copy link
Copy Markdown
Collaborator Author

The test is still failing...

[error] Test io.unitycatalog.cli.table.CliTableCRUDTest.testTableCRUD failed: java.lang.RuntimeException: io.unitycatalog.client.ApiException: java.io.IOException: closed, took 11.3s
[error]     at io.unitycatalog.cli.UnityCatalogCli.main(UnityCatalogCli.java:171)
[error]     at io.unitycatalog.cli.TestUtils.executeCLICommand(TestUtils.java:24)
[error]     at io.unitycatalog.cli.table.CliTableOperations.listTables(CliTableOperations.java:70)
[error]     at io.unitycatalog.server.base.table.BaseTableCRUDTest.verifyTablePagination(BaseTableCRUDTest.java:115)
[error]     at io.unitycatalog.server.base.table.BaseTableCRUDTest.testTableCRUD(BaseTableCRUDTest.java:72)
[error]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error]     at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
[error]     at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error]     at java.lang.reflect.Method.invoke(Method.java:569)
[error]     ...
[error] Caused by: io.unitycatalog.client.ApiException: java.io.IOException: closed
[error]     at io.unitycatalog.client.api.TablesApi.listTablesWithHttpInfo(TablesApi.java:428)
[error]     at io.unitycatalog.client.api.TablesApi.listTables(TablesApi.java:393)
[error]     at io.unitycatalog.cli.TableCli.listTables(TableCli.java:145)
[error]     at io.unitycatalog.cli.TableCli.handle(TableCli.java:45)
[error]     at io.unitycatalog.cli.UnityCatalogCli.main(UnityCatalogCli.java:136)
[error]     ... 76 more
[error] Caused by: java.io.IOException: closed
[error]     at jdk.internal.net.http.ResponseSubscribers$HttpResponseInputStream.current(ResponseSubscribers.java:448)
[error]     at jdk.internal.net.http.ResponseSubscribers$HttpResponseInputStream.read(ResponseSubscribers.java:503)
[error]     at com.fasterxml.jackson.core.json.ByteSourceJsonBootstrapper.ensureLoaded(ByteSourceJsonBootstrapper.java:547)
[error]     at com.fasterxml.jackson.core.json.ByteSourceJsonBootstrapper.detectEncoding(ByteSourceJsonBootstrapper.java:137)
[error]     at com.fasterxml.jackson.core.json.ByteSourceJsonBootstrapper.constructParser(ByteSourceJsonBootstrapper.java:266)
[error]     at com.fasterxml.jackson.core.JsonFactory._createParser(JsonFactory.java:1874)
[error]     at com.fasterxml.jackson.core.JsonFactory.createParser(JsonFactory.java:1273)
[error]     at com.fasterxml.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:3913)
[error]     at io.unitycatalog.client.api.TablesApi.listTablesWithHttpInfo(TablesApi.java:423)
[error]     ... 80 more
[error] Caused by: java.net.ProtocolException: protocol error: Frame type(108) length(7102818) exceeds MAX_FRAME_SIZE(16384)
[error]     at jdk.internal.net.http.Http2Connection.protocolError(Http2Connection.java:1229)
[error]     at jdk.internal.net.http.Http2Connection.processFrame(Http2Connection.java:833)
[error]     at jdk.internal.net.http.frame.FramesDecoder.decode(FramesDecoder.java:155)
[error]     at jdk.internal.net.http.Http2Connection$FramesController.processReceivedData(Http2Connection.java:240)
[error]     at jdk.internal.net.http.Http2Connection.asyncReceive(Http2Connection.java:770)
[error]     at jdk.internal.net.http.Http2Connection$Http2TubeSubscriber.processQueue(Http2Connection.java:1638)
[error]     at jdk.internal.net.http.common.SequentialScheduler$LockingRestartableTask.run(SequentialScheduler.java:205)
[error]     at jdk.internal.net.http.common.SequentialScheduler$CompleteRestartableTask.run(SequentialScheduler.java:149)
[error]     at jdk.internal.net.http.common.SequentialScheduler$SchedulableTask.run(SequentialScheduler.java:230)
[error]     at jdk.internal.net.http.common.SequentialScheduler.runOrSchedule(SequentialScheduler.java:303)
[error]     at jdk.internal.net.http.common.SequentialScheduler.runOrSchedule(SequentialScheduler.java:256)
[error]     at jdk.internal.net.http.Http2Connection$Http2TubeSubscriber.runOrSchedule(Http2Connection.java:1655)
[error]     at jdk.internal.net.http.Http2Connection$Http2TubeSubscriber.onNext(Http2Connection.java:1682)
[error]     at jdk.internal.net.http.Http2Connection.sendConnectionPreface(Http2Connection.java:1378)
[error]     at jdk.internal.net.http.Http2Connection.<init>(Http2Connection.java:415)
[error]     at jdk.internal.net.http.Http2Connection.lambda$createAsync$0(Http2Connection.java:432)
[error]     at jdk.internal.net.http.common.MinimalFuture.supply(MinimalFuture.java:65)
[error]     at jdk.internal.net.http.Http2Connection.createAsync(Http2Connection.java:431)
[error]     at jdk.internal.net.http.Exchange.lambda$checkForUpgradeAsync$14(Exchange.java:638)
[error]     at java.util.concurrent.CompletableFuture$UniCompose.tryFire(CompletableFuture.java:1150)
[error]     at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
[error]     at java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2147)
[error]     at jdk.internal.net.http.ResponseSubscribers.lambda$getBodyAsync$2(ResponseSubscribers.java:1174)
[error]     at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:863)
[error]     at java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:841)
[error]     at java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
[error]     at java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2147)
[error]     at jdk.internal.net.http.ResponseSubscribers$NullSubscriber.onComplete(ResponseSubscribers.java:713)
[error]     at jdk.internal.net.http.common.HttpBodySubscriberWrapper.complete(HttpBodySubscriberWrapper.java:293)
[error]     at jdk.internal.net.http.common.HttpBodySubscriberWrapper.onComplete(HttpBodySubscriberWrapper.java:401)
[error]     at jdk.internal.net.http.ResponseContent$FixedLengthBodyParser.onSubscribe(ResponseContent.java:568)
[error]     at jdk.internal.net.http.Http1Response$BodyReader.onSubscribe(Http1Response.java:674)
[error]     at jdk.internal.net.http.Http1AsyncReceiver.handlePendingDelegate(Http1AsyncReceiver.java:395)
[error]     at jdk.internal.net.http.Http1AsyncReceiver.flush(Http1AsyncReceiver.java:214)
[error]     at jdk.internal.net.http.common.SequentialScheduler$LockingRestartableTask.run(SequentialScheduler.java:205)
[error]     at jdk.internal.net.http.common.SequentialScheduler$CompleteRestartableTask.run(SequentialScheduler.java:149)
[error]     at jdk.internal.net.http.common.SequentialScheduler$TryEndDeferredCompleter.complete(SequentialScheduler.java:347)
[error]     at jdk.internal.net.http.common.SequentialScheduler$CompleteRestartableTask.run(SequentialScheduler.java:151)
[error]     at jdk.internal.net.http.common.SequentialScheduler$SchedulableTask.run(SequentialScheduler.java:230)
[error]     ... 3 more

Comment thread .github/workflows/unit-tests.yml Outdated

- name: Run tests with coverage
run: build/sbt -J-Xmx2G +jacoco
run: build/sbt -J-Xmx2G test

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seeing your other thread, +jacoco is actually running tests .. right?
then we shouldnt change this. this PR should not modify anything unrelated to integratoin tests style

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine, let me revert it.

@tdas tdas left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. thank you for fixing this!

@tdas
tdas merged commit 05da93a into unitycatalog:main Nov 5, 2025
openinx added a commit to openinx/unitycatalog that referenced this pull request Nov 13, 2025
**PR Checklist**

- [x] A description of the changes is added to the description of this
PR.
- [x] 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!
- [x] 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. -->](unitycatalog#1142)

---------

Signed-off-by: Zheng Hu <[email protected]>
@openinx openinx mentioned this pull request Nov 13, 2025
4 tasks done
tdas pushed a commit that referenced this pull request Nov 13, 2025
**PR Checklist**

- [x] A description of the changes is added to the description of this
PR.
- [x] 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!
- [x] If you've added or modified a feature, documentation in `docs` is
updated

**Description of changes**

Backport the [PR
change](#1149) of
#1142 to branch-0.3.
The whole backport process is here:
#1163

Signed-off-by: Zheng Hu <[email protected]>
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