You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ozone.apache.org by el...@apache.org on 2020/04/17 10:25:04 UTC

[hadoop-ozone] branch master updated: HDDS-3400. Extract test utilities to separate module

This is an automated email from the ASF dual-hosted git repository.

elek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hadoop-ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new 77bb315  HDDS-3400. Extract test utilities to separate module
77bb315 is described below

commit 77bb315a1d6ed54f121cdc16add9cc68bd8d5e13
Author: Doroszlai, Attila <ad...@apache.org>
AuthorDate: Fri Apr 17 11:33:56 2020 +0200

    HDDS-3400. Extract test utilities to separate module
    
    Closes #837
---
 hadoop-hdds/client/pom.xml                         |  5 ++
 hadoop-hdds/common/pom.xml                         |  5 ++
 hadoop-hdds/config/pom.xml                         |  6 ++
 hadoop-hdds/container-service/pom.xml              |  5 ++
 hadoop-hdds/framework/pom.xml                      |  5 ++
 hadoop-hdds/pom.xml                                |  8 +++
 hadoop-hdds/server-scm/pom.xml                     |  5 ++
 .../upgrade => hadoop-hdds/test-utils}/pom.xml     | 46 ++++++++++----
 .../org/apache/hadoop/test/GenericTestUtils.java   | 74 ++++++++++++++++------
 .../org/apache/hadoop/test/LambdaTestUtils.java    | 21 +++---
 .../apache/hadoop/test/TimedOutTestsListener.java  | 18 ++++--
 .../java/org/apache/hadoop/test/package-info.java  | 22 +++++++
 hadoop-hdds/tools/pom.xml                          |  5 ++
 hadoop-ozone/client/pom.xml                        |  5 ++
 hadoop-ozone/common/pom.xml                        |  5 ++
 .../fault-injection-test/mini-chaos-tests/pom.xml  |  7 +-
 hadoop-ozone/insight/pom.xml                       |  5 ++
 hadoop-ozone/integration-test/pom.xml              |  5 ++
 hadoop-ozone/ozone-manager/pom.xml                 |  5 ++
 hadoop-ozone/ozonefs/pom.xml                       |  5 ++
 hadoop-ozone/pom.xml                               |  6 ++
 hadoop-ozone/recon/pom.xml                         |  5 ++
 hadoop-ozone/s3gateway/pom.xml                     |  5 ++
 hadoop-ozone/tools/pom.xml                         |  5 ++
 hadoop-ozone/upgrade/pom.xml                       |  5 ++
 pom.xml                                            |  6 ++
 26 files changed, 241 insertions(+), 53 deletions(-)

diff --git a/hadoop-hdds/client/pom.xml b/hadoop-hdds/client/pom.xml
index 30f981b..de6f8bf 100644
--- a/hadoop-hdds/client/pom.xml
+++ b/hadoop-hdds/client/pom.xml
@@ -32,6 +32,11 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd">
   <dependencies>
     <dependency>
       <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-hdds-test-utils</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.hadoop</groupId>
       <artifactId>hadoop-hdds-common</artifactId>
     </dependency>
 
diff --git a/hadoop-hdds/common/pom.xml b/hadoop-hdds/common/pom.xml
index 71c5a8a..360c9aa 100644
--- a/hadoop-hdds/common/pom.xml
+++ b/hadoop-hdds/common/pom.xml
@@ -72,6 +72,11 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd">
       <groupId>org.apache.hadoop</groupId>
       <artifactId>hadoop-hdds-config</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-hdds-test-utils</artifactId>
+      <scope>test</scope>
+    </dependency>
 
     <dependency>
       <groupId>javax.annotation</groupId>
diff --git a/hadoop-hdds/config/pom.xml b/hadoop-hdds/config/pom.xml
index f8aac02..98690c4 100644
--- a/hadoop-hdds/config/pom.xml
+++ b/hadoop-hdds/config/pom.xml
@@ -35,6 +35,12 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd">
   <dependencies>
 
     <dependency>
+      <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-hdds-test-utils</artifactId>
+      <scope>test</scope>
+    </dependency>
+
+    <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
       <scope>test</scope>
diff --git a/hadoop-hdds/container-service/pom.xml b/hadoop-hdds/container-service/pom.xml
index 674326d..653e2a9 100644
--- a/hadoop-hdds/container-service/pom.xml
+++ b/hadoop-hdds/container-service/pom.xml
@@ -34,6 +34,11 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd">
       <artifactId>hadoop-hdds-common</artifactId>
     </dependency>
     <dependency>
+      <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-hdds-test-utils</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
       <groupId>org.apache.commons</groupId>
       <artifactId>commons-compress</artifactId>
     </dependency>
diff --git a/hadoop-hdds/framework/pom.xml b/hadoop-hdds/framework/pom.xml
index c1125dc..a320423 100644
--- a/hadoop-hdds/framework/pom.xml
+++ b/hadoop-hdds/framework/pom.xml
@@ -32,6 +32,11 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd">
   <dependencies>
     <dependency>
       <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-hdds-test-utils</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.hadoop</groupId>
       <artifactId>hadoop-hdds-common</artifactId>
     </dependency>
     <dependency>
diff --git a/hadoop-hdds/pom.xml b/hadoop-hdds/pom.xml
index a80a286..659f316 100644
--- a/hadoop-hdds/pom.xml
+++ b/hadoop-hdds/pom.xml
@@ -41,6 +41,7 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd">
     <module>tools</module>
     <module>docs</module>
     <module>config</module>
+    <module>test-utils</module>
   </modules>
 
   <properties>
@@ -136,6 +137,13 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd">
 
       <dependency>
         <groupId>org.apache.hadoop</groupId>
+        <artifactId>hadoop-hdds-test-utils</artifactId>
+        <version>${hdds.version}</version>
+        <scope>test</scope>
+      </dependency>
+
+      <dependency>
+        <groupId>org.apache.hadoop</groupId>
         <artifactId>hadoop-hdds-common</artifactId>
         <version>${hdds.version}</version>
         <type>test-jar</type>
diff --git a/hadoop-hdds/server-scm/pom.xml b/hadoop-hdds/server-scm/pom.xml
index 5482331..7c26fb6 100644
--- a/hadoop-hdds/server-scm/pom.xml
+++ b/hadoop-hdds/server-scm/pom.xml
@@ -31,6 +31,11 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd">
   <dependencies>
     <dependency>
       <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-hdds-test-utils</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.hadoop</groupId>
       <artifactId>hadoop-hdds-common</artifactId>
     </dependency>
 
diff --git a/hadoop-ozone/upgrade/pom.xml b/hadoop-hdds/test-utils/pom.xml
similarity index 59%
copy from hadoop-ozone/upgrade/pom.xml
copy to hadoop-hdds/test-utils/pom.xml
index 90739a0..24f4c6f 100644
--- a/hadoop-ozone/upgrade/pom.xml
+++ b/hadoop-hdds/test-utils/pom.xml
@@ -19,34 +19,54 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd">
   <modelVersion>4.0.0</modelVersion>
   <parent>
     <groupId>org.apache.hadoop</groupId>
-    <artifactId>hadoop-ozone</artifactId>
+    <artifactId>hadoop-hdds</artifactId>
     <version>0.6.0-SNAPSHOT</version>
   </parent>
-  <artifactId>hadoop-ozone-upgrade</artifactId>
+  <artifactId>hadoop-hdds-test-utils</artifactId>
   <version>0.6.0-SNAPSHOT</version>
-  <description>Apache Hadoop Ozone In-Place Upgrade</description>
-  <name>Apache Hadoop Ozone In-Place Upgrade</name>
+  <description>Apache Hadoop Distributed Data Store Test Utils</description>
+  <name>Apache Hadoop HDDS Test Utils</name>
   <packaging>jar</packaging>
 
+  <properties>
+
+  </properties>
+
   <dependencies>
     <dependency>
-      <groupId>org.apache.hadoop</groupId>
-      <artifactId>hadoop-hdds-common</artifactId>
-    </dependency>
-    <dependency>
       <groupId>com.github.spotbugs</groupId>
-      <artifactId>spotbugs</artifactId>
+      <artifactId>spotbugs-annotations</artifactId>
       <scope>provided</scope>
     </dependency>
     <dependency>
+      <groupId>com.google.guava</groupId>
+      <artifactId>guava</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>commons-io</groupId>
+      <artifactId>commons-io</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>commons-logging</groupId>
+      <artifactId>commons-logging</artifactId>
+      <version>1.2</version>
+    </dependency>
+    <dependency>
       <groupId>junit</groupId>
       <artifactId>junit</artifactId>
-      <scope>test</scope>
     </dependency>
     <dependency>
-      <groupId>org.mockito</groupId>
-      <artifactId>mockito-core</artifactId>
-      <scope>test</scope>
+      <groupId>log4j</groupId>
+      <artifactId>log4j</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.commons</groupId>
+      <artifactId>commons-lang3</artifactId>
+    </dependency>
+    <dependency>
+      <groupId>org.slf4j</groupId>
+      <artifactId>slf4j-api</artifactId>
     </dependency>
   </dependencies>
+
 </project>
diff --git a/hadoop-hdds/common/src/test/java/org/apache/hadoop/test/GenericTestUtils.java b/hadoop-hdds/test-utils/src/main/java/org/apache/hadoop/test/GenericTestUtils.java
similarity index 82%
rename from hadoop-hdds/common/src/test/java/org/apache/hadoop/test/GenericTestUtils.java
rename to hadoop-hdds/test-utils/src/main/java/org/apache/hadoop/test/GenericTestUtils.java
index 5f5ab3e..007ecaf 100644
--- a/hadoop-hdds/common/src/test/java/org/apache/hadoop/test/GenericTestUtils.java
+++ b/hadoop-hdds/test-utils/src/main/java/org/apache/hadoop/test/GenericTestUtils.java
@@ -22,12 +22,11 @@ import java.io.ByteArrayOutputStream;
 import java.io.File;
 import java.io.OutputStream;
 import java.io.PrintStream;
+import java.io.PrintWriter;
 import java.io.StringWriter;
+import java.io.UnsupportedEncodingException;
 import java.util.concurrent.TimeoutException;
 
-import org.apache.hadoop.fs.Path;
-import org.apache.hadoop.util.Time;
-
 import com.google.common.base.Preconditions;
 import com.google.common.base.Supplier;
 import org.apache.commons.io.IOUtils;
@@ -44,8 +43,11 @@ import org.apache.log4j.PatternLayout;
 import org.apache.log4j.WriterAppender;
 import org.junit.Assert;
 
+import static java.nio.charset.StandardCharsets.UTF_8;
+import static org.junit.Assert.assertTrue;
+
 /**
- * Test provides some very generic helpers which might be used across the tests.
+ * Provides some very generic helpers which might be used across the tests.
  */
 public abstract class GenericTestUtils {
 
@@ -56,10 +58,15 @@ public abstract class GenericTestUtils {
    * Error string used in {@link GenericTestUtils#waitFor(Supplier, int, int)}.
    */
   public static final String ERROR_MISSING_ARGUMENT =
-      "Input supplier interface should be initailized";
+      "Input supplier interface should be initialized";
   public static final String ERROR_INVALID_ARGUMENT =
       "Total wait time should be greater than check interval time";
 
+  public static final boolean WINDOWS =
+      System.getProperty("os.name").startsWith("Windows");
+
+  private static final long NANOSECONDS_PER_MILLISECOND = 1_000_000;
+
   static {
     DEFAULT_TEST_DATA_DIR =
         "target" + File.separator + "test" + File.separator + "data";
@@ -78,8 +85,7 @@ public abstract class GenericTestUtils {
       prop = DEFAULT_TEST_DATA_DIR;
     }
     File dir = new File(prop).getAbsoluteFile();
-    dir.mkdirs();
-    assertExists(dir);
+    assertDirCreation(dir);
     return dir;
   }
 
@@ -111,7 +117,7 @@ public abstract class GenericTestUtils {
    * @return a string to use in paths
    */
   public static String getTempPath(String subpath) {
-    String prop = (Path.WINDOWS) ? DEFAULT_TEST_DATA_PATH
+    String prop = WINDOWS ? DEFAULT_TEST_DATA_PATH
         : System.getProperty(SYSPROP_TEST_DATA_DIR, DEFAULT_TEST_DATA_PATH);
 
     if (prop.isEmpty()) {
@@ -139,7 +145,15 @@ public abstract class GenericTestUtils {
    * Assert that a given file exists.
    */
   public static void assertExists(File f) {
-    Assert.assertTrue("File " + f + " should exist", f.exists());
+    assertTrue("File " + f + " should exist", f.exists());
+  }
+
+  /**
+   * Assert that a given dir can be created or it already exists.
+   */
+  public static void assertDirCreation(File f) {
+    assertTrue("Could not create dir " + f + ", nor does it exist",
+        f.mkdirs() || f.exists());
   }
 
   public static void assertExceptionContains(String expectedText, Throwable t) {
@@ -157,11 +171,24 @@ public abstract class GenericTestUtils {
       throw new AssertionError(String
           .format("%s Expected to find '%s' %s: %s", prefix, expectedText,
               "but got unexpected exception",
-              org.apache.hadoop.util.StringUtils.stringifyException(t)), t);
+              stringifyException(t)), t);
     }
   }
 
   /**
+   * Make a string representation of the exception.
+   * @param e The exception to stringify
+   * @return A string with exception name and call stack.
+   */
+  public static String stringifyException(Throwable e) {
+    StringWriter stm = new StringWriter();
+    PrintWriter wrt = new PrintWriter(stm);
+    e.printStackTrace(wrt);
+    wrt.close();
+    return stm.toString();
+  }
+
+  /**
    * Wait for the specified test to return true. The test will be performed
    * initially and then every {@code checkEveryMillis} until at least
    * {@code waitForMillis} time has expired. If {@code check} is null or
@@ -184,10 +211,10 @@ public abstract class GenericTestUtils {
     Preconditions.checkArgument(waitForMillis >= checkEveryMillis,
         ERROR_INVALID_ARGUMENT);
 
-    long st = Time.monotonicNow();
+    long st = monotonicNow();
     boolean result = check.get();
 
-    while (!result && (Time.monotonicNow() - st < waitForMillis)) {
+    while (!result && (monotonicNow() - st < waitForMillis)) {
       Thread.sleep(checkEveryMillis);
       result = check.get();
     }
@@ -263,6 +290,10 @@ public abstract class GenericTestUtils {
     return LogManager.getLogger(logger.getName());
   }
 
+  private static long monotonicNow() {
+    return System.nanoTime() / NANOSECONDS_PER_MILLISECOND;
+  }
+
   /**
    * Capture output printed to {@link System#err}.
    * <p>
@@ -282,19 +313,19 @@ public abstract class GenericTestUtils {
    * </pre>
    */
   public static class SystemErrCapturer implements AutoCloseable {
-    final private ByteArrayOutputStream bytes;
-    final private PrintStream bytesPrintStream;
-    final private PrintStream oldErr;
+    private final ByteArrayOutputStream bytes;
+    private final PrintStream bytesPrintStream;
+    private final PrintStream oldErr;
 
-    public SystemErrCapturer() {
+    public SystemErrCapturer() throws UnsupportedEncodingException {
       bytes = new ByteArrayOutputStream();
-      bytesPrintStream = new PrintStream(bytes);
+      bytesPrintStream = new PrintStream(bytes, false, UTF_8.name());
       oldErr = System.err;
       System.setErr(new TeePrintStream(oldErr, bytesPrintStream));
     }
 
-    public String getOutput() {
-      return bytes.toString();
+    public String getOutput() throws UnsupportedEncodingException {
+      return bytes.toString(UTF_8.name());
     }
 
     @Override
@@ -312,8 +343,9 @@ public abstract class GenericTestUtils {
   public static class TeePrintStream extends PrintStream {
     private final PrintStream other;
 
-    public TeePrintStream(OutputStream main, PrintStream other) {
-      super(main);
+    public TeePrintStream(OutputStream main, PrintStream other)
+        throws UnsupportedEncodingException {
+      super(main, false, UTF_8.name());
       this.other = other;
     }
 
diff --git a/hadoop-hdds/common/src/test/java/org/apache/hadoop/test/LambdaTestUtils.java b/hadoop-hdds/test-utils/src/main/java/org/apache/hadoop/test/LambdaTestUtils.java
similarity index 98%
rename from hadoop-hdds/common/src/test/java/org/apache/hadoop/test/LambdaTestUtils.java
rename to hadoop-hdds/test-utils/src/main/java/org/apache/hadoop/test/LambdaTestUtils.java
index 9f842de..6689dee 100644
--- a/hadoop-hdds/common/src/test/java/org/apache/hadoop/test/LambdaTestUtils.java
+++ b/hadoop-hdds/test-utils/src/main/java/org/apache/hadoop/test/LambdaTestUtils.java
@@ -22,7 +22,7 @@ import java.util.Optional;
 import java.util.concurrent.Callable;
 import java.util.concurrent.TimeoutException;
 
-import org.apache.hadoop.util.Time;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
 
 import com.google.common.base.Preconditions;
 import org.junit.Assert;
@@ -117,7 +117,7 @@ public final class LambdaTestUtils {
         "timeoutMillis must be >= 0");
     Preconditions.checkNotNull(timeoutHandler);
 
-    long endTime = Time.now() + timeoutMillis;
+    final long endTime = System.currentTimeMillis() + timeoutMillis;
     Throwable ex = null;
     boolean running = true;
     int iterations = 0;
@@ -138,7 +138,7 @@ public final class LambdaTestUtils {
         LOG.debug("eventually() iteration {}", iterations, e);
         ex = e;
       }
-      running = Time.now() < endTime;
+      running = System.currentTimeMillis() < endTime;
       if (running) {
         int sleeptime = retry.call();
         if (sleeptime >= 0) {
@@ -228,15 +228,15 @@ public final class LambdaTestUtils {
    * @throws InterruptedException if interrupted during the sleep operation.
    * @throws OutOfMemoryError you've run out of memory.
    */
+  @SuppressFBWarnings("DLS_DEAD_LOCAL_STORE")
   public static <T> T eventually(int timeoutMillis,
       Callable<T> eval,
       Callable<Integer> retry) throws Exception {
     Preconditions.checkArgument(timeoutMillis >= 0,
         "timeoutMillis must be >= 0");
-    long endTime = Time.now() + timeoutMillis;
+    final long endTime = System.currentTimeMillis() + timeoutMillis;
     Throwable ex;
     boolean running;
-    int sleeptime;
     int iterations = 0;
     do {
       iterations++;
@@ -250,11 +250,11 @@ public final class LambdaTestUtils {
       } catch (Throwable e) {
         LOG.debug("evaluate() iteration {}", iterations, e);
         ex = e;
-      }
-      running = Time.now() < endTime;
-      sleeptime = retry.call();
-      if (running && sleeptime >= 0) {
-        Thread.sleep(sleeptime);
+        running = System.currentTimeMillis() < endTime;
+        int sleeptime = retry.call();
+        if (running && sleeptime >= 0) {
+          Thread.sleep(sleeptime);
+        }
       }
     } while (running);
     // timeout. Throw the last exception raised
@@ -597,7 +597,6 @@ public final class LambdaTestUtils {
    * Assert that an optional value matches an expected one;
    * checks include null and empty on the actual value.
    * @param message message text
-   * @param expected expected value
    * @param actual actual optional value
    * @param <T> type
    */
diff --git a/hadoop-hdds/common/src/test/java/org/apache/hadoop/test/TimedOutTestsListener.java b/hadoop-hdds/test-utils/src/main/java/org/apache/hadoop/test/TimedOutTestsListener.java
similarity index 91%
rename from hadoop-hdds/common/src/test/java/org/apache/hadoop/test/TimedOutTestsListener.java
rename to hadoop-hdds/test-utils/src/main/java/org/apache/hadoop/test/TimedOutTestsListener.java
index cf219c7..f111f7d 100644
--- a/hadoop-hdds/common/src/test/java/org/apache/hadoop/test/TimedOutTestsListener.java
+++ b/hadoop-hdds/test-utils/src/main/java/org/apache/hadoop/test/TimedOutTestsListener.java
@@ -17,6 +17,8 @@
  */
 package org.apache.hadoop.test;
 
+import java.io.BufferedWriter;
+import java.io.OutputStreamWriter;
 import java.io.PrintWriter;
 import java.io.StringWriter;
 import java.lang.management.LockInfo;
@@ -27,27 +29,29 @@ import java.lang.management.ThreadMXBean;
 import java.text.DateFormat;
 import java.text.SimpleDateFormat;
 import java.util.Date;
+import java.util.Locale;
 import java.util.Map;
 
-import org.apache.hadoop.util.StringUtils;
-
 import org.junit.runner.notification.Failure;
 import org.junit.runner.notification.RunListener;
 
+import static java.nio.charset.StandardCharsets.UTF_8;
+
 /**
  * JUnit run listener which prints full thread dump into System.err
  * in case a test is failed due to timeout.
  */
 public class TimedOutTestsListener extends RunListener {
 
-  static final String TEST_TIMED_OUT_PREFIX = "test timed out after";
+  private static final String TEST_TIMED_OUT_PREFIX = "test timed out after";
 
   private static final String INDENT = "    ";
 
   private final PrintWriter output;
   
   public TimedOutTestsListener() {
-    this.output = new PrintWriter(System.err);
+    this(new PrintWriter(new BufferedWriter(new OutputStreamWriter(
+        System.err, UTF_8))));
   }
   
   public TimedOutTestsListener(PrintWriter output) {
@@ -56,7 +60,7 @@ public class TimedOutTestsListener extends RunListener {
 
   @Override
   public void testFailure(Failure failure) throws Exception {
-    if (failure != null && failure.getMessage() != null 
+    if (failure != null && failure.getMessage() != null
         && failure.getMessage().startsWith(TEST_TIMED_OUT_PREFIX)) {
       output.println("====> TEST TIMED OUT. PRINTING THREAD DUMP. <====");
       output.println();
@@ -90,14 +94,14 @@ public class TimedOutTestsListener extends RunListener {
     for (Map.Entry<Thread, StackTraceElement[]> e : stackTraces.entrySet()) {
       Thread thread = e.getKey();
       dump.append(String.format(
-          "\"%s\" %s prio=%d tid=%d %s\njava.lang.Thread.State: %s",
+          "\"%s\" %s prio=%d tid=%d %s%njava.lang.Thread.State: %s",
           thread.getName(),
           (thread.isDaemon() ? "daemon" : ""),
           thread.getPriority(),
           thread.getId(),
           Thread.State.WAITING.equals(thread.getState()) ? 
               "in Object.wait()" :
-              StringUtils.toLowerCase(thread.getState().name()),
+              thread.getState().name().toLowerCase(Locale.ENGLISH),
           Thread.State.WAITING.equals(thread.getState()) ?
               "WAITING (on object monitor)" : thread.getState()));
       for (StackTraceElement stackTraceElement : e.getValue()) {
diff --git a/hadoop-hdds/test-utils/src/main/java/org/apache/hadoop/test/package-info.java b/hadoop-hdds/test-utils/src/main/java/org/apache/hadoop/test/package-info.java
new file mode 100644
index 0000000..d74e033
--- /dev/null
+++ b/hadoop-hdds/test-utils/src/main/java/org/apache/hadoop/test/package-info.java
@@ -0,0 +1,22 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Utilities for tests.
+ */
+package org.apache.hadoop.test;
diff --git a/hadoop-hdds/tools/pom.xml b/hadoop-hdds/tools/pom.xml
index 1b64a18..e7eac57 100644
--- a/hadoop-hdds/tools/pom.xml
+++ b/hadoop-hdds/tools/pom.xml
@@ -32,6 +32,11 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd">
   <dependencies>
     <dependency>
       <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-hdds-test-utils</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.hadoop</groupId>
       <artifactId>hadoop-hdds-common</artifactId>
     </dependency>
     <dependency>
diff --git a/hadoop-ozone/client/pom.xml b/hadoop-ozone/client/pom.xml
index bac4b35..64b0aca 100644
--- a/hadoop-ozone/client/pom.xml
+++ b/hadoop-ozone/client/pom.xml
@@ -31,6 +31,11 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd">
   <dependencies>
     <dependency>
       <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-hdds-test-utils</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.hadoop</groupId>
       <artifactId>hadoop-ozone-common</artifactId>
     </dependency>
     <dependency>
diff --git a/hadoop-ozone/common/pom.xml b/hadoop-ozone/common/pom.xml
index 5add2b8..f320cf0 100644
--- a/hadoop-ozone/common/pom.xml
+++ b/hadoop-ozone/common/pom.xml
@@ -36,6 +36,11 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd">
     </dependency>
     <dependency>
       <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-hdds-test-utils</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.hadoop</groupId>
       <artifactId>hadoop-hdds-common</artifactId>
     </dependency>
     <dependency>
diff --git a/hadoop-ozone/fault-injection-test/mini-chaos-tests/pom.xml b/hadoop-ozone/fault-injection-test/mini-chaos-tests/pom.xml
index 0e08658..941a9cf 100644
--- a/hadoop-ozone/fault-injection-test/mini-chaos-tests/pom.xml
+++ b/hadoop-ozone/fault-injection-test/mini-chaos-tests/pom.xml
@@ -35,6 +35,11 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
     </dependency>
     <dependency>
       <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-hdds-test-utils</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.hadoop</groupId>
       <artifactId>hadoop-ozone-filesystem</artifactId>
     </dependency>
     <dependency>
@@ -49,4 +54,4 @@ http://maven.apache.org/xsd/maven-4.0.0.xsd">
       <scope>test</scope>
     </dependency>
   </dependencies>
-</project>
\ No newline at end of file
+</project>
diff --git a/hadoop-ozone/insight/pom.xml b/hadoop-ozone/insight/pom.xml
index 06f6bb9..b1fde5c 100644
--- a/hadoop-ozone/insight/pom.xml
+++ b/hadoop-ozone/insight/pom.xml
@@ -37,6 +37,11 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd">
       <groupId>org.apache.hadoop</groupId>
       <artifactId>hadoop-ozone-common</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-hdds-test-utils</artifactId>
+      <scope>test</scope>
+    </dependency>
     <!-- Genesis requires server side components -->
     <dependency>
       <groupId>org.apache.hadoop</groupId>
diff --git a/hadoop-ozone/integration-test/pom.xml b/hadoop-ozone/integration-test/pom.xml
index b81ddf5..799b7bf 100644
--- a/hadoop-ozone/integration-test/pom.xml
+++ b/hadoop-ozone/integration-test/pom.xml
@@ -36,6 +36,11 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd">
     </dependency>
     <dependency>
       <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-hdds-test-utils</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.hadoop</groupId>
       <artifactId>hadoop-hdds-server-scm</artifactId>
     </dependency>
     <dependency>
diff --git a/hadoop-ozone/ozone-manager/pom.xml b/hadoop-ozone/ozone-manager/pom.xml
index 1619c72..9a619c6 100644
--- a/hadoop-ozone/ozone-manager/pom.xml
+++ b/hadoop-ozone/ozone-manager/pom.xml
@@ -47,6 +47,11 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd">
 
     <dependency>
       <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-hdds-test-utils</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.hadoop</groupId>
       <artifactId>hadoop-hdds-server-framework</artifactId>
     </dependency>
     <dependency>
diff --git a/hadoop-ozone/ozonefs/pom.xml b/hadoop-ozone/ozonefs/pom.xml
index ddd5e15..d7831d0 100644
--- a/hadoop-ozone/ozonefs/pom.xml
+++ b/hadoop-ozone/ozonefs/pom.xml
@@ -82,6 +82,11 @@
     </dependency>
     <dependency>
       <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-hdds-test-utils</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.hadoop</groupId>
       <artifactId>hadoop-hdds-common</artifactId>
     </dependency>
     <dependency>
diff --git a/hadoop-ozone/pom.xml b/hadoop-ozone/pom.xml
index 70776c2..947462e 100644
--- a/hadoop-ozone/pom.xml
+++ b/hadoop-ozone/pom.xml
@@ -112,6 +112,12 @@
       </dependency>
       <dependency>
         <groupId>org.apache.hadoop</groupId>
+        <artifactId>hadoop-hdds-test-utils</artifactId>
+        <version>${hdds.version}</version>
+        <scope>test</scope>
+      </dependency>
+      <dependency>
+        <groupId>org.apache.hadoop</groupId>
         <artifactId>hadoop-hdds-hadoop-dependency-client</artifactId>
         <version>${hdds.version}</version>
       </dependency>
diff --git a/hadoop-ozone/recon/pom.xml b/hadoop-ozone/recon/pom.xml
index 01d7ece..d0a3889 100644
--- a/hadoop-ozone/recon/pom.xml
+++ b/hadoop-ozone/recon/pom.xml
@@ -197,6 +197,11 @@
         </exclusion>
       </exclusions>
     </dependency>
+    <dependency>
+      <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-hdds-test-utils</artifactId>
+      <scope>test</scope>
+    </dependency>
     <!-- visible only for ContainerOperationClient -->
     <dependency>
       <groupId>org.apache.hadoop</groupId>
diff --git a/hadoop-ozone/s3gateway/pom.xml b/hadoop-ozone/s3gateway/pom.xml
index 9a0ea0b..d0a9e50 100644
--- a/hadoop-ozone/s3gateway/pom.xml
+++ b/hadoop-ozone/s3gateway/pom.xml
@@ -38,6 +38,11 @@
     </dependency>
     <dependency>
       <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-hdds-test-utils</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.hadoop</groupId>
       <artifactId>hadoop-hdds-server-framework</artifactId>
     </dependency>
     <dependency>
diff --git a/hadoop-ozone/tools/pom.xml b/hadoop-ozone/tools/pom.xml
index 9002f65..e7735d2 100644
--- a/hadoop-ozone/tools/pom.xml
+++ b/hadoop-ozone/tools/pom.xml
@@ -37,6 +37,11 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd">
       <groupId>org.apache.hadoop</groupId>
       <artifactId>hadoop-ozone-common</artifactId>
     </dependency>
+    <dependency>
+      <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-hdds-test-utils</artifactId>
+      <scope>test</scope>
+    </dependency>
     <!-- Genesis requires server side components -->
     <dependency>
       <groupId>org.apache.hadoop</groupId>
diff --git a/hadoop-ozone/upgrade/pom.xml b/hadoop-ozone/upgrade/pom.xml
index 90739a0..ed80d9c 100644
--- a/hadoop-ozone/upgrade/pom.xml
+++ b/hadoop-ozone/upgrade/pom.xml
@@ -31,6 +31,11 @@ https://maven.apache.org/xsd/maven-4.0.0.xsd">
   <dependencies>
     <dependency>
       <groupId>org.apache.hadoop</groupId>
+      <artifactId>hadoop-hdds-test-utils</artifactId>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.hadoop</groupId>
       <artifactId>hadoop-hdds-common</artifactId>
     </dependency>
     <dependency>
diff --git a/pom.xml b/pom.xml
index 0a92b11..aa56a40 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1221,6 +1221,12 @@ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xs
         <scope>provided</scope>
       </dependency>
       <dependency>
+        <groupId>com.github.spotbugs</groupId>
+        <artifactId>spotbugs-annotations</artifactId>
+        <version>${spotbugs.version}</version>
+        <scope>provided</scope>
+      </dependency>
+      <dependency>
         <groupId>com.google.code.findbugs</groupId>
         <artifactId>jsr305</artifactId>
         <version>${findbugs.version}</version>


---------------------------------------------------------------------
To unsubscribe, e-mail: ozone-commits-unsubscribe@hadoop.apache.org
For additional commands, e-mail: ozone-commits-help@hadoop.apache.org