hadoop-common-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aengin...@apache.org
Subject [hadoop] branch trunk updated: HDDS-1147. Fix failing unit tests in TestOzoneManager. Contributed by Nandakumar.
Date Sun, 24 Feb 2019 05:05:10 GMT
This is an automated email from the ASF dual-hosted git repository.

aengineer pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/hadoop.git


The following commit(s) were added to refs/heads/trunk by this push:
     new c1e5b19  HDDS-1147. Fix failing unit tests in TestOzoneManager. Contributed by Nandakumar.
c1e5b19 is described below

commit c1e5b1921235316780dc439293b5fa1d3718ba3a
Author: Anu Engineer <aengineer@apache.org>
AuthorDate: Sat Feb 23 20:56:24 2019 -0800

    HDDS-1147. Fix failing unit tests in TestOzoneManager.
    Contributed by Nandakumar.
---
 .../OzoneManagerProtocolClientSideTranslatorPB.java         |  2 +-
 .../java/org/apache/hadoop/ozone/om/TestOzoneManager.java   | 13 ++++++-------
 .../java/org/apache/hadoop/ozone/om/KeyManagerImpl.java     |  2 +-
 3 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/OzoneManagerProtocolClientSideTranslatorPB.java
b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/OzoneManagerProtocolClientSideTranslatorPB.java
index 9e5be36..70d3d60 100644
--- a/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/OzoneManagerProtocolClientSideTranslatorPB.java
+++ b/hadoop-ozone/common/src/main/java/org/apache/hadoop/ozone/om/protocolPB/OzoneManagerProtocolClientSideTranslatorPB.java
@@ -292,7 +292,7 @@ public final class OzoneManagerProtocolClientSideTranslatorPB
         .setCheckVolumeAccessRequest(req)
         .build();
 
-    OMResponse omResponse = handleError(submitRequest(omRequest));
+    OMResponse omResponse = submitRequest(omRequest);
 
     if (omResponse.getStatus() == ACCESS_DENIED) {
       return false;
diff --git a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManager.java
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManager.java
index 446c855..03843bb 100644
--- a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManager.java
+++ b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/TestOzoneManager.java
@@ -343,7 +343,6 @@ public class TestOzoneManager {
 
   // Create a volume and test Volume access for a different user
   @Test
-  @Ignore("TODO:HDDS-1147")
   public void testAccessVolume() throws IOException, OzoneException {
     String userName = "user" + RandomStringUtils.randomNumeric(5);
     String adminName = "admin" + RandomStringUtils.randomNumeric(5);
@@ -674,7 +673,6 @@ public class TestOzoneManager {
    * @throws OzoneException
    */
   @Test
-  @Ignore("TODO:HDDS-1147")
   public void testRenameKey() throws IOException, OzoneException {
     String userName = "user" + RandomStringUtils.randomNumeric(5);
     String adminName = "admin" + RandomStringUtils.randomNumeric(5);
@@ -752,7 +750,8 @@ public class TestOzoneManager {
       testRenameFails++;
       omException = e;
     }
-    Assert.assertEquals(ResultCodes.KEY_RENAME_ERROR, omException);
+    Assert.assertEquals(ResultCodes.KEY_ALREADY_EXISTS,
+        omException.getResult());
 
     // Rename to empty string should fail
     toKeyName = "";
@@ -763,7 +762,7 @@ public class TestOzoneManager {
       testRenameFails++;
       omException = e;
     }
-    Assert.assertEquals(ResultCodes.KEY_RENAME_ERROR, omException);
+    Assert.assertEquals(ResultCodes.INVALID_KEY_NAME, omException.getResult());
 
     // Rename from empty string should fail
     keyArgs = new KeyArgs("", bucketArgs);
@@ -775,7 +774,7 @@ public class TestOzoneManager {
       testRenameFails++;
       omException = e;
     }
-    Assert.assertEquals(ResultCodes.KEY_RENAME_ERROR, omException);
+    Assert.assertEquals(ResultCodes.INVALID_KEY_NAME, omException.getResult());
 
     Assert.assertEquals(numKeyRenames + testRenames,
         omMetrics.getNumKeyRenames());
@@ -1309,7 +1308,6 @@ public class TestOzoneManager {
    * @throws IOException
    */
   @Test
-  @Ignore("TODO:HDDS-1147")
   public void testOmInitializationFailure() throws Exception {
     OzoneConfiguration config = new OzoneConfiguration();
     final String path =
@@ -1317,6 +1315,7 @@ public class TestOzoneManager {
     Path metaDirPath = Paths.get(path, "om-meta");
     config.set(HddsConfigKeys.OZONE_METADATA_DIRS, metaDirPath.toString());
     config.setBoolean(OzoneConfigKeys.OZONE_ENABLED, true);
+    config.set(OZONE_OM_ADDRESS_KEY, "127.0.0.1:0");
     config.set(ScmConfigKeys.OZONE_SCM_CLIENT_ADDRESS_KEY, "127.0.0.1:0");
     config.set(ScmConfigKeys.OZONE_SCM_BLOCK_CLIENT_ADDRESS_KEY,
         conf.get(ScmConfigKeys.OZONE_SCM_BLOCK_CLIENT_ADDRESS_KEY));
@@ -1332,7 +1331,7 @@ public class TestOzoneManager {
           omStore.setScmId("testScmId");
           // writes the version file properties
           omStore.initialize();
-          OzoneManager.createOm(null, conf);
+          OzoneManager.createOm(null, config);
         });
   }
 
diff --git a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java
b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java
index c6ee7a7..25b3353 100644
--- a/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java
+++ b/hadoop-ozone/ozone-manager/src/main/java/org/apache/hadoop/ozone/om/KeyManagerImpl.java
@@ -634,7 +634,7 @@ public class KeyManagerImpl implements KeyManager {
             "Rename key failed for volume:{} bucket:{} fromKey:{} toKey:{}. "
                 + "Key: {} already exists.", volumeName, bucketName,
             fromKeyName, toKeyName, toKeyName);
-        throw new OMException("Key not found",
+        throw new OMException("Key already exists",
             OMException.ResultCodes.KEY_ALREADY_EXISTS);
       }
 


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


Mime
View raw message