Skip to content
This repository was archived by the owner on Apr 12, 2021. It is now read-only.
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: NixOS/nixpkgs-channels
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: e11b29507ba1
Choose a base ref
...
head repository: NixOS/nixpkgs-channels
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: d92331c7fd49
Choose a head ref
  • 1 commit
  • 6 files changed
  • 1 contributor

Commits on May 15, 2018

  1. nixos/tests/kafka: fix and refactor tests

    - refactor into single file for all versions
    - improve timing, prevent non-deterministic failures
    - fix tests for i686-linux
    
    (cherry picked from commit 13f83ba)
    xeji committed May 15, 2018

    Verified

    This commit was signed with the committer’s verified signature.
    vcunat Vladimír Čunát
    Copy the full SHA
    d92331c View commit details
Showing with 69 additions and 196 deletions.
  1. +1 −4 nixos/release.nix
  2. +68 −0 nixos/tests/kafka.nix
  3. +0 −48 nixos/tests/kafka_0_10.nix
  4. +0 −48 nixos/tests/kafka_0_11.nix
  5. +0 −48 nixos/tests/kafka_0_9.nix
  6. +0 −48 nixos/tests/kafka_1_0.nix
5 changes: 1 addition & 4 deletions nixos/release.nix
Original file line number Diff line number Diff line change
@@ -304,10 +304,7 @@ in rec {
tests.plotinus = callTest tests/plotinus.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.kafka = callSubTests tests/kafka.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 {};
68 changes: 68 additions & 0 deletions nixos/tests/kafka.nix
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
{ system ? builtins.currentSystem }:
with import ../lib/testing.nix { inherit system; };
with pkgs.lib;

let
makeKafkaTest = name: kafkaPackage: (makeTest {
inherit name;
meta = with pkgs.stdenv.lib.maintainers; {
maintainers = [ nequissimus ];
};

nodes = {
zookeeper1 = { config, ... }: {
services.zookeeper = {
enable = true;
};

networking.firewall.allowedTCPPorts = [ 2181 ];
virtualisation.memorySize = 1024;
};
kafka = { config, ... }: {
services.apache-kafka = {
enable = true;
extraProperties = ''
offsets.topic.replication.factor = 1
zookeeper.session.timeout.ms = 600000
'';
package = kafkaPackage;
zookeeper = "zookeeper1:2181";
# These are the default options, but UseCompressedOops doesn't work with 32bit JVM
jvmOptions = [
"-server" "-Xmx1G" "-Xms1G" "-XX:+UseParNewGC" "-XX:+UseConcMarkSweepGC" "-XX:+CMSClassUnloadingEnabled"
"-XX:+CMSScavengeBeforeRemark" "-XX:+DisableExplicitGC" "-Djava.awt.headless=true" "-Djava.net.preferIPv4Stack=true"
] ++ optionals (! pkgs.stdenv.isi686 ) [ "-XX:+UseCompressedOops" ];
};

networking.firewall.allowedTCPPorts = [ 9092 ];
# i686 tests: qemu-system-i386 can simulate max 2047MB RAM (not 2048)
virtualisation.memorySize = 2047;
};
};

testScript = ''
startAll;
$zookeeper1->waitForUnit("default.target");
$zookeeper1->waitForUnit("zookeeper.service");
$zookeeper1->waitForOpenPort(2181);
$kafka->waitForUnit("default.target");
$kafka->waitForUnit("apache-kafka.service");
$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");
'' + (if name == "kafka_0_9" then ''
$kafka->mustSucceed("${kafkaPackage}/bin/kafka-console-consumer.sh --zookeeper zookeeper1:2181 --topic testtopic --from-beginning --max-messages 1 | grep 'test 1'");
'' else ''
$kafka->mustSucceed("${kafkaPackage}/bin/kafka-console-consumer.sh --bootstrap-server localhost:9092 --topic testtopic --from-beginning --max-messages 1 | grep 'test 1'");
'');
});

in with pkgs; {
kafka_0_9 = makeKafkaTest "kafka_0_9" apacheKafka_0_9;
kafka_0_10 = makeKafkaTest "kafka_0_10" apacheKafka_0_10;
kafka_0_11 = makeKafkaTest "kafka_0_11" apacheKafka_0_11;
kafka_1_0 = makeKafkaTest "kafka_1_0" apacheKafka_1_0;
}
48 changes: 0 additions & 48 deletions nixos/tests/kafka_0_10.nix

This file was deleted.

48 changes: 0 additions & 48 deletions nixos/tests/kafka_0_11.nix

This file was deleted.

48 changes: 0 additions & 48 deletions nixos/tests/kafka_0_9.nix

This file was deleted.

48 changes: 0 additions & 48 deletions nixos/tests/kafka_1_0.nix

This file was deleted.