goutamadwant opened a new pull request, #12687:
URL: https://github.com/apache/seatunnel/pull/12687
### Purpose of this pull request
Related to #10681. This implements the MongoDB sink slice of Layer 1
connectivity validation without changing `DryRunConnectValidator` or the shared
validation interfaces.
The sink factory implements `SupportSinkDryRunValidation`. A short-lived
client sends `ping` against the configured database using primary read
preference, matching the sink's write destination.
The check:
- Preserves URI authentication, TLS and topology settings.
- Caps server selection, socket connection/read and connection-pool waits at
30 seconds each, retaining shorter positive values.
- Uses a pool of at most one connection per server.
- Closes the client on success and failure, preserves interruption and
avoids retaining driver exception details in validation errors.
- Does not create a writer, read documents, execute save modes or initialize
a transaction.
### Does this PR introduce _any_ user-facing change?
Yes, compared with current `dev`.
**Before:** MongoDB sink connectivity validation is reported as `SKIPPED`.
**After:** `--dry-run connect` checks connectivity and configured
credentials before job submission.
A missing database or collection is allowed and is not created. Validation
does not establish collection existence, schema compatibility, write
permissions or transaction support. Without configured credentials, successful
`ping` proves connectivity only—even when writes require authentication.
Timeout limits apply to individual waits, not a single overall deadline; DNS
resolution can take additional time.
Normal job execution, save-mode behavior and existing configuration defaults
are unchanged. No new dependencies or public API changes are introduced.
MongoDB source validation remains outside this PR.
English and Chinese documentation describe the contract and its limitations.
### How was this patch tested?
The new capability test failed against the unchanged factory before
implementation.
Validated on both Java 8 and Java 11:
- MongoDB connector: 32 unit tests passed.
- Focused container-backed MongoDB integration tests: 4 passed.
- Shared API and connector-common suites: 407 tests passed per Java version.
Coverage includes URI setting preservation, primary selection, timeout
limits, client cleanup, interruption, sanitized failures, authentication with a
user without data privileges, missing targets and unchanged documents across
save modes.
An additional integration regression runs normal sink execution after
dry-run and verifies append, drop-data and error-when-data-exists behavior.
With the required project dependencies installed:
```bash
mvn -B -ntp -pl seatunnel-connectors-v2/connector-mongodb clean install
mvn -B -ntp \
-pl seatunnel-e2e/seatunnel-connector-v2-e2e/connector-mongodb-e2e \
clean -DskipUT -DskipIT=false \
'-Dit.test=MongodbIT#testSinkDryRun*' verify
```
Formatting and packaging verification passed for the connector and its
integration-test module. The full repository and multi-engine integration
matrix were not run.
### Check list
- [x] New Jar binary packages and license notices checked: no new
dependencies.
- [x] English and Chinese connector documentation and dry-run support
matrices updated.
- [x] Incompatible changes checked: normal execution and configuration
contracts are unchanged; dry-run limitations are documented.
- [x] Connector integration requirements checked:
1. `plugin-mapping.properties`: unchanged; existing connector.
2. `seatunnel-dist/pom.xml`: unchanged; existing connector.
3. CI label configuration: unchanged; existing connector.
4. Existing MongoDB integration-test class extended.
5. `config/plugin_config`: unchanged; existing connector.
--
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]