You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "SEPURI-SAI-KRISHNA (via GitHub)" <gi...@apache.org> on 2026/09/23 07:48:19 UTC
[PR] [Test][Connector-V2] Cover the MqttSink serialization boundary [seatunnel]
SEPURI-SAI-KRISHNA opened a new pull request, #12455:
URL: https://github.com/apache/seatunnel/pull/12455
### Purpose of this pull request
Two leftovers from the #12416 review, deliberately in one PR rather than two after @davidzollo asked me to consolidate on that thread.
**1. `MqttSink` has no Java serialization coverage** (#12416 Issue 2, raised by @DanielLeens).
`SeaTunnelSink` extends `Serializable`, so `MqttSink` crosses the same logical DAG boundary as `MqttSource`. That boundary is where a missing field stops a job being submitted at all, which is exactly what a user hit in #12405 and #12406 fixed on the source side. The source now has round trip coverage from #12410, #12416 and #12436. The sink had none.
`MqttSinkTest` asserts the catalog table survives by table id and schema, then builds a writer from the restored sink. `pluginConfig` and `seaTunnelRowType` have no getters, so the writer is the only way to observe them: `MqttSinkWriter`'s constructor reads `topic`, `qos`, `batch_size` and `url` from the config and derives its serializer from the row type. `MqttClient` construction is mocked, because that constructor also connects and would otherwise reach `tcp://localhost:1883` from a unit test, the same approach `MqttSinkWriterTest` already uses.
A second case pins a value rather than a reference, which is the gap @SEZ9 flagged on the source side in #12436. `qos = 2` is rejected by `MqttSinkWriter` but not by `MqttSink`, so the sink builds and only a writer surfaces it. `MqttSinkOptions.QOS` defaults to `1`, so a `pluginConfig` that came back empty would yield a legal qos and the writer would build without complaint; the rejection only happens if the `2` actually travelled.
**2. A comment I got wrong in #12436** (#12436 Issue 1, raised by @DanielLeens).
`MqttSourceTest` said `max_queue_size` defaults to 2048. `MqttSourceOptions.MAX_QUEUE_SIZE.defaultValue` is `1000`. 2048 is the engine's intermediate queue size and has nothing to do with this option; I carried it over by mistake.
### On adding a new test class
`AGENTS.md` asks not to create test classes casually. There is no existing class that owns `MqttSink`: `MqttSinkFactoryTest` covers the factory's option rule and `MqttSinkWriterTest` covers the writer. This mirrors `MqttSourceTest` on the source side rather than bolting sink-level assertions onto a writer-level class. Happy to fold it into `MqttSinkWriterTest` instead if reviewers prefer, though note #11461 is open against that file.
### Does this PR introduce _any_ user-facing change?
No. One new test class and one comment line. `MqttSink`, `MqttSinkWriter`, `MqttSource`, `MqttSourceConfig` and `MqttSourceReader` are byte-identical to `dev`.
### How was this patch tested?
```
./mvnw -pl seatunnel-connectors-v2/connector-mqtt test
Tests run: 36, Failures: 0, Errors: 0, Skipped: 0
```
`spotless:check` is green.
Each of `MqttSink`'s three fields marked `transient` in turn:
| Field made transient | Result |
|---|---|
| `pluginConfig` | both tests fail |
| `seaTunnelRowType` | `testSinkIsJavaSerializable` fails |
| `catalogTable` | `testSinkIsJavaSerializable` fails |
3 of 3 caught.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Test][Connector-V2] Cover the MqttSink serialization boundary [seatunnel]
Posted by "SEPURI-SAI-KRISHNA (via GitHub)" <gi...@apache.org>.
SEPURI-SAI-KRISHNA commented on PR #12455:
URL: https://github.com/apache/seatunnel/pull/12455#issuecomment-5794690994
Thanks @DanielLeens. You are right that the wrapper is unused in that test, and I checked rather than assuming: `MqttSinkWriter`'s constructor reads `qos` and throws at the fourth statement, while `new MqttClient(...)` is well below that, so the mock is never exercised on the path the test takes.
It was deliberate but undocumented, which is the actual problem. The reasoning was that the qos check sits above the connect only by convention, and if it ever moved below it the test would stop failing on the assertion and start reaching `tcp://localhost:1883` from a unit test. Keeping the wrapper makes that reordering harmless. That belonged in a comment rather than in my head, so the criticism lands either way.
On timing: this PR is green right now, which has been unusually hard to come by on Windows this week, so I would rather not reset CI for a comment. If you would like it changed I will fold it in the moment anything else needs a push here, and my preference would be to annotate rather than drop, for the reason above. Equally happy to drop it if you would rather the test only mock what it uses.
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] [Test][Connector-V2] Cover the MqttSink serialization boundary [seatunnel]
Posted by "davidzollo (via GitHub)" <gi...@apache.org>.
davidzollo merged PR #12455:
URL: https://github.com/apache/seatunnel/pull/12455
--
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: commits-unsubscribe@seatunnel.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org