Merge pull request #31146 from NeQuissimus/kafka_updates

Kafka: Update + Tests

authored by

Tim Steinbach and committed by
GitHub
97f172a1 a789f5b2

+249 -16
+5 -1
nixos/release.nix
··· 270 270 tests.plasma5 = callTest tests/plasma5.nix {}; 271 271 tests.keymap = callSubTests tests/keymap.nix {}; 272 272 tests.initrdNetwork = callTest tests/initrd-network.nix {}; 273 + tests.kafka_0_9 = callTest tests/kafka_0_9.nix {}; 274 + tests.kafka_0_10 = callTest tests/kafka_0_10.nix {}; 275 + tests.kafka_0_11 = callTest tests/kafka_0_11.nix {}; 276 + tests.kafka_1_0 = callTest tests/kafka_1_0.nix {}; 273 277 tests.kernel-copperhead = callTest tests/kernel-copperhead.nix {}; 274 278 tests.kernel-latest = callTest tests/kernel-latest.nix {}; 275 279 tests.kernel-lts = callTest tests/kernel-lts.nix {}; ··· 330 334 tests.wordpress = callTest tests/wordpress.nix {}; 331 335 tests.xfce = callTest tests/xfce.nix {}; 332 336 tests.xmonad = callTest tests/xmonad.nix {}; 333 - 337 + tests.zookeeper = callTest tests/zookeeper.nix {}; 334 338 335 339 /* Build a bunch of typical closures so that Hydra can keep track of 336 340 the evolution of closure sizes. */
+48
nixos/tests/kafka_0_10.nix
··· 1 + import ./make-test.nix ({ pkgs, lib, ... } : 2 + let 3 + kafkaPackage = pkgs.apacheKafka_0_10; 4 + in { 5 + name = "kafka_0_10"; 6 + meta = with pkgs.stdenv.lib.maintainers; { 7 + maintainers = [ nequissimus ]; 8 + }; 9 + 10 + nodes = { 11 + zookeeper1 = { config, ... }: { 12 + services.zookeeper = { 13 + enable = true; 14 + }; 15 + 16 + networking.firewall.allowedTCPPorts = [ 2181 ]; 17 + }; 18 + kafka = { config, ... }: { 19 + services.apache-kafka = { 20 + enable = true; 21 + extraProperties = '' 22 + offsets.topic.replication.factor = 1 23 + ''; 24 + package = kafkaPackage; 25 + zookeeper = "zookeeper1:2181"; 26 + }; 27 + 28 + networking.firewall.allowedTCPPorts = [ 9092 ]; 29 + virtualisation.memorySize = 2048; 30 + }; 31 + }; 32 + 33 + testScript = '' 34 + startAll; 35 + 36 + $zookeeper1->waitForUnit("zookeeper"); 37 + $zookeeper1->waitForUnit("network.target"); 38 + $zookeeper1->waitForOpenPort(2181); 39 + 40 + $kafka->waitForUnit("apache-kafka"); 41 + $kafka->waitForUnit("network.target"); 42 + $kafka->waitForOpenPort(9092); 43 + 44 + $kafka->waitUntilSucceeds("${kafkaPackage}/bin/kafka-topics.sh --create --zookeeper zookeeper1:2181 --partitions 1 --replication-factor 1 --topic testtopic"); 45 + $kafka->mustSucceed("echo 'test 1' | ${kafkaPackage}/bin/kafka-console-producer.sh --broker-list localhost:9092 --topic testtopic"); 46 + $kafka->mustSucceed("${kafkaPackage}/bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic testtopic --from-beginning --max-messages 1 | grep 'test 1'"); 47 + ''; 48 + })
+48
nixos/tests/kafka_0_11.nix
··· 1 + import ./make-test.nix ({ pkgs, lib, ... } : 2 + let 3 + kafkaPackage = pkgs.apacheKafka_0_11; 4 + in { 5 + name = "kafka_0_11"; 6 + meta = with pkgs.stdenv.lib.maintainers; { 7 + maintainers = [ nequissimus ]; 8 + }; 9 + 10 + nodes = { 11 + zookeeper1 = { config, ... }: { 12 + services.zookeeper = { 13 + enable = true; 14 + }; 15 + 16 + networking.firewall.allowedTCPPorts = [ 2181 ]; 17 + }; 18 + kafka = { config, ... }: { 19 + services.apache-kafka = { 20 + enable = true; 21 + extraProperties = '' 22 + offsets.topic.replication.factor = 1 23 + ''; 24 + package = kafkaPackage; 25 + zookeeper = "zookeeper1:2181"; 26 + }; 27 + 28 + networking.firewall.allowedTCPPorts = [ 9092 ]; 29 + virtualisation.memorySize = 2048; 30 + }; 31 + }; 32 + 33 + testScript = '' 34 + startAll; 35 + 36 + $zookeeper1->waitForUnit("zookeeper"); 37 + $zookeeper1->waitForUnit("network.target"); 38 + $zookeeper1->waitForOpenPort(2181); 39 + 40 + $kafka->waitForUnit("apache-kafka"); 41 + $kafka->waitForUnit("network.target"); 42 + $kafka->waitForOpenPort(9092); 43 + 44 + $kafka->waitUntilSucceeds("${kafkaPackage}/bin/kafka-topics.sh --create --zookeeper zookeeper1:2181 --partitions 1 --replication-factor 1 --topic testtopic"); 45 + $kafka->mustSucceed("echo 'test 1' | ${kafkaPackage}/bin/kafka-console-producer.sh --broker-list localhost:9092 --topic testtopic"); 46 + $kafka->mustSucceed("${kafkaPackage}/bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic testtopic --from-beginning --max-messages 1 | grep 'test 1'"); 47 + ''; 48 + })
+48
nixos/tests/kafka_0_9.nix
··· 1 + import ./make-test.nix ({ pkgs, lib, ... } : 2 + let 3 + kafkaPackage = pkgs.apacheKafka_0_9; 4 + in { 5 + name = "kafka_0_9"; 6 + meta = with pkgs.stdenv.lib.maintainers; { 7 + maintainers = [ nequissimus ]; 8 + }; 9 + 10 + nodes = { 11 + zookeeper1 = { config, ... }: { 12 + services.zookeeper = { 13 + enable = true; 14 + }; 15 + 16 + networking.firewall.allowedTCPPorts = [ 2181 ]; 17 + }; 18 + kafka = { config, ... }: { 19 + services.apache-kafka = { 20 + enable = true; 21 + extraProperties = '' 22 + offsets.topic.replication.factor = 1 23 + ''; 24 + package = kafkaPackage; 25 + zookeeper = "zookeeper1:2181"; 26 + }; 27 + 28 + networking.firewall.allowedTCPPorts = [ 9092 ]; 29 + virtualisation.memorySize = 2048; 30 + }; 31 + }; 32 + 33 + testScript = '' 34 + startAll; 35 + 36 + $zookeeper1->waitForUnit("zookeeper"); 37 + $zookeeper1->waitForUnit("network.target"); 38 + $zookeeper1->waitForOpenPort(2181); 39 + 40 + $kafka->waitForUnit("apache-kafka"); 41 + $kafka->waitForUnit("network.target"); 42 + $kafka->waitForOpenPort(9092); 43 + 44 + $kafka->waitUntilSucceeds("${kafkaPackage}/bin/kafka-topics.sh --create --zookeeper zookeeper1:2181 --partitions 1 --replication-factor 1 --topic testtopic"); 45 + $kafka->mustSucceed("echo 'test 1' | ${kafkaPackage}/bin/kafka-console-producer.sh --broker-list localhost:9092 --topic testtopic"); 46 + $kafka->mustSucceed("${kafkaPackage}/bin/kafka-console-consumer.sh --zookeeper zookeeper1:2181 --topic testtopic --from-beginning --max-messages 1 | grep 'test 1'"); 47 + ''; 48 + })
+48
nixos/tests/kafka_1_0.nix
··· 1 + import ./make-test.nix ({ pkgs, lib, ... } : 2 + let 3 + kafkaPackage = pkgs.apacheKafka_1_0; 4 + in { 5 + name = "kafka_1_0"; 6 + meta = with pkgs.stdenv.lib.maintainers; { 7 + maintainers = [ nequissimus ]; 8 + }; 9 + 10 + nodes = { 11 + zookeeper1 = { config, ... }: { 12 + services.zookeeper = { 13 + enable = true; 14 + }; 15 + 16 + networking.firewall.allowedTCPPorts = [ 2181 ]; 17 + }; 18 + kafka = { config, ... }: { 19 + services.apache-kafka = { 20 + enable = true; 21 + extraProperties = '' 22 + offsets.topic.replication.factor = 1 23 + ''; 24 + package = kafkaPackage; 25 + zookeeper = "zookeeper1:2181"; 26 + }; 27 + 28 + networking.firewall.allowedTCPPorts = [ 9092 ]; 29 + virtualisation.memorySize = 2048; 30 + }; 31 + }; 32 + 33 + testScript = '' 34 + startAll; 35 + 36 + $zookeeper1->waitForUnit("zookeeper"); 37 + $zookeeper1->waitForUnit("network.target"); 38 + $zookeeper1->waitForOpenPort(2181); 39 + 40 + $kafka->waitForUnit("apache-kafka"); 41 + $kafka->waitForUnit("network.target"); 42 + $kafka->waitForOpenPort(9092); 43 + 44 + $kafka->waitUntilSucceeds("${kafkaPackage}/bin/kafka-topics.sh --create --zookeeper zookeeper1:2181 --partitions 1 --replication-factor 1 --topic testtopic"); 45 + $kafka->mustSucceed("echo 'test 1' | ${kafkaPackage}/bin/kafka-console-producer.sh --broker-list localhost:9092 --topic testtopic"); 46 + $kafka->mustSucceed("${kafkaPackage}/bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic testtopic --from-beginning --max-messages 1 | grep 'test 1'"); 47 + ''; 48 + })
+28
nixos/tests/zookeeper.nix
··· 1 + import ./make-test.nix ({ pkgs, ...} : { 2 + name = "zookeeper"; 3 + meta = with pkgs.stdenv.lib.maintainers; { 4 + maintainers = [ nequissimus ]; 5 + }; 6 + 7 + nodes = { 8 + server = { pkgs, config, ... }: { 9 + services.zookeeper = { 10 + enable = true; 11 + }; 12 + 13 + networking.firewall.allowedTCPPorts = [ 2181 ]; 14 + }; 15 + }; 16 + 17 + testScript = '' 18 + startAll; 19 + 20 + $server->waitForUnit("zookeeper"); 21 + $server->waitForUnit("network.target"); 22 + $server->waitForOpenPort(2181); 23 + 24 + $server->waitUntilSucceeds("${pkgs.zookeeper}/bin/zkCli.sh -server localhost:2181 create /foo bar"); 25 + $server->waitUntilSucceeds("${pkgs.zookeeper}/bin/zkCli.sh -server localhost:2181 set /foo hello"); 26 + $server->waitUntilSucceeds("${pkgs.zookeeper}/bin/zkCli.sh -server localhost:2181 get /foo | grep hello"); 27 + ''; 28 + })
+21 -13
pkgs/servers/apache-kafka/default.nix
··· 1 1 { stdenv, fetchurl, jre, makeWrapper, bash, 2 - majorVersion ? "0.9" }: 2 + majorVersion ? "1.0" }: 3 3 4 4 let 5 5 versionMap = { 6 - "0.8" = { kafkaVersion = "0.8.2.2"; 7 - scalaVersion = "2.10"; 8 - sha256 = "1azccf1k0nr8y1sfpjgqf9swyp87ypvgva68ci4kczwcx1z9d89v"; 9 - }; 10 - "0.9" = { kafkaVersion = "0.9.0.1"; 11 - scalaVersion = "2.11"; 12 - sha256 = "0ykcjv5dz9i5bws9my2d60pww1g9v2p2nqr67h0i2xrjm7az8a6v"; 13 - }; 14 - "0.10" = { kafkaVersion = "0.10.2.0"; 15 - scalaVersion = "2.12"; 16 - sha256 = "0py43s6zv8z7wr2lk8403k07xxckl11gla3vs4gr99lixc4whis1"; 17 - }; 6 + "0.9" = { 7 + kafkaVersion = "0.9.0.1"; 8 + scalaVersion = "2.11"; 9 + sha256 = "0ykcjv5dz9i5bws9my2d60pww1g9v2p2nqr67h0i2xrjm7az8a6v"; 10 + }; 11 + "0.10" = { 12 + kafkaVersion = "0.10.2.1"; 13 + scalaVersion = "2.12"; 14 + sha256 = "0iszr6r0n9yjgq7kcp1hf00fg754m86gs4jzqc18542an94b88z5"; 15 + }; 16 + "0.11" = { 17 + kafkaVersion = "0.11.0.1"; 18 + scalaVersion = "2.12"; 19 + sha256 = "1wj639h95aq5n132fq1rbyzqh5rsa4mlhbg3c5mszqglnzdz4xn7"; 20 + }; 21 + "1.0" = { 22 + kafkaVersion = "1.0.0"; 23 + scalaVersion = "2.12"; 24 + sha256 = "1cs4nmp39m99gqjpy5klsffqksc0h9pz514jkq99qb95a83x1cfm"; 25 + }; 18 26 }; 19 27 in 20 28
+3 -2
pkgs/top-level/all-packages.nix
··· 6871 6871 6872 6872 apacheAnt = callPackage ../development/tools/build-managers/apache-ant { }; 6873 6873 6874 - apacheKafka = apacheKafka_0_10; 6875 - apacheKafka_0_8 = callPackage ../servers/apache-kafka { majorVersion = "0.8"; }; 6874 + apacheKafka = apacheKafka_1_0; 6876 6875 apacheKafka_0_9 = callPackage ../servers/apache-kafka { majorVersion = "0.9"; }; 6877 6876 apacheKafka_0_10 = callPackage ../servers/apache-kafka { majorVersion = "0.10"; }; 6877 + apacheKafka_0_11 = callPackage ../servers/apache-kafka { majorVersion = "0.11"; }; 6878 + apacheKafka_1_0 = callPackage ../servers/apache-kafka { majorVersion = "1.0"; }; 6878 6879 6879 6880 kt = callPackage ../tools/misc/kt {}; 6880 6881