aayush2761 commented on code in PR #12053:
URL: https://github.com/apache/ozone/pull/12053#discussion_r4643721822
##########
hadoop-hdds/container-service/src/test/java/org/apache/hadoop/ozone/container/keyvalue/TestKeyValueHandler.java:
##########
@@ -704,6 +710,99 @@ public void testDeleteRecoveringContainer() throws
IOException {
}
}
+ @Test
+ public void testFailedCloseKeepsRecoveringContainerTracked() throws
IOException {
+ HandlerWithVolumeSet handlerCtx = createKeyValueHandler(tempDir);
+ KeyValueHandler keyValueHandler = handlerCtx.getHandler();
+ ContainerSet containerSet = handlerCtx.getContainerSet();
+ try {
+ ContainerCommandRequestProto.Builder request =
createContainerRequest(DATANODE_UUID, DUMMY_CONTAINER_ID)
+ .toBuilder();
+ request.getCreateContainerBuilder().setState(State.RECOVERING);
+ assertThat(keyValueHandler.handleCreateContainer(request.build(),
null).getResult())
+ .isEqualTo(ContainerProtos.Result.SUCCESS);
+ KeyValueContainer container = (KeyValueContainer)
containerSet.getContainer(DUMMY_CONTAINER_ID);
+ assertThat(container).isNotNull();
+ assertThat(container.getContainerState()).isEqualTo(State.RECOVERING);
+
assertThat(containerSet.getRecoveringContainerMap()).containsKey(DUMMY_CONTAINER_ID);
+
+ File metadataDir = new
File(container.getContainerData().getMetadataPath());
+ assumeThat(metadataDir.setWritable(false)).isTrue();
+ File writeProbe = new File(metadataDir, "write-probe");
+ try {
+ assumeThat(writeProbe.createNewFile()).isFalse();
Review Comment:
Good catch, thanks. replaced the write-probe with
assumeThat(Files.isWritable(metadataDir.toPath())).isFalse() in both tests.
verified passing as non-root and skipped on root.
--
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]