This is an automated email from the ASF dual-hosted git repository.

adoroszlai pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/ozone.git


The following commit(s) were added to refs/heads/master by this push:
     new ad7e8b32a7 HDDS-11288. Add tests for quota level boundary conditions 
(#7049)
ad7e8b32a7 is described below

commit ad7e8b32a749defeb1de6171334952157c6b4d9b
Author: jyotirmoy-gh <[email protected]>
AuthorDate: Mon Aug 12 00:59:04 2024 +0530

    HDDS-11288. Add tests for quota level boundary conditions (#7049)
---
 .../src/main/smoketest/basic/ozone-shell-lib.robot | 29 +++++++++++++++++--
 .../hadoop/ozone/shell/TestOzoneShellHA.java       | 33 ++++++++++++++++++++++
 2 files changed, 60 insertions(+), 2 deletions(-)

diff --git a/hadoop-ozone/dist/src/main/smoketest/basic/ozone-shell-lib.robot 
b/hadoop-ozone/dist/src/main/smoketest/basic/ozone-shell-lib.robot
index 83f0a1b69e..719cdaf83f 100644
--- a/hadoop-ozone/dist/src/main/smoketest/basic/ozone-shell-lib.robot
+++ b/hadoop-ozone/dist/src/main/smoketest/basic/ozone-shell-lib.robot
@@ -92,18 +92,43 @@ Test ozone shell
 
 Test ozone shell errors
     [arguments]     ${protocol}         ${server}       ${volume}
-    ${result} =     Execute and checkrc    ozone sh volume create 
${protocol}${server}/${volume} --space-quota invalid      255
-                    Should contain      ${result}       invalid
+    ${result} =     Execute and checkrc    ozone sh volume create 
${protocol}${server}/${volume} --space-quota 1.5GB      255
+                    Should contain      ${result}       1.5GB is invalid
+    ${result} =     Execute and checkrc    ozone sh volume create 
${protocol}${server}/${volume} --namespace-quota 1.5      255
+                    Should contain      ${result}       1.5 is invalid
                     Execute and checkrc    ozone sh volume create 
${protocol}${server}/${volume}                            0
     ${result} =     Execute and checkrc    ozone sh bucket create 
${protocol}${server}/${volume}/bucket_1                   255
                     Should contain      ${result}       INVALID_BUCKET_NAME
+    ${result} =     Execute and checkrc    ozone sh bucket create 
${protocol}${server}/${volume}/bucket1 --space-quota 1.5GB    255
+                    Should contain      ${result}       1.5GB is invalid
+    ${result} =     Execute and checkrc    ozone sh bucket create 
${protocol}${server}/${volume}/bucket1 --namespace-quota 1.5    255
+                    Should contain      ${result}       1.5 is invalid
     ${result} =     Execute and checkrc    ozone sh bucket create 
${protocol}${server}/${volume}/bucket1 --layout Invalid   2
                     Should contain      ${result}       Usage
                     Execute and checkrc    ozone sh bucket create 
${protocol}${server}/${volume}/bucket1                    0
     ${result} =     Execute and checkrc    ozone sh key info 
${protocol}${server}/${volume}/bucket1/non-existing           255
                     Should contain      ${result}       KEY_NOT_FOUND
     ${result} =     Execute and checkrc    ozone sh key put 
${protocol}${server}/${volume}/bucket1/key1 unexisting --type invalid    2
+    ${result} =     Execute and checkrc    ozone sh bucket setquota 
${volume}/bucket1 --space-quota 1.5                     255
+                    Should contain      ${result}       1.5 is invalid
+    ${result} =     Execute and checkrc    ozone sh bucket setquota 
${volume}/bucket1 --namespace-quota 1.5                 255
+                    Should contain      ${result}       1.5 is invalid
+    ${result} =     Execute and checkrc    ozone sh volume setquota ${volume} 
--space-quota 1.5                             255
+                    Should contain      ${result}       1.5 is invalid
+    ${result} =     Execute and checkrc    ozone sh volume setquota ${volume} 
--namespace-quota 1.5                         255
+                    Should contain      ${result}       1.5 is invalid
+                    Execute and checkrc    ozone sh bucket setquota 
${volume}/bucket1 --space-quota 2KB                     0
+    ${result} =     Execute and checkrc    ozone sh key put 
${volume}/bucket1/key1 /opt/hadoop/NOTICE.txt                   255
+                    Should contain      ${result}       QUOTA_EXCEEDED
+    ${result} =     Execute and checkrc    ozone sh volume setquota ${volume} 
--space-quota 1KB                             255
+                    Should contain      ${result}       QUOTA_EXCEEDED
+                    Execute and checkrc    ozone sh bucket clrquota 
${volume}/bucket1 --space-quota                         0
+    ${result} =     Execute and checkrc    ozone sh volume setquota ${volume} 
--space-quota 1GB                             255
+                    Should contain      ${result}       QUOTA_ERROR
                     Execute and checkrc    ozone sh bucket delete 
${protocol}${server}/${volume}/bucket1                    0
+                    Execute and checkrc    ozone sh volume setquota ${volume} 
--space-quota 1GB                             0
+    ${result} =     Execute and checkrc    ozone sh bucket create 
${protocol}${server}/${volume}/bucket1                    255
+                    Should contain      ${result}       QUOTA_ERROR
                     Execute and checkrc    ozone sh volume delete 
${protocol}${server}/${volume}                            0
 
 
diff --git 
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneShellHA.java
 
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneShellHA.java
index 5a46d571c6..89f068cded 100644
--- 
a/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneShellHA.java
+++ 
b/hadoop-ozone/integration-test/src/test/java/org/apache/hadoop/ozone/shell/TestOzoneShellHA.java
@@ -1568,6 +1568,39 @@ public class TestOzoneShellHA {
         .contains("Missing required parameter");
     out.reset();
 
+    // Test incompatible volume-bucket quota
+    args = new String[]{"volume", "create", "vol6"};
+    execute(ozoneShell, args);
+    out.reset();
+
+    args = new String[]{"bucket", "create", "vol6/buck6"};
+    execute(ozoneShell, args);
+    out.reset();
+
+    args = new String[]{"volume", "setquota", "vol6", "--space-quota", 
"1000B"};
+    executeWithError(ozoneShell, args, "Can not set volume space quota " +
+        "on volume as some of buckets in this volume have no quota set");
+    out.reset();
+
+    args = new String[]{"bucket", "setquota", "vol6/buck6", "--space-quota", 
"1000B"};
+    execute(ozoneShell, args);
+    out.reset();
+
+    args = new String[]{"volume", "setquota", "vol6", "--space-quota", 
"2000B"};
+    execute(ozoneShell, args);
+    out.reset();
+
+    args = new String[]{"bucket", "create", "vol6/buck62"};
+    executeWithError(ozoneShell, args, "Bucket space quota in this " +
+        "volume should be set as volume space quota is already set.");
+    out.reset();
+
+    args = new String[]{"bucket", "create", "vol6/buck62", "--space-quota", 
"2000B"};
+    executeWithError(ozoneShell, args, "Total buckets quota in this volume " +
+        "should not be greater than volume quota : the total space quota is 
set to:3000. " +
+        "But the volume space quota is:2000");
+    out.reset();
+
     // Test set bucket spaceQuota or nameSpaceQuota to normal value.
     String[] bucketArgs8 = new String[]{"bucket", "setquota", "vol4/buck4",
         "--space-quota", "1000B"};


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to