From 51629d777d3d7ff2a91ff9bb1f09ad00544cf45a Mon Sep 17 00:00:00 2001 From: Tim Steinbach Date: Thu, 2 Nov 2017 13:37:24 -0400 Subject: [PATCH 1/7] kafka: Add 0.11.0.1 --- pkgs/servers/apache-kafka/default.nix | 32 +++++++++++++++++---------- pkgs/top-level/all-packages.nix | 1 + 2 files changed, 21 insertions(+), 12 deletions(-) diff --git a/pkgs/servers/apache-kafka/default.nix b/pkgs/servers/apache-kafka/default.nix index cc68697756cd..da733df740b9 100644 --- a/pkgs/servers/apache-kafka/default.nix +++ b/pkgs/servers/apache-kafka/default.nix @@ -3,18 +3,26 @@ let versionMap = { - "0.8" = { kafkaVersion = "0.8.2.2"; - scalaVersion = "2.10"; - sha256 = "1azccf1k0nr8y1sfpjgqf9swyp87ypvgva68ci4kczwcx1z9d89v"; - }; - "0.9" = { kafkaVersion = "0.9.0.1"; - scalaVersion = "2.11"; - sha256 = "0ykcjv5dz9i5bws9my2d60pww1g9v2p2nqr67h0i2xrjm7az8a6v"; - }; - "0.10" = { kafkaVersion = "0.10.2.0"; - scalaVersion = "2.12"; - sha256 = "0py43s6zv8z7wr2lk8403k07xxckl11gla3vs4gr99lixc4whis1"; - }; + "0.8" = { + kafkaVersion = "0.8.2.2"; + scalaVersion = "2.10"; + sha256 = "1azccf1k0nr8y1sfpjgqf9swyp87ypvgva68ci4kczwcx1z9d89v"; + }; + "0.9" = { + kafkaVersion = "0.9.0.1"; + scalaVersion = "2.11"; + sha256 = "0ykcjv5dz9i5bws9my2d60pww1g9v2p2nqr67h0i2xrjm7az8a6v"; + }; + "0.10" = { + kafkaVersion = "0.10.2.0"; + scalaVersion = "2.12"; + sha256 = "0py43s6zv8z7wr2lk8403k07xxckl11gla3vs4gr99lixc4whis1"; + }; + "0.11" = { + kafkaVersion = "0.11.0.1"; + scalaVersion = "2.12"; + sha256 = "1wj639h95aq5n132fq1rbyzqh5rsa4mlhbg3c5mszqglnzdz4xn7"; + }; }; in diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 420c84b9b2bc..dbbdabab126f 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6863,6 +6863,7 @@ with pkgs; apacheKafka_0_8 = callPackage ../servers/apache-kafka { majorVersion = "0.8"; }; apacheKafka_0_9 = callPackage ../servers/apache-kafka { majorVersion = "0.9"; }; apacheKafka_0_10 = callPackage ../servers/apache-kafka { majorVersion = "0.10"; }; + apacheKafka_0_11 = callPackage ../servers/apache-kafka { majorVersion = "0.11"; }; kt = callPackage ../tools/misc/kt {}; From 46b09a8d556b03227fcd40b12d739a20d4f408ed Mon Sep 17 00:00:00 2001 From: Tim Steinbach Date: Thu, 2 Nov 2017 13:46:07 -0400 Subject: [PATCH 2/7] kafka: Add 1.0.0 --- pkgs/servers/apache-kafka/default.nix | 5 +++++ pkgs/top-level/all-packages.nix | 1 + 2 files changed, 6 insertions(+) diff --git a/pkgs/servers/apache-kafka/default.nix b/pkgs/servers/apache-kafka/default.nix index da733df740b9..e597a736c6fa 100644 --- a/pkgs/servers/apache-kafka/default.nix +++ b/pkgs/servers/apache-kafka/default.nix @@ -23,6 +23,11 @@ let scalaVersion = "2.12"; sha256 = "1wj639h95aq5n132fq1rbyzqh5rsa4mlhbg3c5mszqglnzdz4xn7"; }; + "1.0" = { + kafkaVersion = "1.0.0"; + scalaVersion = "2.12"; + sha256 = "1cs4nmp39m99gqjpy5klsffqksc0h9pz514jkq99qb95a83x1cfm"; + }; }; in diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index dbbdabab126f..5c5d44f45524 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6864,6 +6864,7 @@ with pkgs; apacheKafka_0_9 = callPackage ../servers/apache-kafka { majorVersion = "0.9"; }; apacheKafka_0_10 = callPackage ../servers/apache-kafka { majorVersion = "0.10"; }; apacheKafka_0_11 = callPackage ../servers/apache-kafka { majorVersion = "0.11"; }; + apacheKafka_1_0 = callPackage ../servers/apache-kafka { majorVersion = "1.0"; }; kt = callPackage ../tools/misc/kt {}; From 90f0fd9d0cb5952c4f9995fd33c4d63c853996e3 Mon Sep 17 00:00:00 2001 From: Tim Steinbach Date: Thu, 2 Nov 2017 13:48:01 -0400 Subject: [PATCH 3/7] kafka: 0.10.2.0 -> 0.10.2.1 --- pkgs/servers/apache-kafka/default.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/servers/apache-kafka/default.nix b/pkgs/servers/apache-kafka/default.nix index e597a736c6fa..0e2dfd87ddeb 100644 --- a/pkgs/servers/apache-kafka/default.nix +++ b/pkgs/servers/apache-kafka/default.nix @@ -14,9 +14,9 @@ let sha256 = "0ykcjv5dz9i5bws9my2d60pww1g9v2p2nqr67h0i2xrjm7az8a6v"; }; "0.10" = { - kafkaVersion = "0.10.2.0"; + kafkaVersion = "0.10.2.1"; scalaVersion = "2.12"; - sha256 = "0py43s6zv8z7wr2lk8403k07xxckl11gla3vs4gr99lixc4whis1"; + sha256 = "0iszr6r0n9yjgq7kcp1hf00fg754m86gs4jzqc18542an94b88z5"; }; "0.11" = { kafkaVersion = "0.11.0.1"; From ace06a2bf1527e8dcae3e82ff394c797404c3899 Mon Sep 17 00:00:00 2001 From: Tim Steinbach Date: Thu, 2 Nov 2017 13:48:22 -0400 Subject: [PATCH 4/7] kafka: Default to 1.0 --- pkgs/servers/apache-kafka/default.nix | 2 +- pkgs/top-level/all-packages.nix | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkgs/servers/apache-kafka/default.nix b/pkgs/servers/apache-kafka/default.nix index 0e2dfd87ddeb..54784f6ff310 100644 --- a/pkgs/servers/apache-kafka/default.nix +++ b/pkgs/servers/apache-kafka/default.nix @@ -1,5 +1,5 @@ { stdenv, fetchurl, jre, makeWrapper, bash, - majorVersion ? "0.9" }: + majorVersion ? "1.0" }: let versionMap = { diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 5c5d44f45524..fd96ade2f30c 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6859,7 +6859,7 @@ with pkgs; apacheAnt = callPackage ../development/tools/build-managers/apache-ant { }; - apacheKafka = apacheKafka_0_10; + apacheKafka = apacheKafka_1_0; apacheKafka_0_8 = callPackage ../servers/apache-kafka { majorVersion = "0.8"; }; apacheKafka_0_9 = callPackage ../servers/apache-kafka { majorVersion = "0.9"; }; apacheKafka_0_10 = callPackage ../servers/apache-kafka { majorVersion = "0.10"; }; From d27cf320cf23d45261b64326793e8e41bdba5971 Mon Sep 17 00:00:00 2001 From: Tim Steinbach Date: Thu, 2 Nov 2017 13:59:10 -0400 Subject: [PATCH 5/7] zookeeper: Add simple test --- nixos/release.nix | 2 +- nixos/tests/zookeeper.nix | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 nixos/tests/zookeeper.nix diff --git a/nixos/release.nix b/nixos/release.nix index d5f59a524e04..3ecf2ca42ced 100644 --- a/nixos/release.nix +++ b/nixos/release.nix @@ -329,7 +329,7 @@ in rec { tests.wordpress = callTest tests/wordpress.nix {}; tests.xfce = callTest tests/xfce.nix {}; tests.xmonad = callTest tests/xmonad.nix {}; - + tests.zookeeper = callTest tests/zookeeper.nix {}; /* Build a bunch of typical closures so that Hydra can keep track of the evolution of closure sizes. */ diff --git a/nixos/tests/zookeeper.nix b/nixos/tests/zookeeper.nix new file mode 100644 index 000000000000..d247654adade --- /dev/null +++ b/nixos/tests/zookeeper.nix @@ -0,0 +1,28 @@ +import ./make-test.nix ({ pkgs, ...} : { + name = "zookeeper"; + meta = with pkgs.stdenv.lib.maintainers; { + maintainers = [ nequissimus ]; + }; + + nodes = { + server = { pkgs, config, ... }: { + services.zookeeper = { + enable = true; + }; + + networking.firewall.allowedTCPPorts = [ 2181 ]; + }; + }; + + testScript = '' + startAll; + + $server->waitForUnit("zookeeper"); + $server->waitForUnit("network.target"); + $server->waitForOpenPort(2181); + + $server->waitUntilSucceeds("${pkgs.zookeeper}/bin/zkCli.sh -server localhost:2181 create /foo bar"); + $server->waitUntilSucceeds("${pkgs.zookeeper}/bin/zkCli.sh -server localhost:2181 set /foo hello"); + $server->waitUntilSucceeds("${pkgs.zookeeper}/bin/zkCli.sh -server localhost:2181 get /foo | grep hello"); + ''; +}) From beefaff2c19bdf1db24505cf2804487a3ba95b4c Mon Sep 17 00:00:00 2001 From: Tim Steinbach Date: Thu, 2 Nov 2017 15:10:33 -0400 Subject: [PATCH 6/7] kafka: Add tests --- nixos/release.nix | 4 ++++ nixos/tests/kafka_0_10.nix | 48 ++++++++++++++++++++++++++++++++++++++ nixos/tests/kafka_0_11.nix | 48 ++++++++++++++++++++++++++++++++++++++ nixos/tests/kafka_0_9.nix | 48 ++++++++++++++++++++++++++++++++++++++ nixos/tests/kafka_1_0.nix | 48 ++++++++++++++++++++++++++++++++++++++ 5 files changed, 196 insertions(+) create mode 100644 nixos/tests/kafka_0_10.nix create mode 100644 nixos/tests/kafka_0_11.nix create mode 100644 nixos/tests/kafka_0_9.nix create mode 100644 nixos/tests/kafka_1_0.nix diff --git a/nixos/release.nix b/nixos/release.nix index 3ecf2ca42ced..1e24093ce759 100644 --- a/nixos/release.nix +++ b/nixos/release.nix @@ -270,6 +270,10 @@ in rec { tests.plasma5 = callTest tests/plasma5.nix {}; tests.keymap = callSubTests tests/keymap.nix {}; tests.initrdNetwork = callTest tests/initrd-network.nix {}; + tests.kafka_0_9 = callTest tests/kafka_0_9.nix {}; + tests.kafka_0_10 = callTest tests/kafka_0_10.nix {}; + tests.kafka_0_11 = callTest tests/kafka_0_11.nix {}; + tests.kafka_1_0 = callTest tests/kafka_1_0.nix {}; tests.kernel-copperhead = callTest tests/kernel-copperhead.nix {}; tests.kernel-latest = callTest tests/kernel-latest.nix {}; tests.kernel-lts = callTest tests/kernel-lts.nix {}; diff --git a/nixos/tests/kafka_0_10.nix b/nixos/tests/kafka_0_10.nix new file mode 100644 index 000000000000..6e7820f64bc4 --- /dev/null +++ b/nixos/tests/kafka_0_10.nix @@ -0,0 +1,48 @@ +import ./make-test.nix ({ pkgs, lib, ... } : +let + kafkaPackage = pkgs.apacheKafka_0_10; +in { + name = "kafka_0_10"; + meta = with pkgs.stdenv.lib.maintainers; { + maintainers = [ nequissimus ]; + }; + + nodes = { + zookeeper1 = { config, ... }: { + services.zookeeper = { + enable = true; + }; + + networking.firewall.allowedTCPPorts = [ 2181 ]; + }; + kafka = { config, ... }: { + services.apache-kafka = { + enable = true; + extraProperties = '' + offsets.topic.replication.factor = 1 + ''; + package = kafkaPackage; + zookeeper = "zookeeper1:2181"; + }; + + networking.firewall.allowedTCPPorts = [ 9092 ]; + virtualisation.memorySize = 2048; + }; + }; + + testScript = '' + startAll; + + $zookeeper1->waitForUnit("zookeeper"); + $zookeeper1->waitForUnit("network.target"); + $zookeeper1->waitForOpenPort(2181); + + $kafka->waitForUnit("apache-kafka"); + $kafka->waitForUnit("network.target"); + $kafka->waitForOpenPort(9092); + + $kafka->waitUntilSucceeds("${kafkaPackage}/bin/kafka-topics.sh --create --zookeeper zookeeper1:2181 --partitions 1 --replication-factor 1 --topic testtopic"); + $kafka->mustSucceed("echo 'test 1' | ${kafkaPackage}/bin/kafka-console-producer.sh --broker-list localhost:9092 --topic testtopic"); + $kafka->mustSucceed("${kafkaPackage}/bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic testtopic --from-beginning --max-messages 1 | grep 'test 1'"); + ''; +}) diff --git a/nixos/tests/kafka_0_11.nix b/nixos/tests/kafka_0_11.nix new file mode 100644 index 000000000000..39f9c36bb229 --- /dev/null +++ b/nixos/tests/kafka_0_11.nix @@ -0,0 +1,48 @@ +import ./make-test.nix ({ pkgs, lib, ... } : +let + kafkaPackage = pkgs.apacheKafka_0_11; +in { + name = "kafka_0_11"; + meta = with pkgs.stdenv.lib.maintainers; { + maintainers = [ nequissimus ]; + }; + + nodes = { + zookeeper1 = { config, ... }: { + services.zookeeper = { + enable = true; + }; + + networking.firewall.allowedTCPPorts = [ 2181 ]; + }; + kafka = { config, ... }: { + services.apache-kafka = { + enable = true; + extraProperties = '' + offsets.topic.replication.factor = 1 + ''; + package = kafkaPackage; + zookeeper = "zookeeper1:2181"; + }; + + networking.firewall.allowedTCPPorts = [ 9092 ]; + virtualisation.memorySize = 2048; + }; + }; + + testScript = '' + startAll; + + $zookeeper1->waitForUnit("zookeeper"); + $zookeeper1->waitForUnit("network.target"); + $zookeeper1->waitForOpenPort(2181); + + $kafka->waitForUnit("apache-kafka"); + $kafka->waitForUnit("network.target"); + $kafka->waitForOpenPort(9092); + + $kafka->waitUntilSucceeds("${kafkaPackage}/bin/kafka-topics.sh --create --zookeeper zookeeper1:2181 --partitions 1 --replication-factor 1 --topic testtopic"); + $kafka->mustSucceed("echo 'test 1' | ${kafkaPackage}/bin/kafka-console-producer.sh --broker-list localhost:9092 --topic testtopic"); + $kafka->mustSucceed("${kafkaPackage}/bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic testtopic --from-beginning --max-messages 1 | grep 'test 1'"); + ''; +}) diff --git a/nixos/tests/kafka_0_9.nix b/nixos/tests/kafka_0_9.nix new file mode 100644 index 000000000000..fee82aba2bda --- /dev/null +++ b/nixos/tests/kafka_0_9.nix @@ -0,0 +1,48 @@ +import ./make-test.nix ({ pkgs, lib, ... } : +let + kafkaPackage = pkgs.apacheKafka_0_9; +in { + name = "kafka_0_9"; + meta = with pkgs.stdenv.lib.maintainers; { + maintainers = [ nequissimus ]; + }; + + nodes = { + zookeeper1 = { config, ... }: { + services.zookeeper = { + enable = true; + }; + + networking.firewall.allowedTCPPorts = [ 2181 ]; + }; + kafka = { config, ... }: { + services.apache-kafka = { + enable = true; + extraProperties = '' + offsets.topic.replication.factor = 1 + ''; + package = kafkaPackage; + zookeeper = "zookeeper1:2181"; + }; + + networking.firewall.allowedTCPPorts = [ 9092 ]; + virtualisation.memorySize = 2048; + }; + }; + + testScript = '' + startAll; + + $zookeeper1->waitForUnit("zookeeper"); + $zookeeper1->waitForUnit("network.target"); + $zookeeper1->waitForOpenPort(2181); + + $kafka->waitForUnit("apache-kafka"); + $kafka->waitForUnit("network.target"); + $kafka->waitForOpenPort(9092); + + $kafka->waitUntilSucceeds("${kafkaPackage}/bin/kafka-topics.sh --create --zookeeper zookeeper1:2181 --partitions 1 --replication-factor 1 --topic testtopic"); + $kafka->mustSucceed("echo 'test 1' | ${kafkaPackage}/bin/kafka-console-producer.sh --broker-list localhost:9092 --topic testtopic"); + $kafka->mustSucceed("${kafkaPackage}/bin/kafka-console-consumer.sh --zookeeper zookeeper1:2181 --topic testtopic --from-beginning --max-messages 1 | grep 'test 1'"); + ''; +}) diff --git a/nixos/tests/kafka_1_0.nix b/nixos/tests/kafka_1_0.nix new file mode 100644 index 000000000000..936840dbcfdc --- /dev/null +++ b/nixos/tests/kafka_1_0.nix @@ -0,0 +1,48 @@ +import ./make-test.nix ({ pkgs, lib, ... } : +let + kafkaPackage = pkgs.apacheKafka_1_0; +in { + name = "kafka_1_0"; + meta = with pkgs.stdenv.lib.maintainers; { + maintainers = [ nequissimus ]; + }; + + nodes = { + zookeeper1 = { config, ... }: { + services.zookeeper = { + enable = true; + }; + + networking.firewall.allowedTCPPorts = [ 2181 ]; + }; + kafka = { config, ... }: { + services.apache-kafka = { + enable = true; + extraProperties = '' + offsets.topic.replication.factor = 1 + ''; + package = kafkaPackage; + zookeeper = "zookeeper1:2181"; + }; + + networking.firewall.allowedTCPPorts = [ 9092 ]; + virtualisation.memorySize = 2048; + }; + }; + + testScript = '' + startAll; + + $zookeeper1->waitForUnit("zookeeper"); + $zookeeper1->waitForUnit("network.target"); + $zookeeper1->waitForOpenPort(2181); + + $kafka->waitForUnit("apache-kafka"); + $kafka->waitForUnit("network.target"); + $kafka->waitForOpenPort(9092); + + $kafka->waitUntilSucceeds("${kafkaPackage}/bin/kafka-topics.sh --create --zookeeper zookeeper1:2181 --partitions 1 --replication-factor 1 --topic testtopic"); + $kafka->mustSucceed("echo 'test 1' | ${kafkaPackage}/bin/kafka-console-producer.sh --broker-list localhost:9092 --topic testtopic"); + $kafka->mustSucceed("${kafkaPackage}/bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic testtopic --from-beginning --max-messages 1 | grep 'test 1'"); + ''; +}) From 30d4deccbdf4b1d9083f9db6a7fa953dda3b678d Mon Sep 17 00:00:00 2001 From: Tim Steinbach Date: Thu, 2 Nov 2017 15:12:19 -0400 Subject: [PATCH 7/7] kafka: Remove 0.8 --- pkgs/servers/apache-kafka/default.nix | 5 ----- pkgs/top-level/all-packages.nix | 1 - 2 files changed, 6 deletions(-) diff --git a/pkgs/servers/apache-kafka/default.nix b/pkgs/servers/apache-kafka/default.nix index 54784f6ff310..152e60455746 100644 --- a/pkgs/servers/apache-kafka/default.nix +++ b/pkgs/servers/apache-kafka/default.nix @@ -3,11 +3,6 @@ let versionMap = { - "0.8" = { - kafkaVersion = "0.8.2.2"; - scalaVersion = "2.10"; - sha256 = "1azccf1k0nr8y1sfpjgqf9swyp87ypvgva68ci4kczwcx1z9d89v"; - }; "0.9" = { kafkaVersion = "0.9.0.1"; scalaVersion = "2.11"; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index fd96ade2f30c..085792f5394a 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6860,7 +6860,6 @@ with pkgs; apacheAnt = callPackage ../development/tools/build-managers/apache-ant { }; apacheKafka = apacheKafka_1_0; - apacheKafka_0_8 = callPackage ../servers/apache-kafka { majorVersion = "0.8"; }; apacheKafka_0_9 = callPackage ../servers/apache-kafka { majorVersion = "0.9"; }; apacheKafka_0_10 = callPackage ../servers/apache-kafka { majorVersion = "0.10"; }; apacheKafka_0_11 = callPackage ../servers/apache-kafka { majorVersion = "0.11"; };