Skip to content

Conversation

@wuxiansen
Copy link
Contributor

Fix logs Basic issue

Contribution Checklist

Purpose of this pull request

This pull request supplements test cases for fixing basic log-related issues, ensuring that the logging functionality works correctly in scenarios where HTTP Basic authentication is enabled. By adding the RestApiHttpBasicTest test class, it verifies the correctness of log-related REST API responses with Basic authentication, including interface accessibility, response format, and content integrity, further ensuring the stability of the logging feature.

Does this PR introduce any user-facing change?

No. The added test cases are solely for internal functional verification and do not involve changes to user-visible behaviors, configuration methods, or output results. They have no impact on user workflows.

How was this patch tested?

  1. New test cases: The RestApiHttpBasicTest class was implemented to specifically test the behavior of log-related REST APIs when HTTP Basic authentication is enabled, including:
    Verifying that the /overview endpoint returns a 200 OK status and contains necessary fields (e.g., projectVersion) with valid authentication.
    Testing the /logs endpoint with different formats (e.g., JSON) to check for non-empty responses, correct status codes, and expected Content-Type headers.
    Simulating job submission and validating that the log endpoint correctly returns job log information.

  2. Test environment: A test cluster was set up using Hazelcast in local mode, with HTTP port and Basic authentication credentials (username admin, password admin) configured to match real-world scenarios.

  3. Execution method: Tests were run using JUnit 5 to automatically verify interface behavior. All assertions passing indicate that the functionality works as expected.

Check list

dayan1852 added 2 commits October 20, 2025 14:27
Fix logs Basic issue
@wuxiansen wuxiansen changed the title # 9755 [Fix] logs Basic issue # 9755 Oct 20, 2025
@wuxiansen
Copy link
Contributor Author

wuxiansen commented Oct 20, 2025

@hailin0 @davidzollo Hello, can you help me take a look at this PR?

@wuxiansen wuxiansen changed the title [Fix] logs Basic issue # 9755 [Fix] logs http basic issue # 9755 Oct 20, 2025
dayan1852 added 3 commits October 20, 2025 16:04
Modify code style
Modify DisabledOnOs OS.WINDOWS
@wuxiansen
Copy link
Contributor Author

@hailin0 @davidzollo Hello, can you help me take a look at this PR?

I only fix a certain piece of content, and the other module code has not changed. Why do module test cases that have not changed keep compiling fail?

PTAL

image image

@dybyte
Copy link
Contributor

dybyte commented Oct 28, 2025

I only fix a certain piece of content, and the other module code has not changed. Why do module test cases that have not changed keep compiling fail?

Please pull the latest changes and try again.

@wuxiansen
Copy link
Contributor Author

I only fix a certain piece of content, and the other module code has not changed. Why do module test cases that have not changed keep compiling fail?

Please pull the latest changes and try again.

Executing the failures one by one can be done .

@liucongjy @zhangshenghang

BaseServletTest.testWriteJsonWithObject can pass the test locally, but why can't it pass in actions?

PTAL

image image image
[INFO] 
[INFO] Results:
[INFO] 
Error:  Failures: 
Error:    BaseServletTest.testWriteJsonWithObject:71->testLogRestApiResponse:147 expected: <200> but was: <401>
Error:  Errors: 
Error:    RestApiHttpsForTruststoreTest.testRestApiHttps:136 » IO Server returned HTTP r...
Error:    RestApiHttpsTest.testRestApiHttp:88 » IO Server returned HTTP response code: 4...
Error:    RestApiHttpsTest.testRestApiHttps:109 » IO Server returned HTTP response code:...
[INFO] 
Error:  Tests run: 96, Failures: 1, Errors: 3, Skipped: 6
[INFO] 

https://github.com/wuxiansen/seatunnel/actions/runs/18870236917/job/53957365698

dayan1852 added 2 commits October 30, 2025 12:49
ConfigProvider.locateAndGetSeaTunnelConfig() single-case , Use case is reset later
@wuxiansen
Copy link
Contributor Author

I only fix a certain piece of content, and the other module code has not changed. Why do module test cases that have not changed keep compiling fail?

Please pull the latest changes and try again.

Executing the failures one by one can be done .

@liucongjy @zhangshenghang

BaseServletTest.testWriteJsonWithObject can pass the test locally, but why can't it pass in actions?

PTAL

image image image

[INFO] 
[INFO] Results:
[INFO] 
Error:  Failures: 
Error:    BaseServletTest.testWriteJsonWithObject:71->testLogRestApiResponse:147 expected: <200> but was: <401>
Error:  Errors: 
Error:    RestApiHttpsForTruststoreTest.testRestApiHttps:136 » IO Server returned HTTP r...
Error:    RestApiHttpsTest.testRestApiHttp:88 » IO Server returned HTTP response code: 4...
Error:    RestApiHttpsTest.testRestApiHttps:109 » IO Server returned HTTP response code:...
[INFO] 
Error:  Tests run: 96, Failures: 1, Errors: 3, Skipped: 6
[INFO] 

https://github.com/wuxiansen/seatunnel/actions/runs/18870236917/job/53957365698

I seem to have found the problem. The setUP method is a bit confusing, making people think that each test class is independent, but in fact it is not. ConfigProvider.locateAndGetSeaTunnelConfig() single-case, unified management through org.apache.seatunnel.engine.common.config.YamlSeaTunnelDomConfigProcessor. as it happens
The newly added RestApiHttpBasicTest class is executed first, as can be seen from the following log.

Oct 30, 2025 5:21:59 AM com.hazelcast.internal.server.tcp.TcpServerConnection
INFO: [localhost]:5801 [runner_CoordinatorServiceTest_testCleanPendingJobMasterMap] [5.1] Connection[id=13, /127.0.0.1:5801->/127.0.0.1:37651, qualifier=null, endpoint=[localhost]:5803, remoteUuid=048f417e-3de9-4ff1-a253-e33d2ba479a8, alive=false, connectionType=MEMBER, planeIndex=0] closed. Reason: Connection closed by the other side
org.apache.seatunnel.engine.common.loader.SeaTunnelChildFirstClassLoader@2759114
[INFO] Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 2.807 s - in org.apache.seatunnel.engine.server.rest.RestApiHttpBasicTest
[INFO] Running org.apache.seatunnel.engine.server.rest.RestApiHttpsForTruststoreTest
Oct 30, 2025 5:22:01 AM com.hazelcast.internal.config.AbstractConfigLocator
INFO: Loading configuration '/home/runner/work/seatunnel/seatunnel/seatunnel-engine/seatunnel-engine-server/src/test/resources/seatunnel.yaml' from System property 'seatunnel.config'

...

Oct 30, 2025 5:22:02 AM com.hazelcast.internal.server.tcp.TcpServerConnection
INFO: [localhost]:5801 [runner_CoordinatorServiceTest_testCleanPendingJobMasterMap] [5.1] Connection[id=15, /127.0.0.1:5801->/127.0.0.1:43985, qualifier=null, endpoint=[localhost]:5804, remoteUuid=92d3d57e-c593-42cd-a4f6-6cea21527200, alive=false, connectionType=MEMBER, planeIndex=0] closed. Reason: Connection closed by the other side
org.apache.seatunnel.engine.common.loader.SeaTunnelChildFirstClassLoader@2759114
Error:  Tests run: 4, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 2.586 s <<< FAILURE! - in org.apache.seatunnel.engine.server.rest.RestApiHttpsForTruststoreTest
Error:  testRestApiHttps  Time elapsed: 0.124 s  <<< ERROR!
java.io.IOException: Server returned HTTP response code: 401 for URL: https://localhost:18443/overview
	at org.apache.seatunnel.engine.server.rest.RestApiHttpsForTruststoreTest.testRestApiHttps(RestApiHttpsForTruststoreTest.java:136)

[INFO] Running org.apache.seatunnel.engine.server.rest.RestApiHttpsTest
Oct 30, 2025 5:22:03 AM com.hazelcast.internal.config.AbstractConfigLocator
INFO: Loading configuration '/home/runner/work/seatunnel/seatunnel/seatunnel-engine/seatunnel-engine-server/src/test/resources/seatunnel.yaml' from System property 'seatunnel.config'

...

Oct 30, 2025 5:22:05 AM com.hazelcast.internal.server.tcp.TcpServerConnection
INFO: [localhost]:5801 [runner_CoordinatorServiceTest_testCleanPendingJobMasterMap] [5.1] Connection[id=17, /127.0.0.1:5801->/127.0.0.1:36841, qualifier=null, endpoint=[localhost]:5805, remoteUuid=6f488a61-6344-43da-9a6c-3070b4321d7e, alive=false, connectionType=MEMBER, planeIndex=0] closed. Reason: Connection closed by the other side
org.apache.seatunnel.engine.common.loader.SeaTunnelChildFirstClassLoader@2759114
Oct 30, 2025 5:22:05 AM org.apache.seatunnel.engine.server.CoordinatorService
INFO: [localhost]:5801 [runner_CoordinatorServiceTest_testCleanPendingJobMasterMap] [5.1] 
Error:  Tests run: 3, Failures: 0, Errors: 2, Skipped: 0, Time elapsed: 2.293 s <<< FAILURE! - in org.apache.seatunnel.engine.server.rest.RestApiHttpsTest
Error:  testRestApiHttps  Time elapsed: 0.036 s  <<< ERROR!
java.io.IOException: Server returned HTTP response code: 401 for URL: https://localhost:28443/overview
	at org.apache.seatunnel.engine.server.rest.RestApiHttpsTest.testRestApiHttps(RestApiHttpsTest.java:109)

Error:  testRestApiHttp  Time elapsed: 0.005 s  <<< ERROR!
java.io.IOException: Server returned HTTP response code: 401 for URL: http://localhost:28080/overview
	at org.apache.seatunnel.engine.server.rest.RestApiHttpsTest.testRestApiHttp(RestApiHttpsTest.java:88)

[INFO] Running org.apache.seatunnel.engine.server.rest.BaseServletTest
Oct 30, 2025 5:22:06 AM com.hazelcast.internal.config.AbstractConfigLocator
INFO: Loading configuration '/home/runner/work/seatunnel/seatunnel/seatunnel-engine/seatunnel-engine-server/src/test/resources/seatunnel.yaml' from System property 'seatunnel.config'
Oct 30, 2025 5:22:06 AM com.hazelcast.internal.config.AbstractConfigLocator
INFO: Using configuration file at /home/runner/work/seatunnel/seatunnel/seatunnel-engine/seatunnel-engine-server/src/test/resources/seatunnel.yaml
Oct 30, 2025 5:22:06 AM org.apache.seatunnel.engine.common.config.YamlSeaTunnelDomConfigProcessor
INFO: Dynamic slot is enabled, the schedule strategy is set to REJECT
Oct 30, 2025 5:22:06 AM com.hazelcast.internal.config.AbstractConfigLocator
INFO: Loading 'hazelcast.yaml' from the classpath.
Oct 30, 2025 5:22:06 AM com.hazelcast.internal.config.AbstractConfigLocator
INFO: Loading configuration '/home/runner/work/seatunnel/seatunnel/seatunnel-engine/seatunnel-engine-server/src/test/resources/seatunnel.yaml' from System property 'seatunnel.config'

...

Error:  Tests run: 2, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 2.349 s <<< FAILURE! - in org.apache.seatunnel.engine.server.rest.BaseServletTest
Error:  testWriteJsonWithObject  Time elapsed: 0.027 s  <<< FAILURE!
org.opentest4j.AssertionFailedError: expected: <200> but was: <401>
	at org.apache.seatunnel.engine.server.rest.BaseServletTest.testLogRestApiResponse(BaseServletTest.java:147)
	at org.apache.seatunnel.engine.server.rest.BaseServletTest.testWriteJsonWithObject(BaseServletTest.java:71)

[INFO] Running org.apache.seatunnel.engine.server.CoordinatorServiceWithCancelPendingJobTest
Oct 30, 2025 5:22:08 AM com.hazelcast.internal.config.AbstractConfigLocator
INFO: Loading configuration '/home/runner/work/seatunnel/seatunnel/seatunnel-engine/seatunnel-engine-server/src/test/resources/seatunnel.yaml' from System property 'seatunnel.config'
Oct 30, 2025 5:22:08 AM com.hazelcast.internal.config.AbstractConfigLocator
INFO: Using configuration file at /home/runner/work/seatunnel/seatunnel/seatunnel-engine/seatunnel-engine-server/src/test/resources/seatunnel.yaml
Oct 30, 2025 5:22:08 AM org.apache.seatunnel.engine.common.config.YamlSeaTunnelDomConfigProcessor
INFO: Dynamic slot is enabled, the schedule strategy is set to REJECT
Oct 30, 2025 5:22:08 AM com.hazelcast.internal.config.AbstractConfigLocator
INFO: Loading 'hazelcast.yaml' from the classpath.
Oct 30, 2025 5:22:08 AM com.hazelcast.internal.config.AbstractConfigLocator
INFO: Loading configuration '/home/runner/work/seatunnel/seatunnel/seatunnel-engine/seatunnel-engine-server/src/test/resources/seatunnel.yaml' from System property 'seatunnel.config'

Local reproduction is reproduced by using the following command:

 mvn -pl seatunnel-engine/seatunnel-engine-server test -Dtest=RestApiHttpBasicTest,BaseServletTest,RestApiHttpsTest,RestApiHttpsForTruststoreTest -DfailIfNoTests=false

Solution: After setting RestApiHttpBasicTest, use AfterAll to clean up the Basic configuration.

PR

# Conflicts:
#	seatunnel-engine/seatunnel-engine-server/src/main/java/org/apache/seatunnel/engine/server/rest/service/LogService.java
@wuxiansen
Copy link
Contributor Author

I only fix a certain piece of content, and the other module code has not changed. Why do module test cases that have not changed keep compiling fail?

Please pull the latest changes and try again.

Use case execution is completed. I re-executed it several times, and the redis test case has a high probability of failure. I re-executed it many times, but luckily it finally worked.

PTAL

@wuxiansen
Copy link
Contributor Author

I only fix a certain piece of content, and the other module code has not changed. Why do module test cases that have not changed keep compiling fail?

Please pull the latest changes and try again.

Use case execution is completed. I re-executed it several times, and the redis test case has a high probability of failure. I re-executed it many times, but luckily it finally worked.

PTAL

I’ve been keeping an eye on it lately, and it doesn’t seem like there’s been much progress. If you have any ideas or think we need to make adjustments, we can talk it through together. 🤝

@dybyte
Copy link
Contributor

dybyte commented Nov 4, 2025

I only fix a certain piece of content, and the other module code has not changed. Why do module test cases that have not changed keep compiling fail?

Please pull the latest changes and try again.

Use case execution is completed. I re-executed it several times, and the redis test case has a high probability of failure. I re-executed it many times, but luckily it finally worked.
PTAL

I’ve been keeping an eye on it lately, and it doesn’t seem like there’s been much progress. If you have any ideas or think we need to make adjustments, we can talk it through together. 🤝

I’ve opened a PR addressing the flaky Redis tests. #10024
Thanks for reporting this issue!

@dybyte
Copy link
Contributor

dybyte commented Nov 5, 2025

cc @zhangshenghang @hawk9821 — could you please take a look when you have a moment?

Copy link
Contributor

@dybyte dybyte left a comment

Choose a reason for hiding this comment

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

Thanks @wuxiansen

dayan1852 added 2 commits November 6, 2025 15:42
wuxiansen and others added 2 commits November 6, 2025 17:20
…che/seatunnel/engine/server/rest/RestApiHttpBasicTest.java

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

@dybyte dybyte left a comment

Choose a reason for hiding this comment

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

LGTM if CI passes. Thanks @wuxiansen

Copy link
Member

@zhangshenghang zhangshenghang left a comment

Choose a reason for hiding this comment

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

LGTM, If CI pass

@corgy-w corgy-w merged commit b1a4be9 into apache:dev Nov 8, 2025
6 checks passed
@wuxiansen wuxiansen deleted the feature-9755 branch November 9, 2025 03:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants