errose28 commented on code in PR #4634:
URL: https://github.com/apache/ozone/pull/4634#discussion_r1194518802


##########
hadoop-ozone/dist/src/main/smoketest/upgrade/snapshot.robot:
##########
@@ -0,0 +1,86 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+*** Settings ***
+Documentation       Smoketest ozone cluster snapshot feature
+Library             OperatingSystem
+Library             BuiltIn
+Resource            ../commonlib.robot
+Test Timeout        5 minutes
+
+*** Variables ***
+
+
+*** Test Cases ***
+Create snapshot
+    [Tags]     snapshot-enabled
+    ${output} =         Execute                ozone sh volume create 
snapvolume-1
+                        Should not contain     ${output}       Failed
+    ${output} =         Execute                ozone sh bucket create 
/snapvolume-1/snapbucket-1
+                        Should not contain     ${output}       Failed
+    ${output} =         Execute                ozone sh snapshot create 
/snapvolume-1/snapbucket-1 snapshot1
+                        Should not contain     ${output}       Failed
+                        Execute and checkrc    echo "key created using Ozone 
Shell" > /tmp/sourcekey    0
+                        Execute                ozone sh key put 
/snapvolume-1/snapbucket-1/key1 /tmp/sourcekey
+                        Execute                ozone sh snapshot create 
/snapvolume-1/snapbucket-1 snapshot2
+
+Attempt to create snapshot when snapshot feature is disabled
+    [Tags]     snapshot-disabled

Review Comment:
   upgrade specific terminology like "pre-finalized" or "finalized" would be 
better for these labels.



##########
hadoop-ozone/dist/src/main/smoketest/upgrade/snapshot.robot:
##########
@@ -0,0 +1,86 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+*** Settings ***
+Documentation       Smoketest ozone cluster snapshot feature
+Library             OperatingSystem
+Library             BuiltIn
+Resource            ../commonlib.robot
+Test Timeout        5 minutes
+
+*** Variables ***
+
+
+*** Test Cases ***
+Create snapshot
+    [Tags]     snapshot-enabled
+    ${output} =         Execute                ozone sh volume create 
snapvolume-1
+                        Should not contain     ${output}       Failed
+    ${output} =         Execute                ozone sh bucket create 
/snapvolume-1/snapbucket-1
+                        Should not contain     ${output}       Failed
+    ${output} =         Execute                ozone sh snapshot create 
/snapvolume-1/snapbucket-1 snapshot1
+                        Should not contain     ${output}       Failed
+                        Execute and checkrc    echo "key created using Ozone 
Shell" > /tmp/sourcekey    0
+                        Execute                ozone sh key put 
/snapvolume-1/snapbucket-1/key1 /tmp/sourcekey
+                        Execute                ozone sh snapshot create 
/snapvolume-1/snapbucket-1 snapshot2
+
+Attempt to create snapshot when snapshot feature is disabled
+    [Tags]     snapshot-disabled
+    ${output} =         Execute And Ignore Error    ozone sh volume create 
snapvolume-2     
+                        Should not contain     ${output}       Failed
+    ${output} =         Execute And Ignore Error    ozone sh bucket create 
/snapvolume-2/snapbucket-1     
+                        Should not contain     ${output}       Failed
+    ${rc}               ${output} =          Run And Return Rc And Output      
 ozone sh snapshot create /snapvolume-2/snapbucket-1 snapshot1
+                        Should be True        ${rc} != 0

Review Comment:
   Since this is an upgrade specific snapshot test, it would be better to check 
that the command failed for the correct reason (OM pre-finalized) instead of 
just for a generic failure. See upgrade-ec-check.robot for examples.



##########
hadoop-ozone/dist/src/main/smoketest/upgrade/snapshot.robot:
##########
@@ -0,0 +1,86 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more

Review Comment:
   Currently the smoketest/upgrade directory has tests for common upgrade 
functionality, and feature specific upgrade tests are in their own directory 
with upgrade specific names. See `upgrade-ec-check.robot` for an example. We 
should try to keep that layout consistent here too.



##########
hadoop-ozone/dist/src/main/smoketest/upgrade/snapshot.robot:
##########
@@ -0,0 +1,86 @@
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+*** Settings ***
+Documentation       Smoketest ozone cluster snapshot feature
+Library             OperatingSystem
+Library             BuiltIn
+Resource            ../commonlib.robot
+Test Timeout        5 minutes
+
+*** Variables ***
+
+
+*** Test Cases ***
+Create snapshot
+    [Tags]     snapshot-enabled
+    ${output} =         Execute                ozone sh volume create 
snapvolume-1
+                        Should not contain     ${output}       Failed
+    ${output} =         Execute                ozone sh bucket create 
/snapvolume-1/snapbucket-1
+                        Should not contain     ${output}       Failed
+    ${output} =         Execute                ozone sh snapshot create 
/snapvolume-1/snapbucket-1 snapshot1
+                        Should not contain     ${output}       Failed
+                        Execute and checkrc    echo "key created using Ozone 
Shell" > /tmp/sourcekey    0
+                        Execute                ozone sh key put 
/snapvolume-1/snapbucket-1/key1 /tmp/sourcekey
+                        Execute                ozone sh snapshot create 
/snapvolume-1/snapbucket-1 snapshot2
+
+Attempt to create snapshot when snapshot feature is disabled
+    [Tags]     snapshot-disabled
+    ${output} =         Execute And Ignore Error    ozone sh volume create 
snapvolume-2     
+                        Should not contain     ${output}       Failed
+    ${output} =         Execute And Ignore Error    ozone sh bucket create 
/snapvolume-2/snapbucket-1     
+                        Should not contain     ${output}       Failed
+    ${rc}               ${output} =          Run And Return Rc And Output      
 ozone sh snapshot create /snapvolume-2/snapbucket-1 snapshot1
+                        Should be True        ${rc} != 0

Review Comment:
   For checking the return code, `Execute and checkrc` from `lib.resource` is 
more idiomatic. This is also what `upgrade-ec-check.robot` uses for checks like 
this:
   ```robot
   ${result} =     Execute and checkrc     ozone sh key put -r rs-3-2-1024k -t 
EC /ectest/testpropchange/core-site.xml /etc/hadoop/core-site.xml     255
   Should contain  ${result}   NOT_SUPPORTED_OPERATION
   ```



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