Repository: kafka-rust/kafka-rust (language: rust)

Issue:
Fix Integration Tests due to SSL certificate
Fix the following tests: 

test_kafka_client_load_metadata 
test_produce_fetch_messages  
test_commit_offset  
test_commit_offsets 
test_consumer_poll 
test_consumer_commit_messageset_no_consumes

This was broken due to the dependency and Rust upgrade

See this commit: https://github.com/kafka-rust/kafka-rust/commit/4e34584b6cf3fd0ddf950296c2211734bb94c108


Discussion / hints:

Fix patch:
diff --git a/.travis.yml b/.travis.yml
index 263e17141..8a1249be1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -8,50 +8,48 @@ rust:
 services:
   - docker
 
-before_install:
-  - pip install 'travis-cargo<0.2' --user && export PATH=$HOME/.local/bin:$PATH
-
-script:
-  - |
-      travis-cargo build &&
-      ./tests/run-all-tests $KAFKA_VER &&
-      travis-cargo bench &&
-      travis-cargo --only stable doc
-
 env:
   global:
     - RUST_TEST_THREADS: 1
+    - CARGO_TERM_COLOR: always
+
+script: |
+  echo "${DOCKER_HUB_TOKEN}" | docker login -u "${DOCKER_HUB_USER}" --password-stdin &&
+  cargo build &&
+  ./tests/run-all-tests $KAFKA_VER &&
+  cargo doc
 
-  matrix:
+jobs:
+  include:
     # 0.8 doesn't support secure settings
-    #- KAFKA_VER=0.8.2.2 COMPRESSIONS=NONE SECURES=
-    #- KAFKA_VER=0.8.2.2 COMPRESSIONS=SNAPPY SECURES=
-    #- KAFKA_VER=0.8.2.2 COMPRESSIONS=GZIP SECURES=
-
-    #- KAFKA_VER=0.9.0.1 COMPRESSIONS=NONE SECURES=
-    #- KAFKA_VER=0.9.0.1 COMPRESSIONS=NONE SECURES=secure
-    #- KAFKA_VER=0.9.0.1 COMPRESSIONS=SNAPPY SECURES=
-    #- KAFKA_VER=0.9.0.1 COMPRESSIONS=SNAPPY SECURES=secure
-    #- KAFKA_VER=0.9.0.1 COMPRESSIONS=GZIP SECURES=
-    #- KAFKA_VER=0.9.0.1 COMPRESSIONS=GZIP SECURES=secure
-
-    #- KAFKA_VER=0.10.2.1 COMPRESSIONS=NONE SECURES=
-    #- KAFKA_VER=0.10.2.1 COMPRESSIONS=NONE SECURES=secure
-    #- KAFKA_VER=0.10.2.1 COMPRESSIONS=SNAPPY SECURES=
-    #- KAFKA_VER=0.10.2.1 COMPRESSIONS=SNAPPY SECURES=secure
-    #- KAFKA_VER=0.10.2.1 COMPRESSIONS=GZIP SECURES=
-    #- KAFKA_VER=0.10.2.1 COMPRESSIONS=GZIP SECURES=secure
-
-    #- KAFKA_VER=0.11.0.1 COMPRESSIONS=NONE SECURES=
-    #- KAFKA_VER=0.11.0.1 COMPRESSIONS=NONE SECURES=secure
-    #- KAFKA_VER=0.11.0.1 COMPRESSIONS=SNAPPY SECURES=
-    #- KAFKA_VER=0.11.0.1 COMPRESSIONS=SNAPPY SECURES=secure
-    #- KAFKA_VER=0.11.0.1 COMPRESSIONS=GZIP SECURES=
-    #- KAFKA_VER=0.11.0.1 COMPRESSIONS=GZIP SECURES=secure
-
-    - KAFKA_VER=1.0.0 COMPRESSIONS=NONE SECURES=
-    - KAFKA_VER=1.0.0 COMPRESSIONS=NONE SECURES=secure
-    - KAFKA_VER=1.0.0 COMPRESSIONS=SNAPPY SECURES=
-    - KAFKA_VER=1.0.0 COMPRESSIONS=SNAPPY SECURES=secure
-    - KAFKA_VER=1.0.0 COMPRESSIONS=GZIP SECURES=
-    - KAFKA_VER=1.0.0 COMPRESSIONS=GZIP SECURES=secure
+    - env: KAFKA_VER=0.8.2.2 COMPRESSIONS=NONE SECURES=
+    - env: KAFKA_VER=0.8.2.2 COMPRESSIONS=SNAPPY SECURES=
+    - env: KAFKA_VER=0.8.2.2 COMPRESSIONS=GZIP SECURES=
+
+    - env: KAFKA_VER=0.9.0.1 COMPRESSIONS=NONE SECURES=
+    - env: KAFKA_VER=0.9.0.1 COMPRESSIONS=NONE SECURES=secure
+    - env: KAFKA_VER=0.9.0.1 COMPRESSIONS=SNAPPY SECURES=
+    - env: KAFKA_VER=0.9.0.1 COMPRESSIONS=SNAPPY SECURES=secure
+    - env: KAFKA_VER=0.9.0.1 COMPRESSIONS=GZIP SECURES=
+    - env: KAFKA_VER=0.9.0.1 COMPRESSIONS=GZIP SECURES=secure
+
+    - env: KAFKA_VER=0.10.2.1 COMPRESSIONS=NONE SECURES=
+    - env: KAFKA_VER=0.10.2.1 COMPRESSIONS=NONE SECURES=secure
+    - env: KAFKA_VER=0.10.2.1 COMPRESSIONS=SNAPPY SECURES=
+    - env: KAFKA_VER=0.10.2.1 COMPRESSIONS=SNAPPY SECURES=secure
+    - env: KAFKA_VER=0.10.2.1 COMPRESSIONS=GZIP SECURES=
+    - env: KAFKA_VER=0.10.2.1 COMPRESSIONS=GZIP SECURES=secure
+
+    - env: KAFKA_VER=0.11.0.1 COMPRESSIONS=NONE SECURES=
+    - env: KAFKA_VER=0.11.0.1 COMPRESSIONS=NONE SECURES=secure
+    - env: KAFKA_VER=0.11.0.1 COMPRESSIONS=SNAPPY SECURES=
+    - env: KAFKA_VER=0.11.0.1 COMPRESSIONS=SNAPPY SECURES=secure
+    - env: KAFKA_VER=0.11.0.1 COMPRESSIONS=GZIP SECURES=
+    - env: KAFKA_VER=0.11.0.1 COMPRESSIONS=GZIP SECURES=secure
+
+    - env: KAFKA_VER=1.0.0 COMPRESSIONS=NONE SECURES=
+    - env: KAFKA_VER=1.0.0 COMPRESSIONS=NONE SECURES=secure
+    - env: KAFKA_VER=1.0.0 COMPRESSIONS=SNAPPY SECURES=
+    - env: KAFKA_VER=1.0.0 COMPRESSIONS=SNAPPY SECURES=secure
+    - env: KAFKA_VER=1.0.0 COMPRESSIONS=GZIP SECURES=
+    - env: KAFKA_VER=1.0.0 COMPRESSIONS=GZIP SECURES=secure
diff --git a/Cargo.toml b/Cargo.toml
index 8ba3527c9..c77c53b59 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -23,6 +23,7 @@ error-chain = "0.12.3"
 flate2 = { version = "1.0.19", optional = true }
 snap = { version = "0.2.0", optional = true }
 openssl = { version = "0.10", optional = true }
+openssl-sys = { version = "0.9", optional = true }
 
 [dev-dependencies]
 getopts = "0.2"
@@ -36,6 +37,6 @@ lazy_static = "1.3.0"
 default = ["snappy", "gzip", "security"]
 snappy = ["snap"]
 gzip = ["flate2"]
-security = ["openssl"]
+security = ["openssl", "openssl-sys"]
 nightly = []
-integration_tests = []
\ No newline at end of file
+integration_tests = []
diff --git a/build.rs b/build.rs
new file mode 100644
index 000000000..89cf375ba
--- /dev/null
+++ b/build.rs
@@ -0,0 +1,11 @@
+use std::env;
+
+fn main() {
+    if let Ok(v) = env::var("DEP_OPENSSL_VERSION_NUMBER") {
+        let version = u64::from_str_radix(&v, 16).unwrap();
+
+        if version >= 0x1_01_00_00_0 {
+            println!("cargo:rustc-cfg=openssl110");
+        }
+    }
+}


Test patch:
diff --git a/tests/integration/client/mod.rs b/tests/integration/client/mod.rs
index 36480cd10..aaa43bf94 100644
--- a/tests/integration/client/mod.rs
+++ b/tests/integration/client/mod.rs
@@ -51,9 +51,6 @@ fn test_kafka_client_load_metadata() {
         .filter(|name| *name != KAFKA_CONSUMER_OFFSETS_TOPIC_NAME)
         .collect();
     let mut correct_topic_names: HashSet<&str> = HashSet::new();
-
-    println!("Topic:{}", TEST_TOPIC_NAME);
-    println!("Topic:{}", TEST_TOPIC_NAME_2);
     correct_topic_names.insert(TEST_TOPIC_NAME);
     correct_topic_names.insert(TEST_TOPIC_NAME_2);
 
@@ -72,11 +69,11 @@ fn test_kafka_client_load_metadata() {
     assert_eq!(correct_topic_partitions, topic_partitions);
 }
 
-// /// Tests:
-// ///
-// /// * KafkaClient::produce_messages
-// /// * KafkaClient::fetch_messages
-// /// * KafkaClient::fetch_offsets
+/// Tests:
+///
+/// * KafkaClient::produce_messages
+/// * KafkaClient::fetch_messages
+/// * KafkaClient::fetch_offsets
 #[test]
 fn test_produce_fetch_messages() {
     let _ = env_logger::try_init();
diff --git a/tests/integration/consumer_producer/consumer.rs b/tests/integration/consumer_producer/consumer.rs
index 530fa7a76..ccc1ab372 100644
--- a/tests/integration/consumer_producer/consumer.rs
+++ b/tests/integration/consumer_producer/consumer.rs
@@ -5,7 +5,7 @@ use kafka::producer::Record;
 
 use env_logger;
 
-// /// Tests that consuming one message works
+/// Tests that consuming one message works
 #[test]
 fn test_consumer_poll() {
     let _ = env_logger::try_init();
@@ -46,7 +46,7 @@ fn test_consumer_poll() {
     );
 }
 
-// /// Test Consumer::commit_messageset
+/// Test Consumer::commit_messageset
 #[test]
 fn test_consumer_commit_messageset() {
     let _ = env_logger::try_init();
@@ -127,8 +127,8 @@ fn test_consumer_commit_messageset() {
     }
 }
 
-// /// Verify that if Consumer::commit_consumed is called without consuming any
-// /// message sets, nothing is committed.
+/// Verify that if Consumer::commit_consumed is called without consuming any
+/// message sets, nothing is committed.
 #[test]
 fn test_consumer_commit_messageset_no_consumes() {
     let _ = env_logger::try_init();
diff --git a/tests/integration/consumer_producer/producer.rs b/tests/integration/consumer_producer/producer.rs
index aa8c8969f..2456c178e 100644
--- a/tests/integration/consumer_producer/producer.rs
+++ b/tests/integration/consumer_producer/producer.rs
@@ -4,7 +4,7 @@ use env_logger;
 use kafka::error;
 use kafka::producer::Record;
 
-// /// Tests that basic message sending results in a successful call.
+/// Tests that basic message sending results in a successful call.
 #[test]
 fn test_producer_send() {
     let mut producer = test_producer();
@@ -34,7 +34,7 @@ fn test_producer_send_non_existent_topic() {
     );
 }
 
-// /// Simple test for send_all
+/// Simple test for send_all
 #[test]
 fn test_producer_send_all() {
     let mut producer = test_producer();
diff --git a/tests/test_kafka.rs b/tests/test_kafka.rs
index d8d13c22c..c7a3b7cac 100644
--- a/tests/test_kafka.rs
+++ b/tests/test_kafka.rs
@@ -40,7 +40,7 @@ mod integration {
     pub const TEST_GROUP_NAME: &str = "kafka-rust-tester";
     pub const TEST_TOPIC_PARTITIONS: [i32; 2] = [0, 1];
     pub const KAFKA_CONSUMER_OFFSETS_TOPIC_NAME: &str = "__consumer_offsets";
-    const RSA_KEY_SIZE: u32 = 2024;
+    const RSA_KEY_SIZE: u32 = 4096;
 
     // env vars
     const KAFKA_CLIENT_SECURE: &str = "KAFKA_CLIENT_SECURE";
@@ -112,7 +112,12 @@ mod integration {
     ) -> Result<SecurityConfig, openssl::error::ErrorStack> {
         let mut builder = SslConnector::builder(SslMethod::tls()).unwrap();
 
+        #[cfg(openssl110)]
+        builder.set_cipher_list("DEFAULT@SECLEVEL=0").unwrap();
+
+        #[cfg(not(openssl110))]
         builder.set_cipher_list("DEFAULT").unwrap();
+
         builder.set_certificate(&*keypair).unwrap();
         builder.set_verify(SslVerifyMode::NONE);