david-streamlio opened a new pull request, #104:
URL: https://github.com/apache/pulsar-connectors/pull/104

   Fixes #51
   
   ### Motivation
   
   The HBase sink had only a mock-based unit test 
(`HbaseGenericRecordSinkTest`); nothing exercised it against a real HBase 
server. This adds the first integration test, verified green on a Linux x86-64 
host.
   
   ### Modifications
   
   - Add `HbaseGenericRecordSinkIntegrationTest`: starts an all-in-one HBase 
container (`harisekhon/hbase:2.1`) via Testcontainers, creates the table, 
writes a record through `HbaseGenericRecordSink`, polls until the background 
flush lands, and reads the row back with the HBase client. A never-written row 
is asserted absent as a non-vacuous guard.
   - Add `testImplementation(libs.testcontainers)` to `hbase/build.gradle.kts`.
   
   The test uses host networking, which works on Linux only: HBase's 
RegionServer advertises its own host/port through ZooKeeper and the client 
dials it directly, so the advertised address must be reachable from the test 
JVM. The all-in-one HBase images are also amd64-only. Depends on the 
opentelemetry-semconv pin from #102 (already merged); without it the sink 
throws `NoClassDefFoundError` on its first HBase call.
   
   ### Verifying this change
   
   Run on Linux x86-64 (Ubuntu 24.04, Docker 29.1.3, OpenJDK 21):
   
   ```
   $ ./gradlew :hbase:test --tests "*HbaseGenericRecordSinkIntegrationTest" 
--rerun-tasks
   
   Gradle suite > Gradle test > 
org.apache.pulsar.io.hbase.sink.HbaseGenericRecordSinkIntegrationTest > 
testWriteRecordIsPersistedToHbase PASSED
   
   BUILD SUCCESSFUL in 36s
   ```
   
   Mutation check (test is not vacuous): with the read-back assertion 
deliberately broken, the test fails against the value actually stored in HBase, 
then passes again after reverting:
   
   ```
   Gradle suite > Gradle test > 
org.apache.pulsar.io.hbase.sink.HbaseGenericRecordSinkIntegrationTest > 
testWriteRecordIsPersistedToHbase FAILED
       java.lang.AssertionError: expected [WRONG_value_mutation_check] but 
found [name_value]
   ```
   
   ### Documentation
   
   - [x] `doc-not-needed` (test-only change)
   


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