1 { system ? builtins.currentSystem,
3 pkgs ? import ../.. { inherit system config; }
9 makeKafkaTest = name: kafkaPackage: (import ./make-test-python.nix ({
11 meta = with pkgs.lib.maintainers; {
12 maintainers = [ nequissimus ];
16 zookeeper1 = { ... }: {
17 services.zookeeper = {
21 networking.firewall.allowedTCPPorts = [ 2181 ];
24 services.apache-kafka = {
27 offsets.topic.replication.factor = 1
28 zookeeper.session.timeout.ms = 600000
30 package = kafkaPackage;
31 zookeeper = "zookeeper1:2181";
34 networking.firewall.allowedTCPPorts = [ 9092 ];
35 # i686 tests: qemu-system-i386 can simulate max 2047MB RAM (not 2048)
36 virtualisation.memorySize = 2047;
43 zookeeper1.wait_for_unit("default.target")
44 zookeeper1.wait_for_unit("zookeeper.service")
45 zookeeper1.wait_for_open_port(2181)
47 kafka.wait_for_unit("default.target")
48 kafka.wait_for_unit("apache-kafka.service")
49 kafka.wait_for_open_port(9092)
51 kafka.wait_until_succeeds(
52 "${kafkaPackage}/bin/kafka-topics.sh --create "
53 + "--bootstrap-server localhost:9092 --partitions 1 "
54 + "--replication-factor 1 --topic testtopic"
58 + "${kafkaPackage}/bin/kafka-console-producer.sh "
59 + "--broker-list localhost:9092 --topic testtopic"
61 assert "test 1" in kafka.succeed(
62 "${kafkaPackage}/bin/kafka-console-consumer.sh "
63 + "--bootstrap-server localhost:9092 --topic testtopic "
64 + "--from-beginning --max-messages 1"
67 }) { inherit system; });
70 kafka_2_8 = makeKafkaTest "kafka_2_8" apacheKafka_2_8;
71 kafka_3_0 = makeKafkaTest "kafka_3_0" apacheKafka_3_0;
72 kafka_3_1 = makeKafkaTest "kafka_3_1" apacheKafka_3_1;
73 kafka_3_2 = makeKafkaTest "kafka_3_2" apacheKafka_3_2;
74 kafka_3_3 = makeKafkaTest "kafka_3_3" apacheKafka_3_3;
75 kafka = makeKafkaTest "kafka" apacheKafka;