njnu-seafish commented on code in PR #18387:
URL: 
https://github.com/apache/dolphinscheduler/pull/18387#discussion_r3611766483


##########
dolphinscheduler-api-test/dolphinscheduler-api-test-case/src/test/resources/docker/oidc-login/application.yaml:
##########
@@ -162,6 +162,8 @@ api:
   base-url: http://localhost:12345/dolphinscheduler
   ui-url: http://localhost:5173
   audit-enable: false
+  # Whether to test datasource connectivity before creating or updating a 
datasource.
+  datasource-connection-enable: false

Review Comment:
   > You should add `api-test` or `e2e-test` to verify it.
   
   OK, add some test case.
   
   Test Coverage Summary for api.datasource-connection-enable Configuration
   
   This configuration controls whether the system tests data source 
connectivity before creating or updating a data source. The test suite covers 
both controller-level (API) and service-level scenarios.
   
   **Controller Layer Tests ( DataSourceControllerTest.java )**:
   - testDatasourceConnectionEnableDefaultValue() - Verifies that the 
configuration defaults to false
   - testCreateDataSourceWithMockedService() - Tests successful data source 
creation API flow with valid connection parameters
   - testUpdateDataSourceWithMockedService() - Tests successful data source 
update API flow with valid connection parameters
   - testCreateDataSourceConnectionCheckDisabled() - Tests that data source 
creation succeeds even with invalid host when connection check is disabled 
(default behavior)
   - testUpdateDataSourceConnectionCheckDisabled() - Tests that data source 
update succeeds even with invalid host when connection check is disabled 
(default behavior)
   
   
   **Service Layer Tests ( DataSourceServiceTest.java ):**
   - createDataSourceChecksConnectionWhenConfigured() - Verifies connection 
validation occurs when datasource-connection-enable=true during creation
   - updateDataSourceChecksConnectionWhenConfigured() - Verifies connection 
validation occurs when datasource-connection-enable=true during update
   - dataSourceDoesNotCheckConnectionByDefault() - Verifies connection 
validation is skipped when datasource-connection-enable=false
   
   **Test Strategy** 
   - Controller tests use MockBean to isolate the service layer and verify HTTP 
request/response handling
   - Service tests use Mockito to simulate connection success/failure scenarios 
and verify business logic
   - The default configuration ( api.datasource-connection-enable: false ) is 
set in application.yaml
   
   **Verification Scope :**
   - Configuration property parsing and injection
   - API endpoint behavior under different configuration states
   - Connection validation logic conditional execution
   - Error handling when connection check fails (service layer)
   - Success path when connection check is disabled



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to