Skip to content
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

Add cassandra v4 support #3225

Merged
merged 8 commits into from
Aug 29, 2021
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Feedbacks
Signed-off-by: Ashmita Bohara <[email protected]>
Ashmita152 committed Aug 27, 2021
commit d4ccaa617cbe05e81d7d6c9c8e8c27a492f0c067
8 changes: 1 addition & 7 deletions .github/workflows/ci-cassandra.yml
Original file line number Diff line number Diff line change
@@ -29,10 +29,4 @@ jobs:
go-version: ^1.17

- name: Run cassandra integration tests
run: bash scripts/cassandra-integration-test.sh ${{ matrix.version.schema }}
services:
cassandra:
image: ${{ matrix.version.distribution }}:${{ matrix.version.image }}
ports:
- 9042:9042
- 9160:9160
run: bash scripts/cassandra-integration-test.sh ${{ matrix.version.image }} ${{ matrix.version.schema }}
70 changes: 62 additions & 8 deletions scripts/cassandra-integration-test.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,66 @@
#!/bin/bash

set -ex
set -euxf -o pipefail

# Build the schema container and run it rather than using the existing container in Docker Hub since that
# requires this current build to succeed before this test can use it; chicken and egg problem.
docker build -t jaeger-cassandra-schema-integration-test plugin/storage/cassandra/
docker run -e CQLSH_HOST=localhost -e CQLSH_PORT=9042 -e TEMPLATE=/cassandra-schema/$1.cql.tmpl --network=host jaeger-cassandra-schema-integration-test
usage() {
echo $"Usage: $0 <cassandra_version> <schema_version>"
exit 1
}

# Run the test.
export STORAGE=cassandra
make storage-integration-test
check_arg() {
if [ ! $# -eq 2 ]; then
echo "ERROR: need exactly two arguments, <cassandra_version> <schema_version>"
usage
fi
}

setup_cassandra() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is a nice refactoring, makes the script much more maintainable

local tag=$1
local image=cassandra
local params=(
--rm
--detach
--publish 9042:9042
--publish 9160:9160
)
local cid=$(docker run ${params[@]} ${image}:${tag})
echo ${cid}
}

teardown_cassandra() {
local cid=$1
docker kill ${cid}
}

apply_schema() {
local image=cassandra-schema
local schema_dir=plugin/storage/cassandra/
local schema_version=$1
local params=(
--rm
--env CQLSH_HOST=localhost
--env CQLSH_PORT=9042
--env TEMPLATE=/cassandra-schema/${schema_version}.cql.tmpl
--network host
)
docker build -t ${image} ${schema_dir}
docker run ${params[@]} ${image}
}

run_integration_test() {
local version=$1
local schema_version=$2
local cid=$(setup_cassandra ${version})
apply_schema "$2"
STORAGE=cassandra make storage-integration-test
teardown_cassandra ${cid}
}

main() {
check_arg "$@"

echo "Executing integration test for $1 with schema $2.cql.tmpl"
run_integration_test "$1" "$2"
}

main "$@"
2 changes: 1 addition & 1 deletion scripts/es-integration-test.sh
Original file line number Diff line number Diff line change
@@ -78,7 +78,7 @@ run_integration_test() {
if [ ${distro} = "elasticsearch" ]; then
cid=$(setup_es ${version})
elif [ ${distro} == "opensearch" ]; then
cid=$(setup_opensearch ${version})
cid=$(setup_opensearch ${version})
else
echo "Unknown distribution $distro. Valid options are opensearch or elasticsearch"
usage