integration.sh 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 remove test || true
  23. ccm create test -v binary:$version -n $clusterSize -d --vnodes --jvm_arg="-Xmx256m -XX:NewSize=100m"
  24. ccm updateconf "${conf[@]}"
  25. ccm start -v
  26. ccm status
  27. ccm node1 nodetool status
  28. local proto=2
  29. if [[ $version == 1.2.* ]]; then
  30. proto=1
  31. elif [[ $version == 2.1.* ]]; then
  32. proto=3
  33. fi
  34. 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
  35. if [ ${PIPESTATUS[0]} -ne 0 ]; then
  36. echo "--- FAIL: ccm status follows:"
  37. ccm status
  38. ccm node1 nodetool status
  39. ccm node1 showlog > status.log
  40. cat status.log
  41. echo "--- FAIL: Received a non-zero exit code from the go test execution, please investigate this"
  42. exit 1
  43. fi
  44. cover=`cat results.txt | grep coverage: | grep -o "[0-9]\{1,3\}" | head -n 1`
  45. if [[ $cover -lt "55" ]]; then
  46. echo "--- FAIL: expected coverage of at least 60 %, but coverage was $cover %"
  47. exit 1
  48. fi
  49. ccm remove
  50. }
  51. run_tests $1