rich7420 commented on code in PR #11843:
URL: https://github.com/apache/ozone/pull/11843#discussion_r4550150279
##########
hadoop-hdds/server-scm/src/test/java/org/apache/hadoop/hdds/scm/protocol/TestStorageContainerLocationProtocolServerSideTranslatorPB.java:
##########
@@ -157,6 +168,83 @@ void
testGetExistingContainersInBatchRejectsECForLegacyClient() throws Exception
assertThrows(ServiceException.class, () -> service.submitRequest(null,
request));
}
+ @Test
+ void testSubmitContainerIdExportRoundTrip() throws Exception {
+ when(impl.submitContainerIdExport(any(), any(), any(), anyLong(),
anyInt(), anyInt())).thenReturn("job-1");
+ StorageContainerLocationProtocolClientSideTranslatorPB client =
metadataClient();
+
+ assertEquals("job-1", client.submitContainerIdExport(
+ ContainerID.valueOf(7), LifeCycleState.CLOSED,
ContainerHealthState.MISSING, 1000, 20, 30));
+ verify(impl).submitContainerIdExport(
+ ContainerID.valueOf(7), LifeCycleState.CLOSED,
ContainerHealthState.MISSING, 1000, 20, 30);
+
+ // Every optional argument left out reaches the server as null / 0.
+ client.submitContainerIdExport(null, null, ContainerHealthState.EMPTY, 0,
0, 0);
+ verify(impl).submitContainerIdExport(isNull(), isNull(),
eq(ContainerHealthState.EMPTY), eq(0L), eq(0), eq(0));
+ }
+
+ @Test
+ void testSubmitContainerIdExportRejectsUnknownHealthStateWithoutRetry()
throws Exception {
+ StorageContainerLocationProtocolClientSideTranslatorPB client =
metadataClient();
Review Comment:
Nit: `client` isn't used in this test. The `assertThat(client).isNotNull()`
at the end only keeps it referenced. Could we drop both lines?
##########
hadoop-hdds/server-scm/src/main/java/org/apache/hadoop/hdds/scm/server/SCMClientProtocolServer.java:
##########
@@ -1772,6 +1774,49 @@ public List<Long> suppressContainers(List<Long>
containerIds, boolean suppress)
return failedContainerIDs;
}
+ @Override
+ public String submitContainerIdExport(ContainerID startContainerId,
HddsProtos.LifeCycleState lifeCycleState,
+ ContainerHealthState healthState, long maxRows, int batchSize, int
partSize) throws IOException {
+ getScm().checkAdminAccess(getRemoteUser(), false);
Review Comment:
Thanks for the tests. I flipped this to `true` and swapped each
`NonRetriableException` for `IOException` locally, and the new tests caught
every change.
--
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]