forked from apache/cassandra-gocql-driver
-
Notifications
You must be signed in to change notification settings - Fork 59
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
github: Migrate from travis to GH actions
- Travis files are removed - Build GH action added - CCM and legacy C* test infra removed - integration.sh refactored
- Loading branch information
Showing
6 changed files
with
76 additions
and
218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
name: Build | ||
|
||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
types: [opened, synchronize, reopened] | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
env: | ||
SCYLLA_IMAGE: scylladb/scylla:4.0.0 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/setup-go@v2 | ||
- uses: actions/cache@v2 | ||
id: gomod-cache | ||
with: | ||
path: ~/go/pkg/mod | ||
key: ${{ runner.os }}-go-${{ hashFiles('go.mod') }} | ||
restore-keys: | | ||
${{ runner.os }}-go- | ||
- run: go vet | ||
|
||
- name: Run unit tests | ||
run: go test -tags unit -race | ||
|
||
- name: Install Docker compose | ||
env: | ||
DOCKER_COMPOSE_VERSION: 1.25.5 | ||
run: sudo curl -L "https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose | ||
|
||
- run: ./integration.sh cassandra scylla | ||
- run: ./integration.sh integration scylla | ||
- run: ./integration.sh ccm |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,164 +1,49 @@ | ||
#!/bin/bash | ||
# | ||
# Copyright (C) 2017 ScyllaDB | ||
# | ||
|
||
set -eux | ||
readonly SCYLLA_IMAGE=${SCYLLA_IMAGE} | ||
|
||
function run_tests() { | ||
local clusterSize=3 | ||
local version=$1 | ||
local auth=$2 | ||
set -eu -o pipefail | ||
|
||
if [ "$auth" = true ]; then | ||
clusterSize=1 | ||
fi | ||
# Static IPs from docker-compose.yml | ||
scylla_liveset="192.168.100.11,192.168.100.12" | ||
|
||
local keypath="$(pwd)/testdata/pki" | ||
function scylla_up() { | ||
local -r exec="docker-compose exec -T" | ||
|
||
local conf=( | ||
"client_encryption_options.enabled: true" | ||
"client_encryption_options.keystore: $keypath/.keystore" | ||
"client_encryption_options.keystore_password: cassandra" | ||
"client_encryption_options.require_client_auth: true" | ||
"client_encryption_options.truststore: $keypath/.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" | ||
) | ||
echo "==> Running Scylla ${SCYLLA_IMAGE}" | ||
docker pull ${SCYLLA_IMAGE} | ||
docker-compose up -d | ||
|
||
ccm remove test || true | ||
|
||
ccm create test -v $version -n $clusterSize -d --vnodes --jvm_arg="-Xmx256m -XX:NewSize=100m" | ||
ccm updateconf "${conf[@]}" | ||
|
||
if [ "$auth" = true ] | ||
then | ||
ccm updateconf 'authenticator: PasswordAuthenticator' 'authorizer: CassandraAuthorizer' | ||
rm -rf $HOME/.ccm/test/node1/data/system_auth | ||
fi | ||
|
||
local proto=2 | ||
if [[ $version == 1.2.* ]]; then | ||
proto=1 | ||
elif [[ $version == 2.0.* ]]; then | ||
proto=2 | ||
elif [[ $version == 2.1.* ]]; then | ||
proto=3 | ||
elif [[ $version == 2.2.* || $version == 3.0.* ]]; then | ||
proto=4 | ||
ccm updateconf 'enable_user_defined_functions: true' | ||
export JVM_EXTRA_OPTS=" -Dcassandra.test.fail_writes_ks=test -Dcassandra.custom_query_handler_class=org.apache.cassandra.cql3.CustomPayloadMirroringQueryHandler" | ||
elif [[ $version == 3.*.* ]]; then | ||
proto=5 | ||
ccm updateconf 'enable_user_defined_functions: true' | ||
export JVM_EXTRA_OPTS=" -Dcassandra.test.fail_writes_ks=test -Dcassandra.custom_query_handler_class=org.apache.cassandra.cql3.CustomPayloadMirroringQueryHandler" | ||
fi | ||
|
||
sleep 1s | ||
|
||
ccm list | ||
ccm start --wait-for-binary-proto | ||
ccm status | ||
ccm node1 nodetool status | ||
|
||
local args="-gocql.timeout=60s -runssl -proto=$proto -rf=3 -clusterSize=$clusterSize -autowait=2000ms -compressor=snappy -gocql.cversion=$version -cluster=$(ccm liveset) ./..." | ||
|
||
go test -v -tags unit -race | ||
|
||
if [ "$auth" = true ] | ||
then | ||
sleep 30s | ||
go test -run=TestAuthentication -tags "integration gocql_debug" -timeout=15s -runauth $args | ||
else | ||
sleep 1s | ||
go test -tags "cassandra gocql_debug" -timeout=5m -race $args | ||
|
||
ccm clear | ||
ccm start --wait-for-binary-proto | ||
sleep 1s | ||
|
||
go test -tags "integration gocql_debug" -timeout=5m -race $args | ||
|
||
ccm clear | ||
ccm start --wait-for-binary-proto | ||
sleep 1s | ||
|
||
go test -tags "ccm gocql_debug" -timeout=5m -race $args | ||
fi | ||
|
||
ccm remove | ||
echo "==> Waiting for CQL port" | ||
for s in $(docker-compose ps --services); do | ||
until v=$(${exec} ${s} cqlsh -e "DESCRIBE SCHEMA"); do | ||
echo ${v} | ||
docker-compose logs --tail 10 ${s} | ||
sleep 5 | ||
done | ||
done | ||
echo "==> Waiting for CQL port done" | ||
} | ||
|
||
function join_by { | ||
local IFS="$1"; | ||
shift; | ||
echo "$*"; | ||
function scylla_down() { | ||
echo "==> Stopping Scylla" | ||
docker-compose down | ||
} | ||
|
||
scylla_liveset="unset" | ||
|
||
function startup_scylla { | ||
local version=$1 | ||
#service_names+=(node_1 node_2 node_3) | ||
service_names+=(node_1 node_2) | ||
#container_names+=(gocql_node_1_1 gocql_node_2_1 gocql_node_3_1) | ||
container_names+=(gocql_node_1_1 gocql_node_2_1) | ||
SCYLLA_IMAGE=$version docker-compose --log-level WARNING up -d | ||
|
||
for name in "${container_names[@]}" | ||
do | ||
node_ips+=( `docker inspect --format='{{ .NetworkSettings.Networks.gocql_public.IPAddress }}' $name` ) | ||
done | ||
|
||
# Wait for instance to start | ||
for name in "${service_names[@]}" | ||
do | ||
until docker-compose logs "${name}"| grep "Starting listening for CQL clients" > /dev/null; do sleep 2; done | ||
done | ||
|
||
scylla_liveset=$(join_by ',' "${node_ips[@]}") | ||
function scylla_restart() { | ||
scylla_down | ||
scylla_up | ||
} | ||
|
||
function run_scylla_tests() { | ||
local version=$1 | ||
local auth=$2 | ||
echo "Running integration tests on ${version}" | ||
local clusterSize=2 | ||
local cversion="3.11.4" | ||
startup_scylla "${version}" | ||
local proto=4 | ||
go test -v -tags unit -race | ||
|
||
if [ "$auth" = true ] | ||
then | ||
: | ||
#sleep 30s | ||
#go test -run=TestAuthentication -tags "integration gocql_debug" -timeout=15s -runauth $args | ||
else | ||
sleep 1s | ||
local args="-gocql.timeout=60s -proto=$proto -rf=3 -clusterSize=$clusterSize -autowait=2000ms -compressor=snappy -gocql.cversion=$cversion -cluster=${scylla_liveset} ./..." | ||
go test -tags "cassandra scylla gocql_debug" -timeout=5m -race $args | ||
cleanup_scylla | ||
startup_scylla "${version}" | ||
go test -tags "integration scylla gocql_debug" -timeout=5m -race $args | ||
cleanup_scylla | ||
startup_scylla "${version}" | ||
go test -tags "ccm gocql_debug" -timeout=5m -race $args | ||
cleanup_scylla | ||
fi | ||
} | ||
scylla_restart | ||
|
||
function cleanup_scylla { | ||
echo "Removing scylla" | ||
docker-compose down | ||
} | ||
readonly clusterSize=2 | ||
readonly cversion="3.11.4" | ||
readonly proto=4 | ||
readonly args="-gocql.timeout=60s -proto=${proto} -rf=3 -clusterSize=${clusterSize} -autowait=2000ms -compressor=snappy -gocql.cversion=${cversion} -cluster=${scylla_liveset}" | ||
|
||
if [[ $1 =~ "scylla" ]] | ||
then | ||
run_scylla_tests $1 $2 | ||
else | ||
run_tests $1 $2 | ||
fi | ||
echo "==> Running $* tests with args: ${args}" | ||
go test -timeout=5m -race -tags="$*" ${args} ./... |