[Fix-17813][ApiServer] Correct the password processing logic during data source modification - #18387
[Fix-17813][ApiServer] Correct the password processing logic during data source modification#18387njnu-seafish wants to merge 10 commits into
Conversation
…ime connection checks
| ui-url: http://localhost:5173 | ||
| audit-enable: false | ||
| # Whether to test datasource connectivity before creating or updating a datasource. | ||
| datasource-connection-enable: false |
There was a problem hiding this comment.
You should add api-test or e2e-test to verify it.
There was a problem hiding this comment.
You should add
api-testore2e-testto 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
There was a problem hiding this comment.
You don't understand what I mean. You can take a look at dolphinscheduler-api-test and dolphinscheduler-e2e
There was a problem hiding this comment.
You don't understand what I mean. You can take a look at
dolphinscheduler-api-testanddolphinscheduler-e2e
thanks. I got it.
…nscheduler-api-test
Was this PR generated or assisted by AI?
YES. Optimize and refine the code using AI after writing it.
Purpose of the pull request
close #17813
Brief change log
Add backend configuration to control datasource connection checks on create and update
Verify this pull request
This pull request is code cleanup without any test coverage.
(or)
This pull request is already covered by existing tests, such as (please describe tests).
(or)
This change added tests and can be verified as follows:
(or)
Pull Request Notice
Pull Request Notice
If your pull request contains incompatible change, you should also add it to
docs/docs/en/guide/upgrade/incompatible.md