rich7420 commented on code in PR #11879:
URL: https://github.com/apache/ozone/pull/11879#discussion_r4509278170
##########
hadoop-ozone/client/src/test/java/org/apache/hadoop/ozone/client/rpc/TestRpcClient.java:
##########
@@ -702,6 +702,113 @@ public OMResponse submitRequest(OMRequest request) throws
IOException {
}
}
+ @ParameterizedTest
+ @EnumSource(value = OzoneManagerVersion.class, names = {"DEFAULT_VERSION",
"S3_LIST_MULTIPART_UPLOADS_PAGINATION",
+ "ATOMIC_CREATE_IF_NOT_EXISTS", "S3_DERIVED_KEY", "CONDITIONAL_DELETE",
"ZDU", "UNKNOWN_VERSION"})
+ public void testConditionalDeleteOmVersion(OzoneManagerVersion version)
throws IOException {
+ List<OMRequest> requests = new ArrayList<>();
+ RpcClient client = createConditionalRequestClient(requests, version);
+ try {
+ for (String etag : Arrays.asList(null, "etag", "*", "")) {
+ requests.clear();
+ IOException error = assertThrows(IOException.class,
+ () -> client.deleteKey("vol", "bucket", "key", false, etag));
+ if (etag == null ||
OzoneManagerVersion.CONDITIONAL_DELETE.isSupportedBy(version)) {
+ assertThat(error).hasMessage("request sent");
+ assertThat(requests).hasSize(1);
+ KeyArgs args = requests.get(0).getDeleteKeyRequest().getKeyArgs();
+ assertThat(args.hasExpectedETag()).isEqualTo(etag != null);
+ if (etag != null) {
+ assertThat(args.getExpectedETag()).isEqualTo(etag);
+ }
+ } else {
+ assertThat(error).hasMessage("OzoneManager does not support
conditional key deletion.");
+ assertThat(requests).isEmpty();
+ }
+ }
+ requests.clear();
+ assertThat(assertThrows(IOException.class, () -> client.deleteKey("vol",
"bucket", "key", false)))
+ .hasMessage("request sent");
+ assertThat(requests).hasSize(1);
+
assertThat(requests.get(0).getDeleteKeyRequest().getKeyArgs().hasExpectedETag()).isFalse();
+ } finally {
+ client.close();
+ }
+ }
+
+ @ParameterizedTest
+ @EnumSource(value = OzoneManagerVersion.class, names = {"DEFAULT_VERSION",
"S3_LIST_MULTIPART_UPLOADS_PAGINATION",
+ "ATOMIC_CREATE_IF_NOT_EXISTS", "S3_DERIVED_KEY", "CONDITIONAL_DELETE",
"ZDU", "UNKNOWN_VERSION"})
Review Comment:
Trimmed to the versions just before and at the gate.
##########
hadoop-ozone/client/src/test/java/org/apache/hadoop/ozone/client/rpc/TestRpcClient.java:
##########
@@ -702,6 +702,113 @@ public OMResponse submitRequest(OMRequest request) throws
IOException {
}
}
+ @ParameterizedTest
+ @EnumSource(value = OzoneManagerVersion.class, names = {"DEFAULT_VERSION",
"S3_LIST_MULTIPART_UPLOADS_PAGINATION",
+ "ATOMIC_CREATE_IF_NOT_EXISTS", "S3_DERIVED_KEY", "CONDITIONAL_DELETE",
"ZDU", "UNKNOWN_VERSION"})
+ public void testConditionalDeleteOmVersion(OzoneManagerVersion version)
throws IOException {
+ List<OMRequest> requests = new ArrayList<>();
+ RpcClient client = createConditionalRequestClient(requests, version);
+ try {
+ for (String etag : Arrays.asList(null, "etag", "*", "")) {
Review Comment:
Done, thanks!
--
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]