Skip to content

Commit 35868ab

Browse files
committed
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>
1 parent 489af42 commit 35868ab

File tree

5 files changed

+56
-2
lines changed

5 files changed

+56
-2
lines changed

bin/hbase

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,13 @@ elif [ "$COMMAND" = "hbtop" ] ; then
729729
HBASE_OPTS="${HBASE_OPTS} ${HBASE_HBTOP_OPTS}"
730730
else
731731
CLASS=$COMMAND
732+
if [[ "$CLASS" =~ .*IntegrationTest.* ]] ; then
733+
for f in ${HBASE_HOME}/lib/test/*.jar; do
734+
if [ -f "${f}" ]; then
735+
CLASSPATH="${CLASSPATH}:${f}"
736+
fi
737+
done
738+
fi
732739
fi
733740

734741
# Add lib/jdk11 jars to the classpath

hbase-assembly/pom.xml

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,18 @@
388388
<groupId>org.apache.hbase</groupId>
389389
<artifactId>hbase-rsgroup</artifactId>
390390
</dependency>
391-
</dependencies>
391+
<dependency>
392+
<groupId>junit</groupId>
393+
<artifactId>junit</artifactId>
394+
</dependency>
395+
<dependency>
396+
<groupId>org.mockito</groupId>
397+
<artifactId>mockito-core</artifactId>
398+
<!-- Making it compile here so that it can be downloaded during packaging. -->
399+
<!-- All other modules scope it as test or inherit test scope from parent pom. -->
400+
<scope>compile</scope>
401+
</dependency>
402+
</dependencies>
392403
</profile>
393404
</profiles>
394405
</project>

hbase-assembly/src/main/assembly/client.xml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
<exclude>com.sun.jersey:*</exclude>
5353
<exclude>com.sun.jersey.contribs:*</exclude>
5454
<exclude>jline:jline</exclude>
55+
<exclude>junit:junit</exclude>
5556
<exclude>com.github.stephenc.findbugs:findbugs-annotations</exclude>
5657
<exclude>commons-logging:commons-logging</exclude>
5758
<exclude>org.apache.hbase:hbase-shaded-client</exclude>
@@ -63,6 +64,8 @@
6364
<exclude>org.slf4j:*</exclude>
6465
<exclude>org.apache.logging.log4j:*</exclude>
6566
<exclude>io.opentelemetry.javaagent:*</exclude>
67+
<exclude>org.hamcrest:hamcrest-core</exclude>
68+
<exclude>org.mockito:mockito-core</exclude>
6669
</excludes>
6770
</dependencySet>
6871
</dependencySets>
@@ -157,6 +160,15 @@
157160
<include>io.opentelemetry.javaagent:*</include>
158161
</includes>
159162
</dependencySet>
163+
<!-- Adds junit libs to lib/test -->
164+
<dependencySet>
165+
<outputDirectory>lib/test</outputDirectory>
166+
<includes>
167+
<include>junit:junit</include>
168+
<include>org.hamcrest:hamcrest-core</include>
169+
<include>org.mockito:mockito-core</include>
170+
</includes>
171+
</dependencySet>
160172
</dependencySets>
161173

162174
</assembly>

hbase-assembly/src/main/assembly/hadoop-three-compat.xml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@
110110
<exclude>org.slf4j:*</exclude>
111111
<exclude>org.apache.logging.log4j:*</exclude>
112112
<exclude>io.opentelemetry.javaagent:*</exclude>
113+
<exclude>junit:junit</exclude>
114+
<exclude>org.hamcrest:hamcrest-core</exclude>
115+
<exclude>org.mockito:mockito-core</exclude>
113116
</excludes>
114117
</dependencySet>
115118
</dependencySets>
@@ -258,6 +261,16 @@
258261
<include>io.opentelemetry.javaagent:*</include>
259262
</includes>
260263
</dependencySet>
264+
265+
<!-- Adds junit libs to lib/test -->
266+
<dependencySet>
267+
<outputDirectory>lib/test</outputDirectory>
268+
<includes>
269+
<include>junit:junit</include>
270+
<include>org.hamcrest:hamcrest-core</include>
271+
<include>org.mockito:mockito-core</include>
272+
</includes>
273+
</dependencySet>
261274
</dependencySets>
262275

263276
</assembly>

src/main/asciidoc/_chapters/developer.adoc

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1677,7 +1677,7 @@ They are generally long-lasting, sizeable (the test can be asked to 1M rows or 1
16771677
Integration tests are what you would run when you need to more elaborate proofing of a release candidate beyond what unit tests can do.
16781678
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.
16791679

1680-
Integration tests currently live under the _src/test_ directory in the hbase-it submodule and will match the regex: _**/IntegrationTest*.java_.
1680+
Integration tests currently live under the _src/test_ directory in the hbase-it submodule and will match the regex: _*IntegrationTest*.java_.
16811681
All integration tests are also annotated with `@Category(IntegrationTests.class)`.
16821682

16831683
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
17941794
_/etc/init.d/_ scripts are not supported for now, but it can be easily added.
17951795
For other deployment options, a ClusterManager can be implemented and plugged in.
17961796

1797+
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:
1798+
1799+
----
1800+
bin/hbase org.apache.hadoop.hbase.test.IntegrationTestBigLinkedList loop 2 1 100000 /temp 1 1000 50 1 0
1801+
----
1802+
1803+
NOTE: The _hbase_ script assumes all integration tests with exposed _main_ methods to be run
1804+
against a distributed cluster will follow the *IntegrationTest* regex naming pattern
1805+
mentioned above, in order to proper set test dependencies into the classpath.
1806+
1807+
17971808
[[maven.build.commands.integration.tests.destructive]]
17981809
==== Destructive integration / system tests (ChaosMonkey)
17991810

0 commit comments

Comments
 (0)