user_operations.sh 613 B

12345678910111213141516171819202122232425262728
  1. #!/usr/bin/env bash
  2. # Copyright IBM Corp., All Rights Reserved.
  3. #
  4. # SPDX-License-Identifier: Apache-2.0
  5. #
  6. actions="apply release"
  7. users="a b c d e f g h i j k l m n o p q r s t u v w x y z"
  8. # Read into array variable.
  9. IFS=' '
  10. action=($actions)
  11. user=($users)
  12. # Count how many elements.
  13. num_actions=${#action[*]}
  14. num_users=${#user[*]}
  15. SECONDS=0
  16. for i in {1..1000}
  17. do
  18. url="http://127.0.0.1:80/v1/cluster_${action[$((RANDOM%num_actions))]}?user_id=${user[$((RANDOM%num_users))]} "
  19. echo $url
  20. curl $url
  21. done
  22. duration=$SECONDS
  23. echo "$(($duration / 60)) minutes and $(($duration % 60)) seconds elapsed."