[Update flake.lock; fix bugs] Test process overwrites other processes (#52)

This commit is contained in:
Shivaraj B H 2023-09-06 19:54:51 +05:30 committed by GitHub
parent 5fdd56f090
commit 2c1bbc1258
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 24 additions and 19 deletions

View File

@ -20,11 +20,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1687274257,
"narHash": "sha256-TutzPriQcZ8FghDhEolnHcYU2oHIG5XWF+/SUBNnAOE=",
"lastModified": 1693844670,
"narHash": "sha256-t69F2nBB8DNQUWHD809oJZJVE+23XBrth4QZuVd6IE0=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "2c9ecd1f0400076a4d6b2193ad468ff0a7e7fdc5",
"rev": "3c15feef7770eb5500a4b8792623e2d6f598c9c1",
"type": "github"
},
"original": {
@ -70,11 +70,11 @@
},
"process-compose-flake": {
"locked": {
"lastModified": 1692810585,
"narHash": "sha256-Zc8nDSVkTUskB5mp9fh1mmOIUvx2pJ5V/Uq/0kxQ6B0=",
"lastModified": 1693927910,
"narHash": "sha256-qPKHnWWzHS2bAi/SsFePQkGFeC2E1jklUjEidfQwYLc=",
"owner": "Platonic-Systems",
"repo": "process-compose-flake",
"rev": "2a84a6c2c91c6244e5db8fd46551d5e7f31a85d3",
"rev": "5494afa0b6a7bc4ccf82ef1c36fe1fcdb4217255",
"type": "github"
},
"original": {
@ -95,11 +95,11 @@
},
"services-flake": {
"locked": {
"lastModified": 1689713819,
"narHash": "sha256-ZjDQNRGpbxYSEYoqKmCdIOx+fV2q5lyiYWznHQ0fMkk=",
"lastModified": 1693467006,
"narHash": "sha256-negT+528qZyomG5ZotqNx7l0IA7vbJ2fGAM6F5ortAY=",
"owner": "juspay",
"repo": "services-flake",
"rev": "321ef32a28ed0e59160cf130c3a7c55e3b979e85",
"rev": "5fdd56f0900f05ef5bf1b8a348fabbd280f0c60b",
"type": "github"
},
"original": {

View File

@ -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
'';

View File

@ -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"

View File

@ -343,7 +343,8 @@ 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
@ -351,6 +352,7 @@ in
if [[ ! -d "$PGDATA" ]]; then
set -x
mkdir -p ${config.dataDir}
initdb ${lib.concatStringsSep " " initdbArgs}
set +x

View File

@ -112,6 +112,7 @@ with lib;
${config.extraConf}
${config.servers}
admin.enableServer=false
4lw.commands.whitelist=stat
'';
configDir = pkgs.buildEnv {
@ -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;

View File

@ -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";
};

View File

@ -54,11 +54,11 @@
},
"process-compose-flake": {
"locked": {
"lastModified": 1692810585,
"narHash": "sha256-Zc8nDSVkTUskB5mp9fh1mmOIUvx2pJ5V/Uq/0kxQ6B0=",
"lastModified": 1693927910,
"narHash": "sha256-qPKHnWWzHS2bAi/SsFePQkGFeC2E1jklUjEidfQwYLc=",
"owner": "Platonic-Systems",
"repo": "process-compose-flake",
"rev": "2a84a6c2c91c6244e5db8fd46551d5e7f31a85d3",
"rev": "5494afa0b6a7bc4ccf82ef1c36fe1fcdb4217255",
"type": "github"
},
"original": {