This is an automated email from the ASF dual-hosted git repository. ppalaga pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/camel-quarkus.git
The following commit(s) were added to refs/heads/master by this push: new 042a1d0 Replace hbase-testing-util with docker container #2295 042a1d0 is described below commit 042a1d06ff38a4573564d27a417cb7da14afd141 Author: JiriOndrusek <ondrusek.j...@gmail.com> AuthorDate: Thu Mar 25 11:00:56 2021 +0100 Replace hbase-testing-util with docker container #2295 --- extensions-jvm/hbase/integration-test/pom.xml | 4 +- .../src/main/resources/hbase-site.xml | 110 +-------------------- .../component/hbase/it/HBaseTestResource.java | 34 ++++--- .../quarkus/component/hbase/it/HbaseTest.java | 2 - 4 files changed, 24 insertions(+), 126 deletions(-) diff --git a/extensions-jvm/hbase/integration-test/pom.xml b/extensions-jvm/hbase/integration-test/pom.xml index d843193..523b678 100644 --- a/extensions-jvm/hbase/integration-test/pom.xml +++ b/extensions-jvm/hbase/integration-test/pom.xml @@ -90,8 +90,8 @@ <scope>test</scope> </dependency> <dependency> - <groupId>org.apache.hbase</groupId> - <artifactId>hbase-testing-util</artifactId> + <groupId>org.testcontainers</groupId> + <artifactId>testcontainers</artifactId> <scope>test</scope> </dependency> <dependency> diff --git a/extensions-jvm/hbase/integration-test/src/main/resources/hbase-site.xml b/extensions-jvm/hbase/integration-test/src/main/resources/hbase-site.xml index 710ce57..90293e1 100644 --- a/extensions-jvm/hbase/integration-test/src/main/resources/hbase-site.xml +++ b/extensions-jvm/hbase/integration-test/src/main/resources/hbase-site.xml @@ -20,115 +20,7 @@ <?xml-stylesheet type="text/xsl" href="configuration.xsl"?> <configuration> <property> - <name>hbase.regionserver.msginterval</name> - <value>1000</value> - <description>Interval between messages from the RegionServer to HMaster - in milliseconds. Default is 15. Set this value low if you want unit - tests to be responsive. - </description> - </property> - <property> - <name>hbase.client.pause</name> - <value>5000</value> - <description>General client pause value. Used mostly as value to wait - before running a retry of a failed get, region lookup, etc.</description> - </property> - <property> - <name>hbase.master.meta.thread.rescanfrequency</name> - <value>10000</value> - <description>How long the HMaster sleeps (in milliseconds) between scans of - the root and meta tables. - </description> - </property> - <property> - <name>hbase.server.thread.wakefrequency</name> - <value>1000</value> - <description>Time to sleep in between searches for work (in milliseconds). - Used as sleep interval by service threads such as META scanner and log roller. - </description> - </property> - <property> - <name>hbase.regionserver.handler.count</name> - <value>5</value> - <description>Count of RPC Server instances spun up on RegionServers - Same property is used by the HMaster for count of master handlers. - Default is 10. - </description> - </property> - <property> - <name>hbase.master.lease.period</name> - <value>6000</value> - <description>Length of time the master will wait before timing out a region - server lease. Since region servers report in every second (see above), this - value has been reduced so that the master will notice a dead region server - sooner. The default is 30 seconds. - </description> - </property> - <property> - <name>hbase.master.info.port</name> - <value>-1</value> - <description>The port for the hbase master web UI - Set to -1 if you do not want the info server to run. - </description> - </property> - <property> - <name>hbase.regionserver.info.port</name> - <value>-1</value> - <description>The port for the hbase regionserver web UI - Set to -1 if you do not want the info server to run. - </description> - </property> - <property> - <name>hbase.regionserver.info.port.auto</name> - <value>true</value> - <description>Info server auto port bind. Enables automatic port - search if hbase.regionserver.info.port is already in use. - Enabled for testing to run multiple tests on one machine. - </description> - </property> - <property> - <name>hbase.master.lease.thread.wakefrequency</name> - <value>3000</value> - <description>The interval between checks for expired region server leases. - This value has been reduced due to the other reduced values above so that - the master will notice a dead region server sooner. The default is 15 seconds. - </description> - </property> - <property> - <name>hbase.regionserver.optionalcacheflushinterval</name> - <value>10000</value> - <description> - Amount of time to wait since the last time a region was flushed before - invoking an optional cache flush. Default 60,000. - </description> - </property> - <property> - <name>hbase.regionserver.safemode</name> - <value>false</value> - <description> - Turn on/off safe mode in region server. Always on for production, always off - for tests. - </description> - </property> - <property> - <name>hbase.hregion.max.filesize</name> - <value>67108864</value> - <description> - Maximum desired file size for an HRegion. If filesize exceeds - value + (value / 2), the HRegion is split in two. Default: 256M. - - Keep the maximum filesize small so we split more often in tests. - </description> - </property> - <property> - <name>hadoop.log.dir</name> - <value>${user.dir}/../logs</value> - </property> - <property> <name>hbase.zookeeper.property.clientPort</name> - <value>21818</value> - <description>Property from ZooKeeper's config zoo.cfg. - The port at which the clients will connect. - </description> + <value>2181</value> </property> </configuration> diff --git a/extensions-jvm/hbase/integration-test/src/test/java/org/apache/camel/quarkus/component/hbase/it/HBaseTestResource.java b/extensions-jvm/hbase/integration-test/src/test/java/org/apache/camel/quarkus/component/hbase/it/HBaseTestResource.java index 5646dcc..14664b6 100644 --- a/extensions-jvm/hbase/integration-test/src/test/java/org/apache/camel/quarkus/component/hbase/it/HBaseTestResource.java +++ b/extensions-jvm/hbase/integration-test/src/test/java/org/apache/camel/quarkus/component/hbase/it/HBaseTestResource.java @@ -20,37 +20,45 @@ import java.util.Collections; import java.util.Map; import io.quarkus.test.common.QuarkusTestResourceLifecycleManager; -import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.hbase.HBaseConfiguration; -import org.apache.hadoop.hbase.HBaseTestingUtility; import org.jboss.logging.Logger; +import org.testcontainers.containers.GenericContainer; +import org.testcontainers.containers.wait.strategy.Wait; public class HBaseTestResource implements QuarkusTestResourceLifecycleManager { private static final Logger LOG = Logger.getLogger(HBaseTestResource.class); // must be the same as in the config of camel component - static final Integer CLIENT_PORT = 21818; + static final Integer CLIENT_PORT = 2181; - private HBaseTestingUtility hbaseUtil; + private GenericContainer container; @Override public Map<String, String> start() { + try { - Configuration conf = HBaseConfiguration.create(); - conf.set("test.hbase.zookeeper.property.clientPort", CLIENT_PORT.toString()); - hbaseUtil = new HBaseTestingUtility(conf); - hbaseUtil.startMiniCluster(1); + //there is only one tag for this docker image - latest. See https://hub.docker.com/r/dajobe/hbase/tags + //Hbase is using zookeeper. Hbase client gets location of hbase master from zookeeper, which means that + //location uses internal hostnames from the docker. Network mode `host` is the only way how to avoid + //manipulation with the hosts configuration at the test server. + container = new GenericContainer("dajobe/hbase:latest") + .withNetworkMode("host") + .waitingFor( + Wait.forLogMessage(".*Finished refreshing block distribution cache for 2 regions\\n", 1)); + container.start(); + + return Collections.emptyMap(); } catch (Exception e) { - throw new RuntimeException("Could not start HBase cluster.", e); + throw new RuntimeException(e); } - return Collections.emptyMap(); } @Override public void stop() { try { - hbaseUtil.shutdownMiniCluster(); + if (container != null) { + container.stop(); + } } catch (Exception e) { - LOG.warn("Error shutting down the HBase container", e); + // Ignored } } diff --git a/extensions-jvm/hbase/integration-test/src/test/java/org/apache/camel/quarkus/component/hbase/it/HbaseTest.java b/extensions-jvm/hbase/integration-test/src/test/java/org/apache/camel/quarkus/component/hbase/it/HbaseTest.java index c686845..1125aca 100644 --- a/extensions-jvm/hbase/integration-test/src/test/java/org/apache/camel/quarkus/component/hbase/it/HbaseTest.java +++ b/extensions-jvm/hbase/integration-test/src/test/java/org/apache/camel/quarkus/component/hbase/it/HbaseTest.java @@ -28,14 +28,12 @@ import org.apache.hadoop.hbase.client.ColumnFamilyDescriptorBuilder; import org.apache.hadoop.hbase.client.Connection; import org.apache.hadoop.hbase.client.ConnectionFactory; import org.apache.hadoop.hbase.client.TableDescriptorBuilder; -import org.junit.jupiter.api.Disabled; import org.junit.jupiter.api.Test; import static org.hamcrest.core.Is.is; @QuarkusTest @QuarkusTestResource(HBaseTestResource.class) -@Disabled("https://github.com/apache/camel-quarkus/issues/2295") class HbaseTest { @Test