smengcl commented on a change in pull request #3018:
URL: https://github.com/apache/ozone/pull/3018#discussion_r797883223



##########
File path: 
hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/om/multitenant/TestMultiTenantVolume.java
##########
@@ -77,14 +82,52 @@ public void testDefaultS3Volume() throws Exception {
     assertS3BucketNotFound(store, bucketName);
   }
 
+  private void expectFailurePreFinalization(VoidCallable eval)
+      throws Exception {
+    LambdaTestUtils.intercept(OMException.class,
+        "cannot be invoked before finalization", eval);
+  }
+
   @Test
   public void testS3TenantVolume() throws Exception {
+
     final String tenant = "tenant";
     final String principal = "username";
     final String bucketName = "bucket";
     final String accessID = UUID.randomUUID().toString();
 
     ObjectStore store = getStoreForAccessID(accessID);
+
+    // None of the tenant APIs is usable before the upgrade finalization step
+    expectFailurePreFinalization(store::listTenant);
+    expectFailurePreFinalization(() -> store.listUsersInTenant(tenant, ""));
+    expectFailurePreFinalization(() -> store.tenantGetUserInfo(principal));
+    expectFailurePreFinalization(() -> store.createTenant(tenant));
+    expectFailurePreFinalization(() ->
+        store.tenantAssignUserAccessId(principal, tenant, accessID));
+    expectFailurePreFinalization(() ->
+        store.tenantAssignAdmin(principal, tenant, true));
+    expectFailurePreFinalization(() ->
+        store.tenantRevokeAdmin(accessID, tenant));
+    expectFailurePreFinalization(() ->
+        store.tenantRevokeUserAccessId(accessID));
+    expectFailurePreFinalization(() -> store.deleteTenant(tenant));
+
+    // S3 get/set/revoke secret APIs still work before finalization
+    final String accessId = "testUser1accessId1";
+    S3SecretValue s3SecretValue = store.getS3Secret(accessId);
+    Assert.assertEquals(accessId, s3SecretValue.getAwsAccessKey());
+    final String setSecret = "testsecret";
+    s3SecretValue = store.setS3Secret(accessId, setSecret);
+    Assert.assertEquals(accessId, s3SecretValue.getAwsAccessKey());
+    Assert.assertEquals(setSecret, s3SecretValue.getAwsSecret());
+    store.revokeS3Secret(accessId);
+
+
+    // Trigger OM finalization
+    cluster.getOzoneManager().finalizeUpgrade("clientId1");

Review comment:
       done.




-- 
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]

Reply via email to