diff --git a/hadoop-ozone/dist/src/main/compose/ozone/test.sh b/hadoop-ozone/dist/src/main/compose/ozone/test.sh index b77bd55c1f3f..e0b1d62ade08 100755 --- a/hadoop-ozone/dist/src/main/compose/ozone/test.sh +++ b/hadoop-ozone/dist/src/main/compose/ozone/test.sh @@ -32,11 +32,14 @@ start_docker_env #Disabling for now, audit parser tool during parse getting exception. #execute_robot_test om auditparser +execute_robot_test scm lib + execute_robot_test scm basic execute_robot_test scm gdpr -execute_robot_test scm ozonefs/ozonefs.robot +execute_robot_test scm -v SCHEME:ofs ozonefs/ozonefs.robot +execute_robot_test scm -v SCHEME:o3fs ozonefs/ozonefs.robot execute_robot_test scm security/ozone-secure-token.robot diff --git a/hadoop-ozone/dist/src/main/compose/ozonesecure/test.sh b/hadoop-ozone/dist/src/main/compose/ozonesecure/test.sh index d1bdd0d617ed..bbdf5d3d8e6b 100755 --- a/hadoop-ozone/dist/src/main/compose/ozonesecure/test.sh +++ b/hadoop-ozone/dist/src/main/compose/ozonesecure/test.sh @@ -31,7 +31,8 @@ execute_robot_test scm basic execute_robot_test scm security -execute_robot_test scm ozonefs/ozonefs.robot +execute_robot_test scm -v SCHEME:ofs ozonefs/ozonefs.robot +execute_robot_test scm -v SCHEME:o3fs ozonefs/ozonefs.robot execute_robot_test s3g s3 diff --git a/hadoop-ozone/dist/src/main/compose/testlib.sh b/hadoop-ozone/dist/src/main/compose/testlib.sh index d6b4974b0e7f..15d1664ed80c 100755 --- a/hadoop-ozone/dist/src/main/compose/testlib.sh +++ b/hadoop-ozone/dist/src/main/compose/testlib.sh @@ -25,6 +25,8 @@ SMOKETEST_DIR_INSIDE="${OZONE_DIR:-/opt/hadoop}/smoketest" OM_HA_PARAM="" if [[ -n "${OM_SERVICE_ID}" ]]; then OM_HA_PARAM="--om-service-id=${OM_SERVICE_ID}" +else + OM_SERVICE_ID=om fi ## @description create results directory, purging any prior data @@ -113,7 +115,7 @@ execute_robot_test(){ OUTPUT_PATH="$RESULT_DIR_INSIDE/${OUTPUT_FILE}" # shellcheck disable=SC2068 docker-compose -f "$COMPOSE_FILE" exec -T "$CONTAINER" mkdir -p "$RESULT_DIR_INSIDE" \ - && docker-compose -f "$COMPOSE_FILE" exec -T -e SECURITY_ENABLED="${SECURITY_ENABLED}" -e OM_HA_PARAM="${OM_HA_PARAM}" -e OM_SERVICE_ID="${OM_SERVICE_ID}" "$CONTAINER" robot ${ARGUMENTS[@]} --log NONE -N "$TEST_NAME" --report NONE "${OZONE_ROBOT_OPTS[@]}" --output "$OUTPUT_PATH" "$SMOKETEST_DIR_INSIDE/$TEST" + && docker-compose -f "$COMPOSE_FILE" exec -T "$CONTAINER" robot -v OM_SERVICE_ID:"${OM_SERVICE_ID}" -v SECURITY_ENABLED:"${SECURITY_ENABLED}" -v OM_HA_PARAM:"${OM_HA_PARAM}" ${ARGUMENTS[@]} --log NONE -N "$TEST_NAME" --report NONE "${OZONE_ROBOT_OPTS[@]}" --output "$OUTPUT_PATH" "$SMOKETEST_DIR_INSIDE/$TEST" local -i rc=$? FULL_CONTAINER_NAME=$(docker-compose -f "$COMPOSE_FILE" ps | grep "_${CONTAINER}_" | head -n 1 | awk '{print $1}') diff --git a/hadoop-ozone/dist/src/main/smoketest/commonlib.robot b/hadoop-ozone/dist/src/main/smoketest/commonlib.robot index 133c63ec9d14..407111a8030c 100644 --- a/hadoop-ozone/dist/src/main/smoketest/commonlib.robot +++ b/hadoop-ozone/dist/src/main/smoketest/commonlib.robot @@ -19,9 +19,9 @@ Library String Library BuiltIn *** Variables *** -${SECURITY_ENABLED} %{SECURITY_ENABLED} -${OM_HA_PARAM} %{OM_HA_PARAM} -${OM_SERVICE_ID} %{OM_SERVICE_ID} +${SECURITY_ENABLED} false +${OM_HA_PARAM} ${EMPTY} +${OM_SERVICE_ID} om *** Keywords *** Execute diff --git a/hadoop-ozone/dist/src/main/smoketest/lib/fs.robot b/hadoop-ozone/dist/src/main/smoketest/lib/fs.robot new file mode 100644 index 000000000000..b783a5b131f8 --- /dev/null +++ b/hadoop-ozone/dist/src/main/smoketest/lib/fs.robot @@ -0,0 +1,50 @@ +# 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 *** +Resource string.robot + + +*** Variables *** +${OM_SERVICE_ID} om + + +*** Keywords *** +Format FS URL + [arguments] ${scheme} ${volume} ${bucket} ${path}=${EMPTY} + + ${url} = Run Keyword If '${scheme}' == 'o3fs' Format o3fs URL ${volume} ${bucket} ${path} + ... ELSE IF '${scheme}' == 'ofs' Format ofs URL ${volume} ${bucket} ${path} + ... ELSE Fail Unsupported FS scheme: ${scheme} + + [return] ${url} + +Format o3fs URL + [arguments] ${volume} ${bucket} ${path}=${EMPTY} ${om}=${OM_SERVICE_ID} + ${om_with_leading} = Run Keyword If '${om}' != '${EMPTY}' Ensure Leading . ${om} + ... ELSE Set Variable ${EMPTY} + [return] o3fs://${bucket}.${volume}${om_with_leading}/${path} + +Format ofs URL + [arguments] ${volume} ${bucket} ${path}=${EMPTY} ${om}=${OM_SERVICE_ID} + + ${om_with_trailing} = Run Keyword If '${om}' != '${EMPTY}' Ensure Trailing / ${om} + ... ELSE Set Variable ${EMPTY} + + ${path_with_leading} = Run Keyword If '${path}' != '${EMPTY}' Ensure Leading / ${path} + ... ELSE Set Variable ${EMPTY} + + [return] ofs://${om_with_trailing}${volume}/${bucket}${path_with_leading} + diff --git a/hadoop-ozone/dist/src/main/smoketest/lib/fs_tests.robot b/hadoop-ozone/dist/src/main/smoketest/lib/fs_tests.robot new file mode 100644 index 000000000000..a1a993c040c1 --- /dev/null +++ b/hadoop-ozone/dist/src/main/smoketest/lib/fs_tests.robot @@ -0,0 +1,63 @@ +# 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 *** +Resource fs.robot + + +*** Test Cases *** + +Format o3fs URL without path + ${result} = Format o3fs URL vol1 bucket1 + Should Be Equal ${result} o3fs://bucket1.vol1.om/ + +Format o3fs URL with path + ${result} = Format o3fs URL vol1 bucket1 dir/file + Should Be Equal ${result} o3fs://bucket1.vol1.om/dir/file + +Format o3fs URL with OM + ${result} = Format o3fs URL vol1 bucket1 dir/file omservice + Should Be Equal ${result} o3fs://bucket1.vol1.omservice/dir/file + + +Format ofs URL without path + ${result} = Format ofs URL vol1 bucket1 + Should Be Equal ${result} ofs://om/vol1/bucket1 + +Format ofs URL with path + ${result} = Format ofs URL vol1 bucket1 dir/file + Should Be Equal ${result} ofs://om/vol1/bucket1/dir/file + +Format ofs URL with OM + ${result} = Format ofs URL vol1 bucket1 dir/file om:1234 + Should Be Equal ${result} ofs://om:1234/vol1/bucket1/dir/file + + +Format FS URL with ofs scheme + ${result} = Format FS URL ofs vol1 bucket1 + ${expected} = Format ofs URL vol1 bucket1 + Should Be Equal ${result} ${expected} + +Format FS URL with o3fs scheme + ${result} = Format FS URL o3fs vol1 bucket1 + ${expected} = Format o3fs URL vol1 bucket1 + Should Be Equal ${result} ${expected} + +Format FS URL with unsupported scheme + ${result} = Run Keyword And Expect Error * Format FS URL http org apache + Should Contain ${result} http + Should Contain ${result} nsupported + + diff --git a/hadoop-ozone/dist/src/main/smoketest/lib/string.robot b/hadoop-ozone/dist/src/main/smoketest/lib/string.robot new file mode 100644 index 000000000000..bc892996cfee --- /dev/null +++ b/hadoop-ozone/dist/src/main/smoketest/lib/string.robot @@ -0,0 +1,37 @@ +# 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 *** +Library String + + +*** Keywords *** +Ensure Leading + [arguments] ${char} ${string} + + ${first} = Get Substring ${string} 0 1 + ${result} = Set Variable If '${first}' == '${char}' ${string} ${char}${string} + + [return] ${result} + + +Ensure Trailing + [arguments] ${char} ${string} + + ${last} = Get Substring ${string} -1 + ${result} = Set Variable If '${last}' == '${char}' ${string} ${string}${char} + + [return] ${result} + diff --git a/hadoop-ozone/dist/src/main/smoketest/lib/string_tests.robot b/hadoop-ozone/dist/src/main/smoketest/lib/string_tests.robot new file mode 100644 index 000000000000..0dd1544a9287 --- /dev/null +++ b/hadoop-ozone/dist/src/main/smoketest/lib/string_tests.robot @@ -0,0 +1,46 @@ +# 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 *** +Resource string.robot + + +*** Test Cases *** + +Ensure Leading without Leading + ${result} = Ensure Leading / a/b + Should Be Equal ${result} /a/b + +Ensure Leading with Leading + ${result} = Ensure Leading _ _a_b_c + Should Be Equal ${result} _a_b_c + +Ensure Leading for empty + ${result} = Ensure Leading | ${EMPTY} + Should Be Equal ${result} | + + +Ensure Trailing without Trailing + ${result} = Ensure Trailing . x.y.z + Should Be Equal ${result} x.y.z. + +Ensure Trailing with Trailing + ${result} = Ensure Trailing x axbxcx + Should Be Equal ${result} axbxcx + +Ensure Trailing for empty + ${result} = Ensure Trailing = ${EMPTY} + Should Be Equal ${result} = + diff --git a/hadoop-ozone/dist/src/main/smoketest/ozonefs/ozonefs.robot b/hadoop-ozone/dist/src/main/smoketest/ozonefs/ozonefs.robot index e6ab0d3ee929..6d0042b30496 100644 --- a/hadoop-ozone/dist/src/main/smoketest/ozonefs/ozonefs.robot +++ b/hadoop-ozone/dist/src/main/smoketest/ozonefs/ozonefs.robot @@ -14,135 +14,127 @@ # limitations under the License. *** Settings *** -Documentation Ozonefs test covering both o3fs and ofs +Documentation Ozone FS tests Library OperatingSystem Resource ../commonlib.robot +Resource setup.robot Test Timeout 5 minutes - -*** Variables *** -${OfsBucket1} om:9862/fstest/bucket1 -${O3fsBucket1} bucket1.fstest/ -${O3Bucket1} o3://om/fstest/bucket1 -${O3Bucket2} o3://om/fstest/bucket2 -${O3Bucket3} o3://om/fstest2/bucket3 - -${OfsNonExistBucket} om:9862/abc/def -${O3fsNonExistBucket} def.abc/ -${NonExistVolume} abc +Suite Setup Setup ${BUCKET_TYPE}s for FS test *** Test Cases *** -Create volume and bucket for Ozone file System test - Execute ozone sh volume create o3://om/fstest --quota 100TB - Execute ozone sh bucket create ${O3Bucket1} - Execute ozone sh bucket create ${O3Bucket2} - - Execute ozone sh volume create o3://om/fstest2 --quota 100TB - Execute ozone sh bucket create ${O3Bucket3} - - -Check volume from o3fs - ${result} = Execute ozone sh volume list - Should contain ${result} fstest - Should contain ${result} fstest2 - Should Match Regexp ${result} "admin" : "(hadoop|testuser\/scm@EXAMPLE\.COM)" - ${result} = Execute ozone fs -ls o3fs://${O3fsBucket1} - -Test ozone shell with ofs - Test ozone shell with scheme ofs om:9862/fstest/bucket1 om:9862/fstest/bucket2 om:9862/fstest2/bucket3 om:9862/abc/def - -Test ozone shell with o3fs - Test ozone shell with scheme o3fs bucket1.fstest/ bucket2.fstest/ bucket3.fstest2/ def.abc/ +List root + ${root} = Format FS URL ${SCHEME} ${VOLUME} ${BUCKET} + Execute ozone fs -ls ${root} + +List non-existent volume + ${url} = Format FS URL ${SCHEME} no-such-volume ${BUCKET} + ${result} = Execute and checkrc ozone fs -ls ${url} 1 + Should Match Regexp ${result} (Check access operation failed)|(Volume no-such-volume is not found)|(No such file or directory) + +List non-existent bucket + ${url} = Format FS URL ${SCHEME} ${VOLUME} no-such-bucket + ${result} = Execute and checkrc ozone fs -ls ${url} 1 + Should Match Regexp ${result} (Check access operation failed)|(Bucket not found)|(No such file or directory) + +Create dir with parents + Execute ozone fs -mkdir -p ${DEEP_URL} + ${result} = Execute ozone sh key list ${VOLUME}/${BUCKET} | jq -r '.name' + Should contain ${result} ${DEEP_DIR} + +Copy from local + Execute ozone fs -copyFromLocal NOTICE.txt ${DEEP_URL}/ + ${result} = Execute ozone sh key list ${VOLUME}/${BUCKET} | jq -r '.name' + Should contain ${result} NOTICE.txt + ${result} = Execute ozone sh key info ${VOLUME}/${BUCKET}/${DEEP_DIR}/NOTICE.txt | jq -r '.replicationFactor' + Should Be Equal ${result} 3 + +Put + Execute ozone fs -put NOTICE.txt ${DEEP_URL}/PUTFILE.txt + ${result} = Execute ozone sh key list ${VOLUME}/${BUCKET} | jq -r '.name' + Should contain ${result} PUTFILE.txt + +List + ${result} = Execute ozone fs -ls ${DEEP_URL}/ + Should contain ${result} NOTICE.txt + Should contain ${result} PUTFILE.txt + +Move + Execute ozone fs -mv ${DEEP_URL}/NOTICE.txt ${DEEP_URL}/MOVED.TXT + ${result} = Execute ozone sh key list ${VOLUME}/${BUCKET} | jq -r '.name' + Should contain ${result} MOVED.TXT + Should not contain ${result} NOTICE.txt + +Copy within FS + [Setup] Execute ozone fs -mkdir -p ${DEEP_URL}/subdir1 + Execute ozone fs -cp ${DEEP_URL}/MOVED.TXT ${DEEP_URL}/subdir1/NOTICE.txt + ${result} = Execute ozone sh key list ${VOLUME}/${BUCKET} | jq -r '.name' + Should contain ${result} subdir1/NOTICE.txt + + ${result} = Execute ozone fs -ls ${DEEP_URL}/subdir1/ + Should contain ${result} NOTICE.txt + Should not contain ${result} Failed + +Cat file + Execute ozone fs -cat ${DEEP_URL}/subdir1/NOTICE.txt + +Delete file + Execute ozone fs -rm ${DEEP_URL}/subdir1/NOTICE.txt + ${result} = Execute ozone sh key list ${VOLUME}/${BUCKET} | jq -r '.name' + Should not contain ${result} NOTICE.txt + +Delete dir + ${result} = Execute ozone fs -rmdir ${DEEP_URL}/subdir1/ + ${result} = Execute ozone sh key list ${VOLUME}/${BUCKET} | jq -r '.name' + Should not contain ${result} subdir1 + +Touch file + Execute ozone fs -touch ${DEEP_URL}/TOUCHFILE-${SCHEME}.txt + ${result} = Execute ozone sh key list ${VOLUME}/${BUCKET} | jq -r '.name' + Should contain ${result} TOUCHFILE-${SCHEME}.txt + +Delete recursively + Execute ozone fs -rm -r ${DEEP_URL}/ + ${result} = Execute ozone sh key list ${VOLUME}/${BUCKET} | jq -r '.name' + Should not contain ${result} ${DEEP_DIR} + +List recursively + [Setup] Setup localdir1 + ${result} = Execute ozone fs -ls -R ${BASE_URL}testdir1/ + Should contain ${result} localdir1/LOCAL.txt + Should contain ${result} testdir1/NOTICE.txt + +Copy to other bucket + ${target} = Format FS URL ${SCHEME} ${VOLUME} ${BUCKET2} testdir2 + Execute ozone fs -mkdir -p ${target} + Execute ozone fs -cp ${BASE_URL}/testdir1/localdir1 ${target} + [Teardown] Execute ozone fs -rm -r ${target} + +Copy to other volume + ${target} = Format FS URL ${SCHEME} ${VOL2} ${BUCKET_IN_VOL2} testdir3 + Execute ozone fs -mkdir -p ${target} + Execute ozone fs -cp ${BASE_URL}/testdir1/localdir1 ${target} + [Teardown] Execute ozone fs -rm -r ${target} + +List file created via shell + [Setup] Execute ozone sh key put ${VOLUME}/${BUCKET}/${SCHEME}.txt NOTICE.txt + ${result} = Execute ozone fs -ls ${BASE_URL}${SCHEME}.txt + Should contain ${result} ${SCHEME}.txt + +Reject overwrite existing + ${result} = Execute and checkrc ozone fs -copyFromLocal NOTICE.txt ${BASE_URL}${SCHEME}.txt 1 + Should contain ${result} File exists + +Get file + [Setup] Execute rm -Rf /tmp/GET.txt + Execute ozone fs -get ${BASE_URL}${SCHEME}.txt /tmp/GET.txt + File Should Exist /tmp/GET.txt *** Keywords *** -Test ozone shell with scheme - [arguments] ${scheme} ${testBucket1} ${testBucket2} ${testBucket3} ${nonExistBucket} - - ${result} = Execute ozone fs -ls ${scheme}://${testBucket1} - Execute ozone fs -mkdir -p ${scheme}://${testBucket1}/testdir/deep - ${result} = Execute ozone sh key list ${O3Bucket1} | jq -r '.name' - Should contain ${result} testdir/deep - - Execute ozone fs -copyFromLocal NOTICE.txt ${scheme}://${testBucket1}/testdir/deep/ - ${result} = Execute ozone sh key list ${O3Bucket1} | jq -r '.name' - Should contain ${result} NOTICE.txt - ${result} = Execute ozone sh key info o3://om/fstest/bucket1/testdir/deep/NOTICE.txt | jq -r '.replicationFactor' - Should Be Equal ${result} 3 - - Execute ozone fs -put NOTICE.txt ${scheme}://${testBucket1}/testdir/deep/PUTFILE.txt - ${result} = Execute ozone sh key list ${O3Bucket1} | jq -r '.name' - Should contain ${result} PUTFILE.txt - - ${result} = Execute ozone fs -ls ${scheme}://${testBucket1}/testdir/deep/ - Should contain ${result} NOTICE.txt - Should contain ${result} PUTFILE.txt - - Execute ozone fs -mv ${scheme}://${testBucket1}/testdir/deep/NOTICE.txt ${scheme}://${testBucket1}/testdir/deep/MOVED.TXT - ${result} = Execute ozone sh key list ${O3Bucket1} | jq -r '.name' - Should contain ${result} MOVED.TXT - Should not contain ${result} NOTICE.txt - - Execute ozone fs -mkdir -p ${scheme}://${testBucket1}/testdir/deep/subdir1 - Execute ozone fs -cp ${scheme}://${testBucket1}/testdir/deep/MOVED.TXT ${scheme}://${testBucket1}/testdir/deep/subdir1/NOTICE.txt - ${result} = Execute ozone sh key list ${O3Bucket1} | jq -r '.name' - Should contain ${result} subdir1/NOTICE.txt - - ${result} = Execute ozone fs -ls ${scheme}://${testBucket1}/testdir/deep/subdir1/ - Should contain ${result} NOTICE.txt - - Execute ozone fs -cat ${scheme}://${testBucket1}/testdir/deep/subdir1/NOTICE.txt - Should not contain ${result} Failed - - Execute ozone fs -rm ${scheme}://${testBucket1}/testdir/deep/subdir1/NOTICE.txt - ${result} = Execute ozone sh key list ${O3Bucket1} | jq -r '.name' - Should not contain ${result} NOTICE.txt - - ${result} = Execute ozone fs -rmdir ${scheme}://${testBucket1}/testdir/deep/subdir1/ - ${result} = Execute ozone sh key list ${O3Bucket1} | jq -r '.name' - Should not contain ${result} subdir1 - - Execute ozone fs -touch ${scheme}://${testBucket1}/testdir/TOUCHFILE.txt - ${result} = Execute ozone sh key list ${O3Bucket1} | jq -r '.name' - Should contain ${result} TOUCHFILE.txt - - Execute ozone fs -rm -r ${scheme}://${testBucket1}/testdir/ - ${result} = Execute ozone sh key list ${O3Bucket1} | jq -r '.name' - Should not contain ${result} testdir - - Execute rm -Rf /tmp/localdir1 - Execute mkdir /tmp/localdir1 - Execute cp NOTICE.txt /tmp/localdir1/LOCAL.txt - Execute ozone fs -mkdir -p ${scheme}://${testBucket1}/testdir1 - Execute ozone fs -copyFromLocal /tmp/localdir1 ${scheme}://${testBucket1}/testdir1/ - Execute ozone fs -put NOTICE.txt ${scheme}://${testBucket1}/testdir1/NOTICE.txt - - ${result} = Execute ozone fs -ls -R ${scheme}://${testBucket1}/testdir1/ - Should contain ${result} localdir1/LOCAL.txt - Should contain ${result} testdir1/NOTICE.txt - - Execute ozone fs -mkdir -p ${scheme}://${testBucket2}/testdir2 - Execute ozone fs -mkdir -p ${scheme}://${testBucket3}/testdir3 - - Execute ozone fs -cp ${scheme}://${testBucket1}/testdir1/localdir1 ${scheme}://${testBucket2}/testdir2/ - Execute ozone fs -cp ${scheme}://${testBucket1}/testdir1/localdir1 ${scheme}://${testBucket3}/testdir3/ - - Execute ozone sh key put ${O3Bucket1}/KEY.txt NOTICE.txt - ${result} = Execute ozone fs -ls ${scheme}://${testBucket1}/KEY.txt - Should contain ${result} KEY.txt - - ${rc} ${result} = Run And Return Rc And Output ozone fs -copyFromLocal NOTICE.txt ${scheme}://${testBucket1}/KEY.txt - Should Be Equal As Integers ${rc} 1 - Should contain ${result} File exists - - Execute rm -Rf /tmp/GET.txt - Execute ozone fs -get ${scheme}://${testBucket1}/KEY.txt /tmp/GET.txt - Execute ls -l /tmp/GET.txt - - ${rc} ${result} = Run And Return Rc And Output ozone fs -ls ${scheme}://${nonExistBucket} - Should Be Equal As Integers ${rc} 1 - Should Match Regexp ${result} (Check access operation failed)|(Volume ${nonExistVolume} is not found)|(No such file or directory) - -# Final clean up before next run - Execute ozone fs -rm -r ${scheme}://${testBucket1}/testdir1/ - Execute ozone fs -rm -r ${scheme}://${testBucket2}/testdir2/ - Execute ozone fs -rm -r ${scheme}://${testBucket3}/testdir3/ - Execute ozone fs -rm -r ${scheme}://${testBucket1}/* \ No newline at end of file + +Setup localdir1 + Execute rm -Rf /tmp/localdir1 + Execute mkdir /tmp/localdir1 + Execute cp NOTICE.txt /tmp/localdir1/LOCAL.txt + Execute ozone fs -mkdir -p ${BASE_URL}testdir1 + Execute ozone fs -copyFromLocal /tmp/localdir1 ${BASE_URL}testdir1/ + Execute ozone fs -put NOTICE.txt ${BASE_URL}testdir1/NOTICE.txt diff --git a/hadoop-ozone/dist/src/main/smoketest/ozonefs/setup.robot b/hadoop-ozone/dist/src/main/smoketest/ozonefs/setup.robot new file mode 100644 index 000000000000..16e059ede721 --- /dev/null +++ b/hadoop-ozone/dist/src/main/smoketest/ozonefs/setup.robot @@ -0,0 +1,60 @@ +# 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 Setup for Ozone FS tests +Resource ../commonlib.robot +Resource ../lib/fs.robot + +*** Variables *** +${SCHEME} ofs +${BUCKET_TYPE} bucket +${VOLUME} fstest1 +${VOL2} fstest2 +${BUCKET} ${BUCKET_TYPE}1-${SCHEME} +${BUCKET2} ${BUCKET_TYPE}2-${SCHEME} +${BUCKET_IN_VOL2} ${BUCKET_TYPE}3-${SCHEME} +${DEEP_DIR} test/${SCHEME}/dir + +*** Keywords *** +Setup buckets for FS test + Create volumes for FS test + Create buckets for FS test + Sanity check for FS test + Assign suite vars for FS test + Log Completed setup for ${SCHEME} tests in ${VOLUME}/${BUCKET} using FS base URL: ${BASE_URL} + +Create volumes for FS test + Execute And Ignore Error ozone sh volume create ${VOLUME} --quota 100TB + Execute And Ignore Error ozone sh volume create ${VOL2} --quota 100TB + +Create buckets for FS test + Execute ozone sh bucket create ${VOLUME}/${BUCKET} + Execute ozone sh bucket create ${VOLUME}/${BUCKET2} + Execute ozone sh bucket create ${VOL2}/${BUCKET_IN_VOL2} + +Sanity check for FS test + ${result} = Execute ozone sh volume list + Should contain ${result} ${VOLUME} + Should contain ${result} ${VOL2} + Should Match Regexp ${result} "admin" : "(hadoop|testuser\/scm@EXAMPLE\.COM)" + ${result} = Execute ozone sh bucket list ${VOLUME} + Should contain ${result} ${BUCKET} + Should contain ${result} ${BUCKET2} + +Assign suite vars for FS test + ${BASE_URL} = Format FS URL ${SCHEME} ${VOLUME} ${BUCKET} / + Set Suite Variable ${BASE_URL} + Set Suite Variable ${DEEP_URL} ${BASE_URL}${DEEP_DIR}