Skip to content

Commit

Permalink
Merge branch 'main' into kafka_java_standard_test_suite
Browse files Browse the repository at this point in the history
  • Loading branch information
rukai authored Jun 2, 2024
2 parents 44d9968 + 8c829c5 commit 00705b3
Show file tree
Hide file tree
Showing 6 changed files with 293 additions and 33 deletions.
43 changes: 43 additions & 0 deletions shotover-proxy/tests/kafka_int_tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,49 @@ async fn cluster_sasl_scram_over_mtls_single_shotover(#[case] driver: KafkaDrive
.expect("Shotover did not shutdown within 10s");
}

#[rstest]
//#[cfg_attr(feature = "kafka-cpp-driver-tests", case::cpp(KafkaDriver::Cpp))] // CPP driver does not support scram
#[case::java(KafkaDriver::Java)]
#[tokio::test(flavor = "multi_thread")] // multi_thread is needed since java driver will block when consuming, causing shotover logs to not appear
async fn cluster_sasl_scram_over_mtls_multi_shotover(#[case] driver: KafkaDriver) {
test_helpers::cert::generate_kafka_test_certs();

let _docker_compose =
docker_compose("tests/test-configs/kafka/cluster-sasl-scram-over-mtls/docker-compose.yaml");

let mut shotovers = vec![];
for i in 1..4 {
shotovers.push(
shotover_process(&format!(
"tests/test-configs/kafka/cluster-sasl-scram-over-mtls/topology{i}.yaml"
))
.with_config(&format!(
"tests/test-configs/shotover-config/config{i}.yaml"
))
.with_log_name(&format!("shotover{i}"))
.start()
.await,
);
}

let connection_builder =
KafkaConnectionBuilder::new(driver, "127.0.0.1:9192").use_sasl_scram("user", "password");
match driver {
#[cfg(feature = "kafka-cpp-driver-tests")]
KafkaDriver::Cpp => test_cases::standard_test_suite(connection_builder).await,
KafkaDriver::Java => test_cases::minimal_test_suite(connection_builder).await,
}

for shotover in shotovers {
tokio::time::timeout(
Duration::from_secs(10),
shotover.shutdown_and_then_consume_events(&multi_shotover_events(driver)),
)
.await
.expect("Shotover did not shutdown within 10s");
}
}

#[rstest]
#[cfg_attr(feature = "kafka-cpp-driver-tests", case::cpp(KafkaDriver::Cpp))]
#[case::java(KafkaDriver::Java)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ sources:
local_shotover_broker_id: 0
first_contact_points: ["172.16.1.2:9092"]
authorize_scram_over_mtls:
mtls_port_contact_points: ["172.16.1.2:9094", "172.16.1.3:9094", "172.16.1.4:9094"]
mtls_port_contact_points: ["172.16.1.2:9094"]
tls:
certificate_authority_path: "tests/test-configs/kafka/tls/certs/localhost_CA.crt"
certificate_path: "tests/test-configs/kafka/tls/certs/localhost.crt"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
sources:
- Kafka:
name: "kafka"
listen_addr: "127.0.0.1:9191"
chain:
- KafkaSinkCluster:
shotover_nodes:
- address: "127.0.0.1:9191"
rack: "rack0"
broker_id: 0
- address: "127.0.0.1:9192"
rack: "rack0"
broker_id: 1
- address: "127.0.0.1:9193"
rack: "rack0"
broker_id: 2
local_shotover_broker_id: 0
first_contact_points: ["172.16.1.2:9092"]
authorize_scram_over_mtls:
# every shotover node purposefully tests a different number of contact points
mtls_port_contact_points: ["172.16.1.2:9094"]
tls:
certificate_authority_path: "tests/test-configs/kafka/tls/certs/localhost_CA.crt"
certificate_path: "tests/test-configs/kafka/tls/certs/localhost.crt"
private_key_path: "tests/test-configs/kafka/tls/certs/localhost.key"
verify_hostname: true
connect_timeout_ms: 3000
tls:
certificate_authority_path: "tests/test-configs/kafka/tls/certs/localhost_CA.crt"
certificate_path: "tests/test-configs/kafka/tls/certs/localhost.crt"
private_key_path: "tests/test-configs/kafka/tls/certs/localhost.key"
verify_hostname: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
sources:
- Kafka:
name: "kafka"
listen_addr: "127.0.0.1:9192"
chain:
- KafkaSinkCluster:
shotover_nodes:
- address: "127.0.0.1:9191"
rack: "rack0"
broker_id: 0
- address: "127.0.0.1:9192"
rack: "rack0"
broker_id: 1
- address: "127.0.0.1:9193"
rack: "rack0"
broker_id: 2
local_shotover_broker_id: 0
first_contact_points: ["172.16.1.2:9092"]
authorize_scram_over_mtls:
# every shotover node purposefully tests a different number of contact points
mtls_port_contact_points: ["172.16.1.2:9094", "172.16.1.3:9094"]
tls:
certificate_authority_path: "tests/test-configs/kafka/tls/certs/localhost_CA.crt"
certificate_path: "tests/test-configs/kafka/tls/certs/localhost.crt"
private_key_path: "tests/test-configs/kafka/tls/certs/localhost.key"
verify_hostname: true
connect_timeout_ms: 3000
tls:
certificate_authority_path: "tests/test-configs/kafka/tls/certs/localhost_CA.crt"
certificate_path: "tests/test-configs/kafka/tls/certs/localhost.crt"
private_key_path: "tests/test-configs/kafka/tls/certs/localhost.key"
verify_hostname: true
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
sources:
- Kafka:
name: "kafka"
listen_addr: "127.0.0.1:9193"
chain:
- KafkaSinkCluster:
shotover_nodes:
- address: "127.0.0.1:9191"
rack: "rack0"
broker_id: 0
- address: "127.0.0.1:9192"
rack: "rack0"
broker_id: 1
- address: "127.0.0.1:9193"
rack: "rack0"
broker_id: 2
local_shotover_broker_id: 0
first_contact_points: ["172.16.1.2:9092"]
authorize_scram_over_mtls:
# every shotover node purposefully tests a different number of contact points
mtls_port_contact_points: ["172.16.1.2:9094", "172.16.1.3:9094", "172.16.1.4:9094"]
tls:
certificate_authority_path: "tests/test-configs/kafka/tls/certs/localhost_CA.crt"
certificate_path: "tests/test-configs/kafka/tls/certs/localhost.crt"
private_key_path: "tests/test-configs/kafka/tls/certs/localhost.key"
verify_hostname: true
connect_timeout_ms: 3000
tls:
certificate_authority_path: "tests/test-configs/kafka/tls/certs/localhost_CA.crt"
certificate_path: "tests/test-configs/kafka/tls/certs/localhost.crt"
private_key_path: "tests/test-configs/kafka/tls/certs/localhost.key"
verify_hostname: true
Loading

0 comments on commit 00705b3

Please sign in to comment.