-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add just test; support native test for rest of the services
- Loading branch information
1 parent
a95805a
commit 32a12fe
Showing
5 changed files
with
60 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,23 @@ | ||
{ config, ... }: { | ||
{ pkgs, config, ... }: { | ||
services.redis-cluster."c1".enable = true; | ||
testScript = '' | ||
process_compose.wait_until(lambda procs: | ||
# TODO: Check for 'is_ready' of `c1-cluster-create` instead of `c1-n1` (status of `c1-cluster-create` determines whether the hashslots are assigned). | ||
# This should be easy after https://github.com/juspay/services-flake/issues/32 | ||
procs["c1-n1"]["status"] == "Running" | ||
) | ||
machine.succeed("${config.services.redis-cluster.c1.package}/bin/redis-cli -p 30001 ping | grep -q 'PONG'") | ||
machine.succeed("${config.services.redis-cluster.c1.package}/bin/redis-cli -p 30002 ping | grep -q 'PONG'") | ||
machine.succeed("${config.services.redis-cluster.c1.package}/bin/redis-cli -p 30003 ping | grep -q 'PONG'") | ||
machine.succeed("${config.services.redis-cluster.c1.package}/bin/redis-cli -p 30004 ping | grep -q 'PONG'") | ||
machine.succeed("${config.services.redis-cluster.c1.package}/bin/redis-cli -p 30005 ping | grep -q 'PONG'") | ||
machine.succeed("${config.services.redis-cluster.c1.package}/bin/redis-cli -p 30006 ping | grep -q 'PONG'") | ||
''; | ||
|
||
settings.processes.test = | ||
let | ||
cfg = config.services.redis-cluster."c1"; | ||
in | ||
{ | ||
command = pkgs.writeShellApplication { | ||
text = '' | ||
${cfg.package}/bin/redis-cli -p 30001 ping | ${pkgs.gnugrep}/bin/grep -q "PONG" | ||
${cfg.package}/bin/redis-cli -p 30002 ping | ${pkgs.gnugrep}/bin/grep -q "PONG" | ||
${cfg.package}/bin/redis-cli -p 30003 ping | ${pkgs.gnugrep}/bin/grep -q "PONG" | ||
${cfg.package}/bin/redis-cli -p 30004 ping | ${pkgs.gnugrep}/bin/grep -q "PONG" | ||
${cfg.package}/bin/redis-cli -p 30005 ping | ${pkgs.gnugrep}/bin/grep -q "PONG" | ||
${cfg.package}/bin/redis-cli -p 30006 ping | ${pkgs.gnugrep}/bin/grep -q "PONG" | ||
''; | ||
name = "redis-cluster-test"; | ||
}; | ||
depends_on."c1-cluster-create".condition = "process_completed"; | ||
}; | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,17 @@ | ||
{ config, ... }: { | ||
{ pkgs, config, ... }: { | ||
services.redis."redis1".enable = true; | ||
services.redis."redis2" = { | ||
enable = true; | ||
port = 6380; | ||
}; | ||
testScript = '' | ||
process_compose.wait_until(lambda procs: | ||
# TODO: Check for 'is_ready' instead of 'status' | ||
procs["redis1"]["status"] == "Running" | ||
) | ||
process_compose.wait_until(lambda procs: | ||
procs["redis2"]["status"] == "Running" | ||
) | ||
machine.succeed("${config.services.redis.redis1.package}/bin/redis-cli ping | grep -q 'PONG'") | ||
machine.succeed("${config.services.redis.redis2.package}/bin/redis-cli -p 6380 ping | grep -q 'PONG'") | ||
''; | ||
|
||
settings.processes.test = | ||
let | ||
cfg = config.services.redis."redis1"; | ||
in | ||
{ | ||
command = pkgs.writeShellApplication { | ||
text = '' | ||
${cfg.package}/bin/redis-cli ping | ${pkgs.gnugrep}/bin/grep -q "PONG" | ||
''; | ||
name = "postgres-test"; | ||
}; | ||
depends_on."redis1".condition = "process_healthy"; | ||
}; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.