xBis7 commented on code in PR #5350: URL: https://github.com/apache/ozone/pull/5350#discussion_r1401927797
########## hadoop-ozone/dist/src/main/smoketest/omha/data-creation-before-om-bootstrap.robot: ########## @@ -0,0 +1,96 @@ +# 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 Smoke test for creating data needed for om bootstrap load test. +Resource ../commonlib.robot +Test Timeout 5 minutes +Test Setup Run Keyword if '${SECURITY_ENABLED}' == 'true' Kinit test user testuser testuser.keytab + +*** Variables *** +${TMP_FILE} tmp.txt +${VOLUME} +${BUCKET} +${SNAP_1} +${SNAP_2} +${KEY_PREFIX} +${KEY_1} +${KEY_2} + +*** Keywords *** +Create volume and bucket + [arguments] ${volume} ${bucket} + ${vol_res} = Execute ozone sh volume create /${volume} + Should Be Empty ${vol_res} + ${bucket_res} = Execute ozone sh bucket create /${volume}/${bucket} + Should Be Empty ${bucket_res} + +Create tmp file + [arguments] ${file_name} + ${create_res} = Execute touch ${file_name} + Should Be Empty ${create_res} + ${ls_grep_res} = Execute ls -lah | grep '${file_name}' + Should contain ${ls_grep_res} ${file_name} + +Delete tmp file + [arguments] ${file_name} + Execute rm ${file_name} + ${file_exists} = Execute [[ -f ${file_name} ]] && echo "File exists" || echo "File doesn't exist" + Should contain ${file_exists} File doesn't exist + +Create a key and set contents same as the keyName + [arguments] ${volume} ${bucket} ${key_prefix} ${key_name} ${tmp_file} + Execute echo "${key_prefix}/${key_name}" > ${tmp_file} + ${key_res} = Execute ozone sh key put /${volume}/${bucket}/${key_prefix}/${key_name} ${tmp_file} + Should Be Empty ${key_res} + ${key_cat_res} = Execute ozone sh key cat /${volume}/${bucket}/${key_prefix}/${key_name} + Should contain ${key_cat_res} ${key_prefix}/${key_name} + +Create actual keys + [arguments] ${volume} ${bucket} ${key_prefix} ${key_1} ${key2} ${tmp_file} + Create a key and set contents same as the keyName ${volume} ${bucket} ${key_prefix} ${key_1} ${tmp_file} + Create a key and set contents same as the keyName ${volume} ${bucket} ${key_prefix} ${key_2} ${tmp_file} + +Create metadata keys + [arguments] ${threads} ${key_num} ${volume} ${bucket} + ${freon_res} = Execute ozone freon omkg -t ${threads} -n ${key_num} -v ${volume} -b ${bucket} + Should contain ${freon_res} Successful executions: ${key_num} + +Create snapshot + [arguments] ${volume} ${bucket} ${snapshot} + ${snap_res} = Execute ozone sh snapshot create /${volume}/${bucket} ${snapshot} + Should Be Empty ${snap_res} + +*** Test Cases *** Review Comment: aah now I understand what you are saying. It's not a comment, it's a section definition. The `*** Keywords ***` section has all the functions. In order to execute the keywords, you have to create another section annotated as `*** Test Cases ***` or `*** Tasks ***` and call the keywords from there. As far as I can tell, the only difference is in terminology. I go with `*** Test Cases ***` because I haven't seen any robot test in ozone using `*** Tasks ***`, but we can change it to `*** Tasks ***` if it makes more sense. If I call it something else, the keywords won't be executed. https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#test-data-sections -- 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]
