Skip to content

Commit

Permalink
github: Migrate from travis to GH actions
Browse files Browse the repository at this point in the history
- Travis files are removed
- Build GH action added
- CCM and legacy C* test infra removed
- integration.sh refactored
  • Loading branch information
mmatczuk committed Oct 29, 2020
1 parent 9f3fb4e commit e6cbbf9
Show file tree
Hide file tree
Showing 6 changed files with 76 additions and 218 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/main.yml
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
50 changes: 0 additions & 50 deletions .travis.yml

This file was deleted.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
gocql
=====

[![Build Status](https://travis-ci.org/scylladb/gocql.svg?branch=master)](https://travis-ci.org/scylladb/gocql)
![Build](https://github.com/scylladb/gocql/workflows/Build/badge.svg)
[![GoDoc](https://godoc.org/github.com/scylladb/gocql?status.svg)](https://godoc.org/github.com/scylladb/gocql)

This is a fork of [gocql](https://github.com/gocql/gocql) package that we created at Scylla.
Expand Down
4 changes: 2 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@ services:
node_1:
image: ${SCYLLA_IMAGE}
privileged: true
command: --smp 2 --memory 512M
command: --smp 2 --memory 512M --seeds 192.168.100.11 --overprovisioned 1
networks:
public:
ipv4_address: 192.168.100.11

node_2:
image: ${SCYLLA_IMAGE}
privileged: true
command: --smp 2 --memory 512M --seeds 192.168.100.11
command: --smp 2 --memory 512M --seeds 192.168.100.11 --overprovisioned 1
networks:
public:
ipv4_address: 192.168.100.12
Expand Down
16 changes: 0 additions & 16 deletions install_test_deps.sh

This file was deleted.

183 changes: 34 additions & 149 deletions integration.sh
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} ./...

0 comments on commit e6cbbf9

Please sign in to comment.