HDDS-2264. Improve output of TestOzoneContainer
Signed-off-by: Anu Engineer <aengineer@apache.org>
This commit is contained in:
parent
1877312440
commit
cfba6ac951
|
@ -41,12 +41,15 @@ import org.apache.hadoop.ozone.container.common.volume.VolumeSet;
|
||||||
import org.apache.hadoop.ozone.container.keyvalue.KeyValueContainer;
|
import org.apache.hadoop.ozone.container.keyvalue.KeyValueContainer;
|
||||||
import org.apache.hadoop.ozone.container.keyvalue.KeyValueContainerData;
|
import org.apache.hadoop.ozone.container.keyvalue.KeyValueContainerData;
|
||||||
import org.apache.hadoop.ozone.container.keyvalue.helpers.BlockUtils;
|
import org.apache.hadoop.ozone.container.keyvalue.helpers.BlockUtils;
|
||||||
|
import org.apache.hadoop.test.LambdaTestUtils;
|
||||||
import org.junit.After;
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.rules.TemporaryFolder;
|
import org.junit.rules.TemporaryFolder;
|
||||||
import org.mockito.Mockito;
|
import org.mockito.Mockito;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
@ -62,6 +65,9 @@ import static org.junit.Assert.assertEquals;
|
||||||
*/
|
*/
|
||||||
public class TestOzoneContainer {
|
public class TestOzoneContainer {
|
||||||
|
|
||||||
|
private static final Logger LOG =
|
||||||
|
LoggerFactory.getLogger(TestOzoneContainer.class);
|
||||||
|
|
||||||
@Rule
|
@Rule
|
||||||
public TemporaryFolder folder = new TemporaryFolder();
|
public TemporaryFolder folder = new TemporaryFolder();
|
||||||
|
|
||||||
|
@ -148,7 +154,6 @@ public class TestOzoneContainer {
|
||||||
@Test
|
@Test
|
||||||
public void testContainerCreateDiskFull() throws Exception {
|
public void testContainerCreateDiskFull() throws Exception {
|
||||||
long containerSize = (long) StorageUnit.MB.toBytes(100);
|
long containerSize = (long) StorageUnit.MB.toBytes(100);
|
||||||
boolean diskSpaceException = false;
|
|
||||||
|
|
||||||
// Format the volumes
|
// Format the volumes
|
||||||
for (HddsVolume volume : volumeSet.getVolumesList()) {
|
for (HddsVolume volume : volumeSet.getVolumesList()) {
|
||||||
|
@ -164,16 +169,14 @@ public class TestOzoneContainer {
|
||||||
keyValueContainer = new KeyValueContainer(keyValueContainerData, conf);
|
keyValueContainer = new KeyValueContainer(keyValueContainerData, conf);
|
||||||
|
|
||||||
// we expect an out of space Exception
|
// we expect an out of space Exception
|
||||||
try {
|
StorageContainerException e = LambdaTestUtils.intercept(
|
||||||
keyValueContainer.create(volumeSet, volumeChoosingPolicy, scmId);
|
StorageContainerException.class,
|
||||||
} catch (StorageContainerException e) {
|
() -> keyValueContainer.create(volumeSet, volumeChoosingPolicy, scmId)
|
||||||
if (e.getResult() == DISK_OUT_OF_SPACE) {
|
);
|
||||||
diskSpaceException = true;
|
if (!DISK_OUT_OF_SPACE.equals(e.getResult())) {
|
||||||
}
|
LOG.info("Unexpected error during container creation", e);
|
||||||
}
|
}
|
||||||
|
assertEquals(DISK_OUT_OF_SPACE, e.getResult());
|
||||||
// Test failed if there was no exception
|
|
||||||
assertEquals(true, diskSpaceException);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//verify committed space on each volume
|
//verify committed space on each volume
|
||||||
|
|
Loading…
Reference in New Issue