Skip to content

CASSGO-76: Add Makefile #1881

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 0 additions & 50 deletions .github/actions/setup-environment/action.yml

This file was deleted.

188 changes: 62 additions & 126 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ on:
pull_request:
types: [ opened, synchronize, reopened ]

env:
CCM_VERSION: "4621dfee5ad73956b831091a8b863d100d25c610"

jobs:
build:
name: Unit tests
Expand All @@ -22,9 +19,11 @@ jobs:
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
- run: go vet ./...
- name: Run linting
run: make check
- name: Run unit tests
run: go test -v -tags unit -race ./...
run: make test-unit

integration-cassandra:
timeout-minutes: 15
needs:
Expand All @@ -45,82 +44,51 @@ jobs:
compressor: "snappy"
steps:
- uses: actions/checkout@v2
- uses: actions/setup-go@v2

- uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go }}
- uses: actions/cache@v4
id: gomod-cache
with:
path: ~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('go.mod') }}
restore-keys: |
${{ runner.os }}-go-
- name: Setup environment
uses: ./.github/actions/setup-environment
- name: Start cassandra nodes
run: |
source ~/venv/bin/activate
VERSION=${{ matrix.cassandra_version }}
keypath="$(pwd)/testdata/pki"
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"
"write_request_timeout_in_ms: 5000"
"read_request_timeout_in_ms: 5000"
)

if [[ $VERSION == 3.*.* ]]; then
conf+=(
"rpc_server_type: sync"
"rpc_min_threads: 2"
"rpc_max_threads: 2"
"enable_user_defined_functions: true"
"enable_materialized_views: true"
)
elif [[ $VERSION == 4.0.* ]]; then
conf+=(
"enable_user_defined_functions: true"
"enable_materialized_views: true"
)
else
conf+=(
"user_defined_functions_enabled: true"
"materialized_views_enabled: true"
)
fi

ccm remove test || true

ccm create test -v $VERSION -n 3 -d --vnodes --jvm_arg="-Xmx256m -XX:NewSize=100m"
ccm updateconf "${conf[@]}"
- uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip'
cache-dependency-path: Makefile

export JVM_EXTRA_OPTS=" -Dcassandra.test.fail_writes_ks=test -Dcassandra.custom_query_handler_class=org.apache.cassandra.cql3.CustomPayloadMirroringQueryHandler"
- name: Set up cache for SDKMAN
uses: actions/cache@v3
with:
path: ~/.sdkman
key: ${{ runner.os }}-sdkman

ccm start --wait-for-binary-proto --verbose
ccm status
ccm node1 nodetool status
- name: Set up cache for CCM
uses: actions/cache@v4
with:
path: ~/.ccm/repository
key: ${{ runner.os }}-ccm-${{ matrix.cassandra_version }}

args="-gocql.timeout=60s -runssl -proto=${{ matrix.proto_version }} -rf=3 -clusterSize=3 -autowait=2000ms -compressor=${{ matrix.compressor }} -gocql.cversion=$VERSION -cluster=$(ccm liveset) ./..."
- name: Start cassandra nodes
env:
CASSANDRA_VERSION: ${{ matrix.cassandra_version }}
run: |
make cassandra-start
sleep 30s

echo "args=$args" >> $GITHUB_ENV
echo "JVM_EXTRA_OPTS=$JVM_EXTRA_OPTS" >> $GITHUB_ENV
- name: Integration tests
env:
CASSANDRA_VERSION: ${{ matrix.cassandra_version }}
TEST_CQL_PROTOCOL: ${{ matrix.proto_version }}
TEST_COMPRESSOR: ${{ matrix.compressor }}
TEST_INTEGRATION_TAGS: ${{ matrix.tags }}
run: |
source ~/venv/bin/activate
export JVM_EXTRA_OPTS="${{env.JVM_EXTRA_OPTS}}"
go test -v -tags "${{ matrix.tags }} gocql_debug" -timeout=5m -race ${{ env.args }}
make test-integration

- name: 'Save ccm logs'
if: 'failure()'
uses: actions/upload-artifact@v4
with:
name: ccm-cluster-cassandra-${{ matrix.cassandra_version }}-go-${{ matrix.go }}-tag-${{ matrix.tags }}-proto-version-${{ matrix.proto_version }}-compressor-${{ matrix.compressor }}
path: /home/runner/.ccm/test
path: /home/runner/.ccm/gocql_integration_test
retention-days: 5
integration-auth-cassandra:
timeout-minutes: 15
Expand All @@ -144,69 +112,37 @@ jobs:
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go }}
- name: Setup environment
uses: ./.github/actions/setup-environment
- name: Start cassandra nodes
run: |
source ~/venv/bin/activate
VERSION=${{ matrix.cassandra_version }}
keypath="$(pwd)/testdata/pki"
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"
"write_request_timeout_in_ms: 5000"
"read_request_timeout_in_ms: 5000"
"authenticator: PasswordAuthenticator"
"authorizer: CassandraAuthorizer"
"enable_user_defined_functions: true"
)

if [[ $VERSION == 3.*.* ]]; then
conf+=(
"rpc_server_type: sync"
"rpc_min_threads: 2"
"rpc_max_threads: 2"
"enable_user_defined_functions: true"
"enable_materialized_views: true"
)
elif [[ $VERSION == 4.0.* ]]; then
conf+=(
"enable_user_defined_functions: true"
"enable_materialized_views: true"
)
else
conf+=(
"user_defined_functions_enabled: true"
"materialized_views_enabled: true"
)
fi

ccm remove test || true

ccm create test -v $VERSION -n 1 -d --vnodes --jvm_arg="-Xmx256m -XX:NewSize=100m"
ccm updateconf "${conf[@]}"

rm -rf $HOME/.ccm/test/node1/data/system_auth

export JVM_EXTRA_OPTS=" -Dcassandra.test.fail_writes_ks=test -Dcassandra.custom_query_handler_class=org.apache.cassandra.cql3.CustomPayloadMirroringQueryHandler"
- uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip'
cache-dependency-path: Makefile

ccm start --wait-for-binary-proto --verbose
ccm status
ccm node1 nodetool status
- name: Set up cache for SDKMAN
uses: actions/cache@v3
with:
path: ~/.sdkman
key: ${{ runner.os }}-sdkman

args="-gocql.timeout=60s -runssl -proto=${{ matrix.proto_version }} -rf=3 -clusterSize=1 -autowait=2000ms -compressor=${{ matrix.compressor }} -gocql.cversion=$VERSION -cluster=$(ccm liveset) ./..."
- name: Set up cache for CCM
uses: actions/cache@v4
with:
path: ~/.ccm/repository
key: ${{ runner.os }}-ccm-${{ matrix.cassandra_version }}

echo "args=$args" >> $GITHUB_ENV
echo "JVM_EXTRA_OPTS=$JVM_EXTRA_OPTS" >> $GITHUB_ENV
- name: Start cassandra nodes
env:
CASSANDRA_VERSION: ${{ matrix.cassandra_version }}
run: |
make cassandra-start
sleep 30s

- name: Integration tests
env:
CASSANDRA_VERSION: ${{ matrix.cassandra_version }}
TEST_CQL_PROTOCOL: ${{ matrix.proto_version }}
TEST_COMPRESSOR: ${{ matrix.compressor }}
TEST_INTEGRATION_TAGS: ${{ matrix.tags }}
run: |
source ~/venv/bin/activate
export JVM_EXTRA_OPTS="${{env.JVM_EXTRA_OPTS}}"
go test -v -run=TestAuthentication -tags "${{ matrix.tags }} gocql_debug" -timeout=15s -runauth ${{ env.args }}
make test-integration-auth
Loading