diff --git a/bin/hbase b/bin/hbase index 6bf03f7257c..d306ed069d6 100755 --- a/bin/hbase +++ b/bin/hbase @@ -696,6 +696,13 @@ elif [ "$COMMAND" = "hbtop" ] ; then HBASE_OPTS="${HBASE_OPTS} ${HBASE_HBTOP_OPTS}" else CLASS=$COMMAND +if [[ "$CLASS" =~ .*IntegrationTest.* ]] ; then + for f in ${HBASE_HOME}/lib/test/*.jar; do + if [ -f "${f}" ]; then + CLASSPATH="${CLASSPATH}:${f}" + fi + done + fi fi # Add lib/jdk11 jars to the classpath diff --git a/hbase-assembly/pom.xml b/hbase-assembly/pom.xml index eca030c21e9..3d4fed6052a 100644 --- a/hbase-assembly/pom.xml +++ b/hbase-assembly/pom.xml @@ -353,7 +353,18 @@ org.apache.hbase hbase-rsgroup - + + junit + junit + + + org.mockito + mockito-core + + + compile + + diff --git a/hbase-assembly/src/main/assembly/client.xml b/hbase-assembly/src/main/assembly/client.xml index 6fbd71724bd..a474d15f680 100644 --- a/hbase-assembly/src/main/assembly/client.xml +++ b/hbase-assembly/src/main/assembly/client.xml @@ -52,6 +52,7 @@ com.sun.jersey:* com.sun.jersey.contribs:* jline:jline + junit:junit com.github.stephenc.findbugs:findbugs-annotations commons-logging:commons-logging log4j:log4j @@ -67,6 +68,8 @@ org.slf4j:jul-to-slf4j org.slf4j:slf4j-log4j12 org.slf4j:slf4j-reload4j + org.hamcrest:hamcrest-core + org.mockito:mockito-core @@ -157,6 +160,15 @@ org.slf4j:slf4j-reload4j + + + lib/test + + junit:junit + org.hamcrest:hamcrest-core + org.mockito:mockito-core + + diff --git a/hbase-assembly/src/main/assembly/hadoop-three-compat.xml b/hbase-assembly/src/main/assembly/hadoop-three-compat.xml index 2ed7e429a89..5e0bea82a12 100644 --- a/hbase-assembly/src/main/assembly/hadoop-three-compat.xml +++ b/hbase-assembly/src/main/assembly/hadoop-three-compat.xml @@ -114,6 +114,9 @@ org.slf4j:slf4j-api org.slf4j:slf4j-log4j12 org.slf4j:slf4j-reload4j + junit:junit + org.hamcrest:hamcrest-core + org.mockito:mockito-core @@ -258,6 +261,16 @@ jakarta.jws:jakarta.jws-api + + + + lib/test + + junit:junit + org.hamcrest:hamcrest-core + org.mockito:mockito-core + + diff --git a/hbase-assembly/src/main/assembly/hadoop-two-compat.xml b/hbase-assembly/src/main/assembly/hadoop-two-compat.xml index 88aa9dc6cbb..3bbed110d59 100644 --- a/hbase-assembly/src/main/assembly/hadoop-two-compat.xml +++ b/hbase-assembly/src/main/assembly/hadoop-two-compat.xml @@ -115,6 +115,9 @@ org.slf4j:slf4j-api org.slf4j:slf4j-log4j12 org.slf4j:slf4j-reload4j + junit:junit + org.hamcrest:hamcrest-core + org.mockito:mockito-core @@ -256,6 +259,15 @@ org.jvnet.staxex:stax-ex + + + lib/test + + junit:junit + org.hamcrest:hamcrest-core + org.mockito:mockito-core + + diff --git a/src/main/asciidoc/_chapters/developer.adoc b/src/main/asciidoc/_chapters/developer.adoc index b3e2ffea144..6eacead1cfd 100644 --- a/src/main/asciidoc/_chapters/developer.adoc +++ b/src/main/asciidoc/_chapters/developer.adoc @@ -1677,7 +1677,7 @@ They are generally long-lasting, sizeable (the test can be asked to 1M rows or 1 Integration tests are what you would run when you need to more elaborate proofing of a release candidate beyond what unit tests can do. They are not generally run on the Apache Continuous Integration build server, however, some sites opt to run integration tests as a part of their continuous testing on an actual cluster. -Integration tests currently live under the _src/test_ directory in the hbase-it submodule and will match the regex: _**/IntegrationTest*.java_. +Integration tests currently live under the _src/test_ directory in the hbase-it submodule and will match the regex: _*IntegrationTest*.java_. All integration tests are also annotated with `@Category(IntegrationTests.class)`. Integration tests can be run in two modes: using a mini cluster, or against an actual distributed cluster. @@ -1794,6 +1794,17 @@ Currently tarball deployments, deployments which uses _hbase-daemons.sh_, and li _/etc/init.d/_ scripts are not supported for now, but it can be easily added. For other deployment options, a ClusterManager can be implemented and plugged in. +Some integration tests define a _main_ method as entry point, and can be run on its' own, rather than using the test driver. For example, the _itbll_ test can be run as follows: + +---- +bin/hbase org.apache.hadoop.hbase.test.IntegrationTestBigLinkedList loop 2 1 100000 /temp 1 1000 50 1 0 +---- + +NOTE: The _hbase_ script assumes all integration tests with exposed _main_ methods to be run +against a distributed cluster will follow the *IntegrationTest* regex naming pattern +mentioned above, in order to proper set test dependencies into the classpath. + + [[maven.build.commands.integration.tests.destructive]] ==== Destructive integration / system tests (ChaosMonkey)