[improve][test] Add HBase sink integration test#104
Merged
david-streamlio merged 2 commits intoJul 10, 2026
Conversation
Fixes apache#51 Add the first integration test for the HBase sink, HbaseGenericRecordSinkIntegrationTest. It starts an all-in-one HBase container (harisekhon/hbase:2.1) via Testcontainers, creates the table, writes a record through HbaseGenericRecordSink, polls until the flush lands, and reads the row back with the HBase client. A never-written row is asserted absent as a non-vacuous guard. 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 images are also amd64-only. Depends on the opentelemetry-semconv pin from apache#102 (already merged); without it the sink throws NoClassDefFoundError on the first HBase call.
Contributor
There was a problem hiding this comment.
Pull request overview
Adds the first real integration coverage for the HBase sink connector by exercising HbaseGenericRecordSink against a Testcontainers-managed HBase instance, validating that written records are actually persisted and readable via the HBase client.
Changes:
- Added
HbaseGenericRecordSinkIntegrationTestthat boots an HBase container, creates the target table, writes a record via the sink, and reads it back to assert persisted values. - Added a non-vacuous guard assertion ensuring an unwritten row is absent.
- Added
testImplementation(libs.testcontainers)to thehbasemodule.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
hbase/src/test/java/org/apache/pulsar/io/hbase/sink/HbaseGenericRecordSinkIntegrationTest.java |
New Testcontainers-backed integration test that writes through the sink and reads back via HBase client. |
hbase/build.gradle.kts |
Adds the Testcontainers dependency required by the new integration test. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+99
to
+106
| public void setUp() throws Exception { | ||
| // Host networking (Linux only): binds HBase's ports on localhost so the RegionServer address | ||
| // advertised through ZooKeeper is reachable from this JVM. | ||
| hbase = new GenericContainer<>(HBASE_IMAGE) | ||
| .withNetworkMode("host") | ||
| .waitingFor(Wait.forLogMessage(".*Master has completed initialization.*", 1)) | ||
| .withStartupTimeout(Duration.ofMinutes(4)); | ||
| hbase.start(); |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
HbaseGenericRecordSinkIntegrationTest: starts an all-in-one HBase container (harisekhon/hbase:2.1) via Testcontainers, creates the table, writes a record throughHbaseGenericRecordSink, 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.testImplementation(libs.testcontainers)tohbase/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
NoClassDefFoundErroron its first HBase call.Verifying this change
Run on Linux x86-64 (Ubuntu 24.04, Docker 29.1.3, OpenJDK 21):
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:
Documentation
doc-not-needed(test-only change)