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 boolean checkVolumeAccess(String volume, OzoneAclInfo userAcl) throws
|
|||||||
.setCheckVolumeAccessRequest(req)
|
.setCheckVolumeAccessRequest(req)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
OMResponse omResponse = handleError(submitRequest(omRequest));
|
OMResponse omResponse = submitRequest(omRequest);
|
||||||
|
|
||||||
if (omResponse.getStatus() == ACCESS_DENIED) {
|
if (omResponse.getStatus() == ACCESS_DENIED) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -343,7 +343,6 @@ public void testFailedDeleteVolume() throws IOException, OzoneException {
|
|||||||
|
|
||||||
// Create a volume and test Volume access for a different user
|
// Create a volume and test Volume access for a different user
|
||||||
@Test
|
@Test
|
||||||
@Ignore("TODO:HDDS-1147")
|
|
||||||
public void testAccessVolume() throws IOException, OzoneException {
|
public void testAccessVolume() throws IOException, OzoneException {
|
||||||
String userName = "user" + RandomStringUtils.randomNumeric(5);
|
String userName = "user" + RandomStringUtils.randomNumeric(5);
|
||||||
String adminName = "admin" + RandomStringUtils.randomNumeric(5);
|
String adminName = "admin" + RandomStringUtils.randomNumeric(5);
|
||||||
@ -674,7 +673,6 @@ public void testDeleteKey() throws Exception {
|
|||||||
* @throws OzoneException
|
* @throws OzoneException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
@Ignore("TODO:HDDS-1147")
|
|
||||||
public void testRenameKey() throws IOException, OzoneException {
|
public void testRenameKey() throws IOException, OzoneException {
|
||||||
String userName = "user" + RandomStringUtils.randomNumeric(5);
|
String userName = "user" + RandomStringUtils.randomNumeric(5);
|
||||||
String adminName = "admin" + RandomStringUtils.randomNumeric(5);
|
String adminName = "admin" + RandomStringUtils.randomNumeric(5);
|
||||||
@ -752,7 +750,8 @@ public void testRenameKey() throws IOException, OzoneException {
|
|||||||
testRenameFails++;
|
testRenameFails++;
|
||||||
omException = e;
|
omException = e;
|
||||||
}
|
}
|
||||||
Assert.assertEquals(ResultCodes.KEY_RENAME_ERROR, omException);
|
Assert.assertEquals(ResultCodes.KEY_ALREADY_EXISTS,
|
||||||
|
omException.getResult());
|
||||||
|
|
||||||
// Rename to empty string should fail
|
// Rename to empty string should fail
|
||||||
toKeyName = "";
|
toKeyName = "";
|
||||||
@ -763,7 +762,7 @@ public void testRenameKey() throws IOException, OzoneException {
|
|||||||
testRenameFails++;
|
testRenameFails++;
|
||||||
omException = e;
|
omException = e;
|
||||||
}
|
}
|
||||||
Assert.assertEquals(ResultCodes.KEY_RENAME_ERROR, omException);
|
Assert.assertEquals(ResultCodes.INVALID_KEY_NAME, omException.getResult());
|
||||||
|
|
||||||
// Rename from empty string should fail
|
// Rename from empty string should fail
|
||||||
keyArgs = new KeyArgs("", bucketArgs);
|
keyArgs = new KeyArgs("", bucketArgs);
|
||||||
@ -775,7 +774,7 @@ public void testRenameKey() throws IOException, OzoneException {
|
|||||||
testRenameFails++;
|
testRenameFails++;
|
||||||
omException = e;
|
omException = e;
|
||||||
}
|
}
|
||||||
Assert.assertEquals(ResultCodes.KEY_RENAME_ERROR, omException);
|
Assert.assertEquals(ResultCodes.INVALID_KEY_NAME, omException.getResult());
|
||||||
|
|
||||||
Assert.assertEquals(numKeyRenames + testRenames,
|
Assert.assertEquals(numKeyRenames + testRenames,
|
||||||
omMetrics.getNumKeyRenames());
|
omMetrics.getNumKeyRenames());
|
||||||
@ -1309,7 +1308,6 @@ public void testOmInitialization() throws IOException {
|
|||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
@Test
|
@Test
|
||||||
@Ignore("TODO:HDDS-1147")
|
|
||||||
public void testOmInitializationFailure() throws Exception {
|
public void testOmInitializationFailure() throws Exception {
|
||||||
OzoneConfiguration config = new OzoneConfiguration();
|
OzoneConfiguration config = new OzoneConfiguration();
|
||||||
final String path =
|
final String path =
|
||||||
@ -1317,6 +1315,7 @@ public void testOmInitializationFailure() throws Exception {
|
|||||||
Path metaDirPath = Paths.get(path, "om-meta");
|
Path metaDirPath = Paths.get(path, "om-meta");
|
||||||
config.set(HddsConfigKeys.OZONE_METADATA_DIRS, metaDirPath.toString());
|
config.set(HddsConfigKeys.OZONE_METADATA_DIRS, metaDirPath.toString());
|
||||||
config.setBoolean(OzoneConfigKeys.OZONE_ENABLED, true);
|
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_CLIENT_ADDRESS_KEY, "127.0.0.1:0");
|
||||||
config.set(ScmConfigKeys.OZONE_SCM_BLOCK_CLIENT_ADDRESS_KEY,
|
config.set(ScmConfigKeys.OZONE_SCM_BLOCK_CLIENT_ADDRESS_KEY,
|
||||||
conf.get(ScmConfigKeys.OZONE_SCM_BLOCK_CLIENT_ADDRESS_KEY));
|
conf.get(ScmConfigKeys.OZONE_SCM_BLOCK_CLIENT_ADDRESS_KEY));
|
||||||
@ -1332,7 +1331,7 @@ public void testOmInitializationFailure() throws Exception {
|
|||||||
omStore.setScmId("testScmId");
|
omStore.setScmId("testScmId");
|
||||||
// writes the version file properties
|
// writes the version file properties
|
||||||
omStore.initialize();
|
omStore.initialize();
|
||||||
OzoneManager.createOm(null, conf);
|
OzoneManager.createOm(null, config);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -634,7 +634,7 @@ public void renameKey(OmKeyArgs args, String toKeyName) throws IOException {
|
|||||||
"Rename key failed for volume:{} bucket:{} fromKey:{} toKey:{}. "
|
"Rename key failed for volume:{} bucket:{} fromKey:{} toKey:{}. "
|
||||||
+ "Key: {} already exists.", volumeName, bucketName,
|
+ "Key: {} already exists.", volumeName, bucketName,
|
||||||
fromKeyName, toKeyName, toKeyName);
|
fromKeyName, toKeyName, toKeyName);
|
||||||
throw new OMException("Key not found",
|
throw new OMException("Key already exists",
|
||||||
OMException.ResultCodes.KEY_ALREADY_EXISTS);
|
OMException.ResultCodes.KEY_ALREADY_EXISTS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user