integration.sh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/bin/bash
  2. set -e
  3. function run_tests() {
  4. local clusterSize=3
  5. local version=$1
  6. local keypath="$(pwd)/testdata/pki"
  7. local conf=(
  8. "client_encryption_options.enabled: true"
  9. "client_encryption_options.keystore: $keypath/.keystore"
  10. "client_encryption_options.keystore_password: cassandra"
  11. "client_encryption_options.require_client_auth: true"
  12. "client_encryption_options.truststore: $keypath/.truststore"
  13. "client_encryption_options.truststore_password: cassandra"
  14. "concurrent_reads: 2"
  15. "concurrent_writes: 2"
  16. "rpc_server_type: sync"
  17. "rpc_min_threads: 2"
  18. "rpc_max_threads: 2"
  19. "write_request_timeout_in_ms: 5000"
  20. "read_request_timeout_in_ms: 5000"
  21. )
  22. ccm create test -v binary:$version -n $clusterSize -d --vnodes
  23. ccm updateconf "${conf[@]}"
  24. sed -i '/#MAX_HEAP_SIZE/c\MAX_HEAP_SIZE="256M"' ~/.ccm/repository/$version/conf/cassandra-env.sh
  25. sed -i '/#HEAP_NEWSIZE/c\HEAP_NEWSIZE="100M"' ~/.ccm/repository/$version/conf/cassandra-env.sh
  26. ccm start -v
  27. ccm status
  28. ccm node1 nodetool status
  29. local proto=2
  30. if [[ $version == 1.2.* ]]; then
  31. proto=1
  32. elif [[ $version == 2.1.* ]]; then
  33. proto=3
  34. fi
  35. go test -timeout 5m -tags integration -cover -v -runssl -proto=$proto -rf=3 -cluster=$(ccm liveset) -clusterSize=$clusterSize -autowait=2000ms -compressor=snappy ./... | tee results.txt
  36. if [ ${PIPESTATUS[0]} -ne 0 ]; then
  37. echo "--- FAIL: ccm status follows:"
  38. ccm status
  39. ccm node1 nodetool status
  40. ccm node1 showlog > status.log
  41. cat status.log
  42. echo "--- FAIL: Received a non-zero exit code from the go test execution, please investigate this"
  43. exit 1
  44. fi
  45. cover=`cat results.txt | grep coverage: | grep -o "[0-9]\{1,3\}" | head -n 1`
  46. if [[ $cover -lt "55" ]]; then
  47. echo "--- FAIL: expected coverage of at least 60 %, but coverage was $cover %"
  48. exit 1
  49. fi
  50. ccm clear
  51. }
  52. run_tests $1