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 hardcoded DB password and username to Cassandra integration test #5805

Merged
merged 11 commits into from
Aug 23, 2024
Merged
4 changes: 4 additions & 0 deletions cmd/jaeger/config-cassandra.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,13 @@ extensions:
some_storage:
cassandra:
keyspace: "jaeger_v1_dc1"
password: "cassandra"
username: "cassandra"
another_storage:
cassandra:
keyspace: "jaeger_v1_dc1"
password: "cassandra"
username: "cassandra"
receivers:
otlp:
protocols:
Expand Down
2 changes: 2 additions & 0 deletions docker-compose/cassandra/v3/docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ services:
ports:
- "9042:9042"
- "9160:9160"
command: >
/bin/sh -c "echo 'authenticator: PasswordAuthenticator' >> /etc/cassandra/cassandra.yaml && docker-entrypoint.sh cassandra -f"
yurishkuro marked this conversation as resolved.
Show resolved Hide resolved
networks:
- cassandra-net
healthcheck:
Expand Down
4 changes: 4 additions & 0 deletions docker-compose/cassandra/v4/docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
version: '3.8'

services:
cassandra:
image: cassandra:4.1
ports:
- "9042:9042"
- "9160:9160"
command: >
/bin/sh -c "echo 'authenticator: PasswordAuthenticator' >> /etc/cassandra/cassandra.yaml && docker-entrypoint.sh cassandra -f"
networks:
- cassandra-net
healthcheck:
Expand Down
12 changes: 9 additions & 3 deletions plugin/storage/integration/cassandra_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ package integration

import (
"context"
"os"
"testing"

"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -50,14 +51,19 @@ func (*CassandraStorageIntegration) initializeCassandraFactory(t *testing.T, fla
}

func (s *CassandraStorageIntegration) initializeCassandra(t *testing.T) {
username := os.Getenv("CASSANDRA_USERNAME")
password := os.Getenv("CASSANDRA_USERNAME")
f := s.initializeCassandraFactory(t, []string{
"--cassandra.basic.allowed-authenticators=",
"--cassandra.password=password",
"--cassandra.username=username",
"--cassandra.basic.allowed-authenticators=org.apache.cassandra.auth.PasswordAuthenticator",
"--cassandra.password=" + password,
"--cassandra.username=" + username,
"--cassandra.keyspace=jaeger_v1_dc1",
"--cassandra-archive.keyspace=jaeger_v1_dc1_archive",
"--cassandra-archive.enabled=true",
"--cassandra-archive.servers=127.0.0.1",
"--cassandra-archive.basic.allowed-authenticators=org.apache.cassandra.auth.PasswordAuthenticator",
"--cassandra-archive.password=" + password,
"--cassandra-archive.username=" + username,
})
s.factory = f
var err error
Expand Down
10 changes: 7 additions & 3 deletions scripts/cassandra-integration-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,16 @@ apply_schema() {
local schema_dir=plugin/storage/cassandra/
local schema_version=$1
local keyspace=$2
local username=$3
local password=$4
local params=(
--rm
--env CQLSH_HOST=localhost
--env CQLSH_PORT=9042
--env "TEMPLATE=/cassandra-schema/${schema_version}.cql.tmpl"
--env "KEYSPACE=${keyspace}"
--env "CASSANDRA_USERNAME=${username}"
--env "CASSANDRA_PASSWORD=${password}"
--network host
)
docker build -t ${image} ${schema_dir}
Expand All @@ -57,11 +61,11 @@ run_integration_test() {

setup_cassandra "${compose_file}"
yurishkuro marked this conversation as resolved.
Show resolved Hide resolved

apply_schema "$schema_version" "$primaryKeyspace"
apply_schema "$schema_version" "$archiveKeyspace"
apply_schema "$schema_version" "$primaryKeyspace" "cassandra" "cassandra"
apply_schema "$schema_version" "$archiveKeyspace" "cassandra" "cassandra"

if [ "${jaegerVersion}" = "v1" ]; then
STORAGE=cassandra make storage-integration-test
STORAGE=cassandra CASSANDRA_USERNAME="cassandra" CASSANDRA_PASSWORD="cassandra" make storage-integration-test
exit_status=$?
elif [ "${jaegerVersion}" == "v2" ]; then
STORAGE=cassandra make jaeger-v2-storage-integration-test
Expand Down
Loading