kafka: Add tests

+196
+4
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 {};
+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 + })