<commit_before>#!/bin/bash

set -e

function run_tests() {
	local clusterSize=3
	local version=$1

	ccm create test -v binary:$version -n $clusterSize -d --vnodes
	
	sed -i '/#MAX_HEAP_SIZE/c\MAX_HEAP_SIZE="256M"' ~/.ccm/repository/$version/conf/cassandra-env.sh
	sed -i '/#HEAP_NEWSIZE/c\HEAP_NEWSIZE="100M"' ~/.ccm/repository/$version/conf/cassandra-env.sh

	ccm updateconf 'client_encryption_options.enabled: true' 'client_encryption_options.keystore: testdata/pki/.keystore' 'client_encryption_options.keystore_password: <PASSWORD>' 'client_encryption_options.require_client_auth: true' 'client_encryption_options.truststore: testdata/pki/.truststore' 'client_encryption_options.truststore_password: <PASSWORD>' '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'
	ccm start -v
	ccm status
	ccm node1 nodetool status
	
	local proto=2
	if [[ $version == 1.2.* ]]; then
		proto=1
	fi

	go test -timeout 3m -tags integration -cover -v -runssl -proto=$proto -rf=3 -cluster=$(ccm liveset) -clusterSize=$clusterSize -autowait=2000ms ./... | tee results.txt || {
		echo "--- FAIL: ccm status follows:"
		ccm status
		ccm node1 nodetool status
		ccm node1 showlog > status.log
		cat status.log
		echo "--- FAIL: Received a non-zero exit code from the go test execution, please investigate this"
		exit 1
	}

	cover=`cat results.txt | grep coverage: | grep -o "[0-9]\{1,3\}" | head -n 1`
	if [[ $cover -lt "60" ]]; then
		echo "--- FAIL: expected coverage of at least 60 %, but coverage was $cover %"
		exit 1
	fi
	ccm clear
}
run_tests $1<commit_msg>Try and use the exit value and the output of go test<commit_after>#!/bin/bash

set -e

function run_tests() {
	local clusterSize=3
	local version=$1

	ccm create test -v binary:$version -n $clusterSize -d --vnodes
	
	sed -i '/#MAX_HEAP_SIZE/c\MAX_HEAP_SIZE="256M"' ~/.ccm/repository/$version/conf/cassandra-env.sh
	sed -i '/#HEAP_NEWSIZE/c\HEAP_NEWSIZE="100M"' ~/.ccm/repository/$version/conf/cassandra-env.sh

	ccm updateconf 'client_encryption_options.enabled: true' 'client_encryption_options.keystore: testdata/pki/.keystore' 'client_encryption_options.keystore_password: <PASSWORD>' 'client_encryption_options.require_client_auth: true' 'client_encryption_options.truststore: testdata/pki/.truststore' 'client_encryption_options.truststore_password: <PASSWORD>' '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'
	ccm start -v
	ccm status
	ccm node1 nodetool status
	
	local proto=2
	if [[ $version == 1.2.* ]]; then
		proto=1
	fi

	go test -timeout 5m -tags integration -cover -v -runssl -proto=$proto -rf=3 -cluster=$(ccm liveset) -clusterSize=$clusterSize -autowait=2000ms ./... | tee results.txt

	if [ ${PIPESTATUS[0]} -ne 0 ]; then 
		echo "--- FAIL: ccm status follows:"
		ccm status
		ccm node1 nodetool status
		ccm node1 showlog > status.log
		cat status.log
		echo "--- FAIL: Received a non-zero exit code from the go test execution, please investigate this"
		exit 1
	fi

	cover=`cat results.txt | grep coverage: | grep -o "[0-9]\{1,3\}" | head -n 1`

	if [[ $cover -lt "60" ]]; then
		echo "--- FAIL: expected coverage of at least 60 %, but coverage was $cover %"
		exit 1
	fi
	ccm clear
}
run_tests $1
{'fraction_non_alphanumeric': 0.13043478260869565, 'fraction_numerical': 0.026845637583892617, 'mean_word_length': 4.406940063091483, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4773375', 'n_tokens_mistral': 1344, 'n_tokens_neox': 1213, 'n_words': 328}