You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hbase.apache.org by wc...@apache.org on 2020/06/17 09:37:19 UTC

[hbase-operator-tools] branch master updated: HBASE-23927 hbck2 assigns command should accept a file containing a list of region names - amend to put test input file in test data dir #66

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

wchevreuil pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hbase-operator-tools.git


The following commit(s) were added to refs/heads/master by this push:
     new cb03431  HBASE-23927 hbck2 assigns command should accept a file containing a list of region names - amend to put test input file in test data dir #66
cb03431 is described below

commit cb034317ba5c5a8b3e8c2cb8ef901bceef954f27
Author: clarax <cl...@gmail.com>
AuthorDate: Wed Jun 17 02:37:10 2020 -0700

    HBASE-23927 hbck2 assigns command should accept a file containing a list of region names - amend to put test input file in test data dir #66
    
    Co-authored-by: Clara Xiong <cl...@gmail.coml>
---
 hbase-hbck2/src/test/java/org/apache/hbase/TestHBCK2.java | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/hbase-hbck2/src/test/java/org/apache/hbase/TestHBCK2.java b/hbase-hbck2/src/test/java/org/apache/hbase/TestHBCK2.java
index c120c98..ca3caca 100644
--- a/hbase-hbck2/src/test/java/org/apache/hbase/TestHBCK2.java
+++ b/hbase-hbck2/src/test/java/org/apache/hbase/TestHBCK2.java
@@ -22,6 +22,7 @@ import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
 import static org.junit.Assert.fail;
 
+import java.io.File;
 import java.io.FileOutputStream;
 import java.io.IOException;
 import java.io.OutputStream;
@@ -149,13 +150,13 @@ public class TestHBCK2 {
 
         // test input files
         unassigns(regions, regionStrsArray);
-        String testFile = "inputForAssignsTest";
-        FileOutputStream output = new FileOutputStream(testFile, false);
-        for (String regionStr : regionStrsArray) {
-          output.write((regionStr + System.lineSeparator()).getBytes());
+        File testFile = new File(TEST_UTIL.getDataTestDir().toString(), "inputForAssignsTest");
+        try (FileOutputStream output = new FileOutputStream(testFile, false)) {
+          for (String regionStr : regionStrsArray) {
+            output.write((regionStr + System.lineSeparator()).getBytes());
+          }
         }
-        output.close();
-        String result = testRunWithArgs(new String[] {ASSIGNS, "-i", testFile});
+        String result = testRunWithArgs(new String[]{ASSIGNS, "-i", testFile.toString()});
         Scanner scanner = new Scanner(result).useDelimiter("[\\D]+");
         pids = new ArrayList<>();
         while (scanner.hasNext()) {