david-streamlio commented on PR #79:
URL: https://github.com/apache/pulsar-connectors/pull/79#issuecomment-4930144608
Good catch — a fix for a user-facing crash with no test guarding it is how
this bug survived in the first place. Added
`DynamoDBSourceConfigClientBuilderTest` (unit, no containers or network)
covering exactly what you asked for:
- `testBuildersDoNotThrowWhenEndpointAndRegionAreBothSet` — constructs all
three clients with an endpoint **and** the mandatory region; construction
itself is the assertion.
- `testEachBuilderSelectsItsOwnEndpoint` — asserts each client resolves to
its **intended** endpoint field (`awsEndpoint` → Streams, `dynamoEndpoint` →
DynamoDB, `cloudwatchEndpoint` → CloudWatch), read back from the SDK's resolved
endpoint rather than inferred.
- `testAwsEndpointAloneDoesNotLeakIntoTheOtherClients` — pins the second
defect: setting `awsEndpoint` alone must leave the DynamoDB and CloudWatch
clients on their regional default endpoints instead of building one from an
empty string.
- `testRegionOnlyUsesRegionalEndpoints` — pins the unaffected common case
(no endpoint override, real AWS).
Verified they actually catch the bug rather than just passing alongside the
fix. Reverting `DynamoDBSourceConfig` to the `master` version makes **three of
the four fail** with the original exception:
```
testBuildersDoNotThrowWhenEndpointAndRegionAreBothSet FAILED
java.lang.IllegalStateException: Only one of Region or
EndpointConfiguration may be set.
testEachBuilderSelectsItsOwnEndpoint FAILED
java.lang.IllegalStateException: Only one of Region or
EndpointConfiguration may be set.
testAwsEndpointAloneDoesNotLeakIntoTheOtherClients FAILED
java.lang.IllegalStateException: Only one of Region or
EndpointConfiguration may be set.
```
`testRegionOnlyUsesRegionalEndpoints` passes either way, as it should — it
covers the path the bug never touched.
With the fix restored, the full `:dynamodb:test` suite is green. End-to-end
coverage against a real endpoint lands separately in #77, whose LocalStack test
cannot run without this fix.
--
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]