integration.sh 1.6 KB

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