-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Process as test (VM -> Native test) (#38)
Co-authored-by: Sridhar Ratnakumar <[email protected]>
- Loading branch information
1 parent
3a8dcaf
commit 72a3eaa
Showing
9 changed files
with
101 additions
and
74 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: "CI" | ||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
jobs: | ||
checks: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Install Nix | ||
uses: DeterminateSystems/nix-installer-action@main | ||
- uses: yaxitech/nix-install-pkgs-action@v3 | ||
with: | ||
packages: "nixpkgs#nixci" | ||
- run: nixci |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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,24 @@ | ||
{ 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 { | ||
runtimeInputs = [ cfg.package pkgs.gnugrep ]; | ||
text = '' | ||
redis-cli -p 30001 ping | grep -q "PONG" | ||
redis-cli -p 30002 ping | grep -q "PONG" | ||
redis-cli -p 30003 ping | grep -q "PONG" | ||
redis-cli -p 30004 ping | grep -q "PONG" | ||
redis-cli -p 30005 ping | grep -q "PONG" | ||
redis-cli -p 30006 ping | 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,18 @@ | ||
{ 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 { | ||
runtimeInputs = [ cfg.package pkgs.gnugrep ]; | ||
text = '' | ||
redis-cli ping | grep -q "PONG" | ||
''; | ||
name = "redis-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.
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