Created
June 9, 2020 06:25
-
-
Save anderbubble/027de8b80366cd63df34b3838a7bab1d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -x | |
TEST_DIR="$1" | |
TEST_FILE="$2" | |
ITERATIONS="$3" | |
function main | |
{ | |
for i in $(seq $ITERATIONS) | |
do | |
iput_random_file | |
if [[ $((RANDOM % 2)) == '1' ]] | |
then | |
irm_random_file | |
fi | |
done | |
} | |
function iput_random_file | |
{ | |
local target_dir="${TEST_DIR}/$(($RANDOM % 10))$(($RANDOM % 10))" | |
imkdir -p "${target_dir}" | |
iput -f "$TEST_FILE" "${target_dir}/$(($RANDOM % 10))" | |
} | |
function irm_random_file | |
{ | |
irm "$(iquest "%s/%s" "SELECT COLL_NAME, DATA_NAME where COLL_NAME LIKE '${TEST_DIR}/%'" | sort -R | head -n 1)" | |
} | |
main |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment