sadanand48 commented on code in PR #5543:
URL: https://github.com/apache/ozone/pull/5543#discussion_r1383098919
##########
hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/replication/TestPushReplicator.java:
##########
@@ -126,6 +148,100 @@ void packFailsWithException() throws IOException {
output.assertClosedExactlyOnce();
}
+ @Test
+ void importSameContainerWhenAlreadyImport() throws Exception {
+ long containerId = 1;
+ // crate container
+ KeyValueContainerData containerData = new
KeyValueContainerData(containerId,
+ ContainerLayoutVersion.FILE_PER_BLOCK, 100, "test", "test");
+ KeyValueContainer container = new KeyValueContainer(containerData, conf);
+ ContainerController controllerMock = mock(ContainerController.class);
+ // create containerImporter object
+ ContainerSet containerSet = new ContainerSet(0);
+ containerSet.addContainer(container);
+ MutableVolumeSet volumeSet = new MutableVolumeSet("test", conf, null,
+ StorageVolume.VolumeType.DATA_VOLUME, null);
+ ContainerImporter containerImporter = new ContainerImporter(conf,
+ containerSet, controllerMock, volumeSet);
+ // run import async first time having delay
Review Comment:
this comment refers to below test and can be removed from this test.
##########
hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/replication/TestPushReplicator.java:
##########
@@ -126,6 +148,100 @@ void packFailsWithException() throws IOException {
output.assertClosedExactlyOnce();
}
+ @Test
+ void importSameContainerWhenAlreadyImport() throws Exception {
+ long containerId = 1;
+ // crate container
+ KeyValueContainerData containerData = new
KeyValueContainerData(containerId,
+ ContainerLayoutVersion.FILE_PER_BLOCK, 100, "test", "test");
+ KeyValueContainer container = new KeyValueContainer(containerData, conf);
+ ContainerController controllerMock = mock(ContainerController.class);
+ // create containerImporter object
+ ContainerSet containerSet = new ContainerSet(0);
+ containerSet.addContainer(container);
+ MutableVolumeSet volumeSet = new MutableVolumeSet("test", conf, null,
+ StorageVolume.VolumeType.DATA_VOLUME, null);
+ ContainerImporter containerImporter = new ContainerImporter(conf,
+ containerSet, controllerMock, volumeSet);
+ // run import async first time having delay
+ File tarFile = new File("dummy.tar");
+ // second import should fail immediately
+ try {
+ containerImporter.importContainer(containerId, tarFile.toPath(),
+ null, NO_COMPRESSION);
+ assertFalse(true, "exception should occur");
+ } catch (StorageContainerException ex) {
+ assertTrue(ex.getResult().equals(
+ ContainerProtos.Result.CONTAINER_EXISTS));
+ }
+ }
+
+ @Test
+ void importSameContainerWhenFirstInProgress() throws Exception {
+ long containerId = 1;
+ // crate container
Review Comment:
*create
##########
hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/replication/TestPushReplicator.java:
##########
@@ -126,6 +148,100 @@ void packFailsWithException() throws IOException {
output.assertClosedExactlyOnce();
}
+ @Test
+ void importSameContainerWhenAlreadyImport() throws Exception {
+ long containerId = 1;
+ // crate container
Review Comment:
*create container
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]