HBASE-26838 Junit jar is not included in the hbase tar ball, causing … (#4223)

Signed-off-by: Josh Elser <elserj@apache.org>
Singed-off-by: Nick Dimiduk <ndimiduk@apache.org>
Reviewed-by: Sean Busbey <busbey@apache.org>

(cherry-picked from commit 35868abe8f)
This commit is contained in:
Wellington Ramos Chevreuil 2022-03-31 21:22:19 +01:00 committed by Wellington Chevreuil
parent 5b1e7492a4
commit 064338e585
6 changed files with 68 additions and 2 deletions

View File

@ -696,6 +696,13 @@ elif [ "$COMMAND" = "hbtop" ] ; then
HBASE_OPTS="${HBASE_OPTS} ${HBASE_HBTOP_OPTS}" HBASE_OPTS="${HBASE_OPTS} ${HBASE_HBTOP_OPTS}"
else else
CLASS=$COMMAND 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 fi
# Add lib/jdk11 jars to the classpath # Add lib/jdk11 jars to the classpath

View File

@ -353,7 +353,18 @@
<groupId>org.apache.hbase</groupId> <groupId>org.apache.hbase</groupId>
<artifactId>hbase-rsgroup</artifactId> <artifactId>hbase-rsgroup</artifactId>
</dependency> </dependency>
</dependencies> <dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<!-- Making it compile here so that it can be downloaded during packaging. -->
<!-- All other modules scope it as test or inherit test scope from parent pom. -->
<scope>compile</scope>
</dependency>
</dependencies>
</profile> </profile>
</profiles> </profiles>
</project> </project>

View File

@ -52,6 +52,7 @@
<exclude>com.sun.jersey:*</exclude> <exclude>com.sun.jersey:*</exclude>
<exclude>com.sun.jersey.contribs:*</exclude> <exclude>com.sun.jersey.contribs:*</exclude>
<exclude>jline:jline</exclude> <exclude>jline:jline</exclude>
<exclude>junit:junit</exclude>
<exclude>com.github.stephenc.findbugs:findbugs-annotations</exclude> <exclude>com.github.stephenc.findbugs:findbugs-annotations</exclude>
<exclude>commons-logging:commons-logging</exclude> <exclude>commons-logging:commons-logging</exclude>
<exclude>log4j:log4j</exclude> <exclude>log4j:log4j</exclude>
@ -67,6 +68,8 @@
<exclude>org.slf4j:jul-to-slf4j</exclude> <exclude>org.slf4j:jul-to-slf4j</exclude>
<exclude>org.slf4j:slf4j-log4j12</exclude> <exclude>org.slf4j:slf4j-log4j12</exclude>
<exclude>org.slf4j:slf4j-reload4j</exclude> <exclude>org.slf4j:slf4j-reload4j</exclude>
<exclude>org.hamcrest:hamcrest-core</exclude>
<exclude>org.mockito:mockito-core</exclude>
</excludes> </excludes>
</dependencySet> </dependencySet>
</dependencySets> </dependencySets>
@ -157,6 +160,15 @@
<include>org.slf4j:slf4j-reload4j</include> <include>org.slf4j:slf4j-reload4j</include>
</includes> </includes>
</dependencySet> </dependencySet>
<!-- Adds junit libs to lib/test -->
<dependencySet>
<outputDirectory>lib/test</outputDirectory>
<includes>
<include>junit:junit</include>
<include>org.hamcrest:hamcrest-core</include>
<include>org.mockito:mockito-core</include>
</includes>
</dependencySet>
</dependencySets> </dependencySets>
</assembly> </assembly>

View File

@ -114,6 +114,9 @@
<exclude>org.slf4j:slf4j-api</exclude> <exclude>org.slf4j:slf4j-api</exclude>
<exclude>org.slf4j:slf4j-log4j12</exclude> <exclude>org.slf4j:slf4j-log4j12</exclude>
<exclude>org.slf4j:slf4j-reload4j</exclude> <exclude>org.slf4j:slf4j-reload4j</exclude>
<exclude>junit:junit</exclude>
<exclude>org.hamcrest:hamcrest-core</exclude>
<exclude>org.mockito:mockito-core</exclude>
</excludes> </excludes>
</dependencySet> </dependencySet>
</dependencySets> </dependencySets>
@ -258,6 +261,16 @@
<include>jakarta.jws:jakarta.jws-api</include> <include>jakarta.jws:jakarta.jws-api</include>
</includes> </includes>
</dependencySet> </dependencySet>
<!-- Adds junit libs to lib/test -->
<dependencySet>
<outputDirectory>lib/test</outputDirectory>
<includes>
<include>junit:junit</include>
<include>org.hamcrest:hamcrest-core</include>
<include>org.mockito:mockito-core</include>
</includes>
</dependencySet>
</dependencySets> </dependencySets>
</assembly> </assembly>

View File

@ -115,6 +115,9 @@
<exclude>org.slf4j:slf4j-api</exclude> <exclude>org.slf4j:slf4j-api</exclude>
<exclude>org.slf4j:slf4j-log4j12</exclude> <exclude>org.slf4j:slf4j-log4j12</exclude>
<exclude>org.slf4j:slf4j-reload4j</exclude> <exclude>org.slf4j:slf4j-reload4j</exclude>
<exclude>junit:junit</exclude>
<exclude>org.hamcrest:hamcrest-core</exclude>
<exclude>org.mockito:mockito-core</exclude>
</excludes> </excludes>
</dependencySet> </dependencySet>
</dependencySets> </dependencySets>
@ -256,6 +259,15 @@
<include>org.jvnet.staxex:stax-ex</include> <include>org.jvnet.staxex:stax-ex</include>
</includes> </includes>
</dependencySet> </dependencySet>
<!-- Adds junit libs to lib/test -->
<dependencySet>
<outputDirectory>lib/test</outputDirectory>
<includes>
<include>junit:junit</include>
<include>org.hamcrest:hamcrest-core</include>
<include>org.mockito:mockito-core</include>
</includes>
</dependencySet>
</dependencySets> </dependencySets>
</assembly> </assembly>

View File

@ -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. 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. 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)`. 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. 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. _/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. 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]] [[maven.build.commands.integration.tests.destructive]]
==== Destructive integration / system tests (ChaosMonkey) ==== Destructive integration / system tests (ChaosMonkey)