test-commands.sh 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #!/usr/bin/env bash
  2. SCRIPT_PATH="$(dirname "${BASH_SOURCE[0]}")"
  3. cd $SCRIPT_PATH
  4. export AUTO_CONFIRM=true
  5. export CONFIG_PATH="../config.yml"
  6. CLI=../bin/run
  7. GROUP=distributionWorkingGroup yarn workspace api-scripts initialize-lead
  8. ${CLI} leader:set-buckets-per-bag-limit -l 10
  9. # Create family and buckets
  10. FAMILY_ID=`${CLI} leader:create-bucket-family`
  11. BUCKET_1_INDEX=`${CLI} leader:create-bucket -f ${FAMILY_ID} -a yes`
  12. BUCKET_2_INDEX=`${CLI} leader:create-bucket -f ${FAMILY_ID} -a yes`
  13. BUCKET_1_ID="${FAMILY_ID}:${BUCKET_1_INDEX}"
  14. BUCKET_2_ID="${FAMILY_ID}:${BUCKET_2_INDEX}"
  15. # Test adding 2 buckets to bag at once
  16. ${CLI} leader:update-bag -b static:council -f ${FAMILY_ID} -a ${BUCKET_1_INDEX} ${BUCKET_2_INDEX}
  17. # Test removing 2 buckets from bag at once
  18. ${CLI} leader:update-bag -b static:council -f ${FAMILY_ID} -r ${BUCKET_1_INDEX} ${BUCKET_2_INDEX}
  19. # Adding single bucket to all static bags
  20. ${CLI} leader:update-bag -b static:council -f ${FAMILY_ID} -a ${BUCKET_1_INDEX}
  21. ${CLI} leader:update-bag -b static:wg:storage -f ${FAMILY_ID} -a ${BUCKET_1_INDEX}
  22. ${CLI} leader:update-bag -b static:wg:content -f ${FAMILY_ID} -a ${BUCKET_1_INDEX}
  23. ${CLI} leader:update-bag -b static:wg:operationsAlpha -f ${FAMILY_ID} -a ${BUCKET_1_INDEX}
  24. ${CLI} leader:update-bag -b static:wg:operationsBeta -f ${FAMILY_ID} -a ${BUCKET_1_INDEX}
  25. ${CLI} leader:update-bag -b static:wg:operationsGamma -f ${FAMILY_ID} -a ${BUCKET_1_INDEX}
  26. ${CLI} leader:update-bag -b static:wg:gateway -f ${FAMILY_ID} -a ${BUCKET_1_INDEX}
  27. ${CLI} leader:update-bag -b static:wg:distribution -f ${FAMILY_ID} -a ${BUCKET_1_INDEX}
  28. # Update bucket status / mode
  29. ${CLI} leader:update-bucket-status -B ${BUCKET_1_ID} --acceptingBags yes
  30. ${CLI} leader:update-bucket-mode -B ${BUCKET_1_ID} --mode on
  31. ${CLI} leader:update-bucket-status -B ${BUCKET_2_ID} --acceptingBags no
  32. ${CLI} leader:update-bucket-mode -B ${BUCKET_2_ID} --mode off
  33. # Update dynamic bag policies
  34. ${CLI} leader:update-dynamic-bag-policy -t Channel -p ${FAMILY_ID}:5
  35. ${CLI} leader:update-dynamic-bag-policy -t Member -p ${FAMILY_ID}:5
  36. ${CLI} leader:update-dynamic-bag-policy -t Member
  37. # Bucket invitations + cancelling and accepting
  38. ${CLI} leader:invite-bucket-operator -B ${BUCKET_1_ID} -w 0
  39. ${CLI} leader:invite-bucket-operator -B ${BUCKET_2_ID} -w 0
  40. ${CLI} operator:accept-invitation -B ${BUCKET_1_ID} -w 0
  41. ${CLI} leader:cancel-invitation -B ${BUCKET_2_ID} -w 0
  42. # Setting metadata
  43. ${CLI} operator:set-metadata -B ${BUCKET_1_ID} -w 0 -i ./data/operator-metadata.json
  44. ${CLI} leader:set-bucket-family-metadata -f ${FAMILY_ID} -i ./data/family-metadata.json
  45. # Deletion commands tested separately
  46. FAMILY_TO_DELETE_ID=`${CLI} leader:create-bucket-family`
  47. BUCKET_TO_DELETE_INDEX=`${CLI} leader:create-bucket -f ${FAMILY_TO_DELETE_ID} -a yes`
  48. BUCKET_TO_DELETE_ID="${FAMILY_TO_DELETE_ID}:${BUCKET_TO_DELETE_INDEX}"
  49. ${CLI} leader:invite-bucket-operator -B ${BUCKET_TO_DELETE_ID} -w 0
  50. ${CLI} operator:accept-invitation -B ${BUCKET_TO_DELETE_ID} -w 0
  51. ${CLI} leader:remove-bucket-operator -B ${BUCKET_TO_DELETE_ID} -w 0
  52. ${CLI} leader:delete-bucket -B ${BUCKET_TO_DELETE_ID}
  53. ${CLI} leader:delete-bucket-family -f ${FAMILY_TO_DELETE_ID}