Skip to content

Commit

Permalink
[Update flake.lock; fix bugs] Test process overwrites other process…
Browse files Browse the repository at this point in the history
…es (#52)
  • Loading branch information
shivaraj-bh authored Sep 6, 2023
1 parent 5fdd56f commit 2c1bbc1
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 19 deletions.
18 changes: 9 additions & 9 deletions example/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion nix/apache-kafka_test.nix
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{ pkgs, config, ... }: {
services.zookeeper."z1".enable = true;
# To avoid conflicting with `zookeeper_test.nix` in case the tests are run in parallel
services.zookeeper."z1".port = 2182;
services.apache-kafka."k1".enable = true;
services.apache-kafka."k1".zookeeper = "localhost:2182";
settings.processes.test =
{
command = pkgs.writeShellApplication {
runtimeInputs = [ pkgs.bash config.package ];
runtimeInputs = [ pkgs.bash config.services.apache-kafka.k1.package ];
text = ''
bash kafka-topics.sh --list --bootstrap-server localhost:9092
'';
Expand Down
2 changes: 1 addition & 1 deletion nix/elasticsearch.nix
Original file line number Diff line number Diff line change
Expand Up @@ -144,10 +144,10 @@ in
startScript = pkgs.writeShellScript "es-startup" ''
set -e
mkdir -m 0700 -p "${config.dataDir}"
export ES_HOME=$(${pkgs.coreutils}/bin/realpath ${config.dataDir})
export ES_JAVA_OPTS="${toString config.extraJavaOptions}"
export ES_PATH_CONF="${config.dataDir}/config"
mkdir -m 0700 -p "${config.dataDir}"
# Install plugins
rm -f "${config.dataDir}/plugins"
ln -sf ${esPlugins}/plugins "${config.dataDir}/plugins"
Expand Down
4 changes: 3 additions & 1 deletion nix/postgres.nix
Original file line number Diff line number Diff line change
Expand Up @@ -343,14 +343,16 @@ in

initdbArgs =
config.initdbArgs
++ (lib.optionals (config.superuser != null) [ "-U" config.superuser ]);
++ (lib.optionals (config.superuser != null) [ "-U" config.superuser ])
++ ["-D" config.dataDir ];

setupScript = pkgs.writeShellScriptBin "setup-postgres" ''
set -euo pipefail
export PATH=${postgresPkg}/bin:${pkgs.coreutils}/bin
if [[ ! -d "$PGDATA" ]]; then
set -x
mkdir -p ${config.dataDir}
initdb ${lib.concatStringsSep " " initdbArgs}
set +x
Expand Down
4 changes: 2 additions & 2 deletions nix/zookeeper.nix
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ with lib;
${config.extraConf}
${config.servers}
admin.enableServer=false
4lw.commands.whitelist=stat
'';

configDir = pkgs.buildEnv {
Expand All @@ -136,8 +137,7 @@ with lib;
command = "${startScript}/bin/start-zookeeper";

readiness_probe = {
# TODO: need to find a better way to check if zookeeper is ready, maybe `zkCli.sh`?
exec.command = "${pkgs.netcat.nc}/bin/nc -z localhost ${toString config.port}";
exec.command = "echo stat | ${pkgs.netcat.nc}/bin/nc localhost ${toString config.port}";
initial_delay_seconds = 2;
period_seconds = 10;
timeout_seconds = 4;
Expand Down
4 changes: 2 additions & 2 deletions nix/zookeeper_test.nix
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
settings.processes.test =
{
command = pkgs.writeShellApplication {
runtimeInputs = [ pkgs.bash config.package ];
runtimeInputs = [ config.services.zookeeper.z1.package pkgs.netcat.nc ];
text = ''
bash zkCli.sh -server localhost:2181 get /
echo stat | nc localhost 2181
'';
name = "zookeeper-test";
};
Expand Down
6 changes: 3 additions & 3 deletions test/flake.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 2c1bbc1

Please sign in to comment.