HDDS-1147. Fix failing unit tests in TestOzoneManager.
Contributed by Nandakumar.
This commit is contained in:
parent
fb546d1807
commit
c1e5b19212
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue