Nikk8091 opened a new pull request, #12933:
URL: https://github.com/apache/seatunnel/pull/12933

   ### Purpose of this pull request
   
   Postgres CDC currently accepts an empty or whitespace-only `url` during 
factory validation. This change adds 
`Conditions.notBlank(JdbcCommonOptions.URL)` to its existing required URL rule 
so invalid values fail at the configuration boundary.
   
   Yes, I am contributing this focused improvement to Apache SeaTunnel. It 
implements the separate Postgres Source slice approved under #11007: 
https://github.com/apache/seatunnel/issues/11007#issuecomment-6168243222.
   
   The existing `base-url` fallback, canonical-key precedence, and nonblank 
values are preserved. The production change is limited to 
`PostgresIncrementalSourceFactory.optionRule()`; table selection, startup/stop 
modes, parsing, credentials, connections, retries, and runtime checks are 
unchanged. EN/ZH source documentation describes the nonblank requirement.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. For example, `url = "   "` now fails configuration validation instead 
of reaching runtime initialization. Missing URLs remain invalid, while nonblank 
values, including padded values and the existing fallback key, remain accepted 
without trimming or normalization.
   
   ### How was this patch tested?
   
   Extended the existing `PostgresSourceConfigFactoryTest` with the real 
factory rule through `ConfigValidator`, including unknown-key validation:
   
   - Canonical `url` and fallback `base-url`: valid and padded nonblank values 
accepted unchanged.
   - Both keys: empty, spaces-only, tab-only, newline-only, and 
mixed-whitespace values rejected.
   - Missing URL rejected.
   - Valid canonical URL takes precedence over a blank fallback.
   - Blank canonical URL rejected even if the fallback is valid.
   - Valid URL accepted with either `table-names` or `table-pattern`.
   
   Before adding the constraint, this test class ran 34 cases with 11 failures: 
all ten blank-value cases and the blank-canonical/valid-fallback case were 
incorrectly accepted. With the constraint, all 34 cases pass. The full Postgres 
CDC module passes **88 tests, 0 failures, 0 errors, 0 skipped**, and completes 
packaging/install.
   
   Also extended `PostgresCDCIT` with a Zeta `--check` case asserting a nonzero 
result and a URL/blank diagnostic for a whitespace-only source URL. It follows 
the existing SQL Server CDC configuration-check test pattern.
   
   Local checks used JDK 11:
   
   ```text
   mvn -pl seatunnel-connectors-v2/connector-cdc/connector-cdc-postgres -am 
-DskipTests install
   mvn -pl seatunnel-connectors-v2/connector-cdc/connector-cdc-postgres 
-Dtest=PostgresSourceConfigFactoryTest test
   mvn -pl 
seatunnel-connectors-v2/connector-cdc/connector-cdc-postgres,seatunnel-e2e/seatunnel-connector-v2-e2e/connector-cdc-postgres-e2e
 spotless:apply
   mvn -pl seatunnel-connectors-v2/connector-cdc/connector-cdc-postgres install
   git diff --check
   ```
   
   The integration-test prerequisite build is still running. Docker is 
unavailable in this environment, so the container test has not been executed 
locally. Full-repository verification and GitHub CI are not reported as passed.
   
   ### Check list
   
   - [x] EN/ZH source documentation updated.
   - [x] Regression and compatibility coverage added to the existing test class.
   - [x] Existing E2E suite extended with a configuration-check case.
   - No new dependency or binary was added.
   - Registration, distribution, CI labels, and plugin mapping are unchanged 
because this is an existing connector.
   - Valid option names, defaults, and configuration alternatives are preserved.
   


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