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

Use docker compose for cassandra integration tests #5520

Merged
merged 4 commits into from
Jun 3, 2024
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
7 changes: 7 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -136,3 +136,10 @@ updates:
allow:
- dependency-name: "bitnami/kafka"
update-types: ["version-update:semver-minor"]
- package-ecosystem: docker
directory: /docker-compose/cassandra
Copy link
Member

Choose a reason for hiding this comment

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

@hellspawn679 I don't think this is working, the dependabot runs did not pick this up. I suspect that when you pick docker ecosystem and a directory, dependabot looks for standard file names like Dockerfile or docker-compose.yml. Since you're using custom file names like v3.yml, dependabot doesn't know that they are for docker-compose. We probably need to list the files explicitly instead of specifying a dir only.

Copy link
Member

Choose a reason for hiding this comment

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

schedule:
interval: daily
allow:
- dependency-name: "cassandra"
update-types: ["version-update:semver-minor"]
6 changes: 2 additions & 4 deletions .github/workflows/ci-cassandra.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,9 @@ jobs:
version:
- distribution: cassandra
major: 3.x
image: 3.11
schema: v003
- distribution: cassandra
major: 4.x
image: 4.0
schema: v004
name: ${{ matrix.version.distribution }} ${{ matrix.version.major }} ${{ matrix.jaeger-version }}
steps:
Expand All @@ -45,10 +43,10 @@ jobs:

- name: Run cassandra integration tests
id: test-execution
run: bash scripts/cassandra-integration-test.sh ${{ matrix.version.image }} ${{ matrix.version.schema }} ${{ matrix.jaeger-version }}
run: bash scripts/cassandra-integration-test.sh ${{ matrix.version.major }} ${{ matrix.version.schema }} ${{ matrix.jaeger-version }}

- name: Output Cassandra logs
run: docker logs ${{ steps.test-execution.outputs.cid }}
run: docker compose -f ${{ steps.test-execution.outputs.docker_compose_file }} logs
if: ${{ failure() }}

- name: Upload coverage to codecov
Expand Down
19 changes: 19 additions & 0 deletions docker-compose/cassandra/v3.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: '3.8'

services:
cassandra:
image: cassandra:3.11
ports:
- "9042:9042"
- "9160:9160"
networks:
- cassandra-net
healthcheck:
test: ["CMD", "cqlsh", "-e", "describe keyspaces"]
interval: 30s
timeout: 10s
retries: 5

networks:
cassandra-net:
driver: bridge
19 changes: 19 additions & 0 deletions docker-compose/cassandra/v4.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
version: '3.8'

services:
cassandra:
image: cassandra:4.0
ports:
- "9042:9042"
- "9160:9160"
networks:
- cassandra-net
healthcheck:
test: ["CMD", "cqlsh", "-e", "describe keyspaces"]
interval: 30s
timeout: 10s
retries: 5

networks:
cassandra-net:
driver: bridge
25 changes: 9 additions & 16 deletions scripts/cassandra-integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,14 @@ check_arg() {
}

setup_cassandra() {
local tag=$1
local image=cassandra
local params=(
--detach
--publish 9042:9042
--publish 9160:9160
)
local cid
cid=$(docker run "${params[@]}" "${image}:${tag}")
echo "cid=${cid}" >> "$GITHUB_OUTPUT"
echo "${cid}"
local compose_file=$1
docker compose -f "$compose_file" up -d
echo "docker_compose_file=${compose_file}" >> "${GITHUB_OUTPUT:-/dev/null}"
}

teardown_cassandra() {
local cid=$1
docker kill "${cid}"
local compose_file=$1
docker compose -f "$compose_file" down
exit "${exit_status}"
}

Expand All @@ -53,13 +45,14 @@ apply_schema() {

run_integration_test() {
local version=$1
local major_version=${version%%.*}
Copy link
Member

Choose a reason for hiding this comment

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

Can we do the same with es/os scripts? Their matrix was changed "7.x" -> "7", which makes the workflow names look weird. I would prefer to go back to 7.x / 8.x

Copy link
Member

Choose a reason for hiding this comment

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

Can be a separate PR for that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok i will create a new pr after this

local schema_version=$2
local jaegerVersion=$3
local primaryKeyspace="jaeger_v1_dc1"
local archiveKeyspace="jaeger_v1_dc1_archive"
local compose_file="docker-compose/cassandra/v$major_version.yaml"

local cid
cid=$(setup_cassandra "${version}")
setup_cassandra "${compose_file}"

apply_schema "$schema_version" "$primaryKeyspace"
apply_schema "$schema_version" "$archiveKeyspace"
Expand All @@ -76,7 +69,7 @@ run_integration_test() {
fi

# shellcheck disable=SC2064
trap "teardown_cassandra ${cid}" EXIT
trap "teardown_cassandra ${compose_file}" EXIT
}


Expand Down
Loading