integration.sh 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. #!/bin/bash
  2. set -eux
  3. function run_tests() {
  4. local clusterSize=3
  5. local version=$1
  6. local auth=$2
  7. if [ "$auth" = true ]; then
  8. clusterSize=1
  9. fi
  10. local keypath="$(pwd)/testdata/pki"
  11. local conf=(
  12. "client_encryption_options.enabled: true"
  13. "client_encryption_options.keystore: $keypath/.keystore"
  14. "client_encryption_options.keystore_password: cassandra"
  15. "client_encryption_options.require_client_auth: true"
  16. "client_encryption_options.truststore: $keypath/.truststore"
  17. "client_encryption_options.truststore_password: cassandra"
  18. "concurrent_reads: 2"
  19. "concurrent_writes: 2"
  20. "rpc_server_type: sync"
  21. "rpc_min_threads: 2"
  22. "rpc_max_threads: 2"
  23. "write_request_timeout_in_ms: 5000"
  24. "read_request_timeout_in_ms: 5000"
  25. )
  26. ccm remove test || true
  27. ccm create test -v $version -n $clusterSize -d --vnodes --jvm_arg="-Xmx256m -XX:NewSize=100m"
  28. ccm updateconf "${conf[@]}"
  29. if [ "$auth" = true ]
  30. then
  31. ccm updateconf 'authenticator: PasswordAuthenticator' 'authorizer: CassandraAuthorizer'
  32. rm -rf $HOME/.ccm/test/node1/data/system_auth
  33. fi
  34. local proto=2
  35. if [[ $version == 1.2.* ]]; then
  36. proto=1
  37. elif [[ $version == 2.0.* ]]; then
  38. proto=2
  39. elif [[ $version == 2.1.* ]]; then
  40. proto=3
  41. elif [[ $version == 2.2.* || $version == 3.0.* ]]; then
  42. proto=4
  43. ccm updateconf 'enable_user_defined_functions: true'
  44. export JVM_EXTRA_OPTS=" -Dcassandra.test.fail_writes_ks=test -Dcassandra.custom_query_handler_class=org.apache.cassandra.cql3.CustomPayloadMirroringQueryHandler"
  45. elif [[ $version == 3.*.* ]]; then
  46. proto=5
  47. ccm updateconf 'enable_user_defined_functions: true'
  48. export JVM_EXTRA_OPTS=" -Dcassandra.test.fail_writes_ks=test -Dcassandra.custom_query_handler_class=org.apache.cassandra.cql3.CustomPayloadMirroringQueryHandler"
  49. fi
  50. sleep 1s
  51. ccm list
  52. ccm start --wait-for-binary-proto
  53. ccm status
  54. ccm node1 nodetool status
  55. local args="-gocql.timeout=60s -runssl -proto=$proto -rf=3 -clusterSize=$clusterSize -autowait=2000ms -compressor=snappy -gocql.cversion=$version -cluster=$(ccm liveset) ./..."
  56. go test -v -tags unit -race
  57. if [ "$auth" = true ]
  58. then
  59. sleep 30s
  60. go test -run=TestAuthentication -tags "integration gocql_debug" -timeout=15s -runauth $args
  61. else
  62. sleep 1s
  63. go test -tags "cassandra gocql_debug" -timeout=5m -race $args
  64. ccm clear
  65. ccm start --wait-for-binary-proto
  66. sleep 1s
  67. go test -tags "integration gocql_debug" -timeout=5m -race $args
  68. ccm clear
  69. ccm start --wait-for-binary-proto
  70. sleep 1s
  71. go test -tags "ccm gocql_debug" -timeout=5m -race $args
  72. fi
  73. ccm remove
  74. }
  75. run_tests $1 $2