diff options
| author | Anthony Oleinik <[email protected]> | 2024-03-14 01:59:47 -0700 |
|---|---|---|
| committer | GitHub <[email protected]> | 2024-03-14 04:59:47 -0400 |
| commit | 528943263040c9f383361b1a37a3ee4db66412af (patch) | |
| tree | ff93492146018fa1df1f2cf5f7f19ce324b055ad /test/flake.nix | |
| parent | b7813d224e7630de289d587c90e444c76f3330a0 (diff) | |
Add support for other procfile runners (#5)
* WIP
* WIP
* WIP
* done
* done
* fix CI
* fix CI
* refactor: default to overmind in mkProcfileRunner
* module: cleanup option docs
* refactor: cleanup multi-test suite
---------
Co-authored-by: seth <[email protected]>
Diffstat (limited to 'test/flake.nix')
| -rw-r--r-- | test/flake.nix | 89 |
1 files changed, 66 insertions, 23 deletions
diff --git a/test/flake.nix b/test/flake.nix index 724fc9c..c465c0e 100644 --- a/test/flake.nix +++ b/test/flake.nix @@ -26,35 +26,78 @@ lib, pkgs, ... - }: { - procfiles.daemons.processes = { - redis = lib.getExe' pkgs.redis "redis-server"; - }; + }: let + mkTestShell = runtimeInputs: text: + pkgs.mkShellNoCC { + packages = [ + (pkgs.writeShellApplication { + name = "run-ci"; + + inherit runtimeInputs text; + }) + ]; + }; - devShells.default = pkgs.mkShellNoCC { - packages = [ - (pkgs.writeShellApplication { - name = "run-ci"; + testScript = exe: check: kill: '' + set -x - runtimeInputs = [pkgs.overmind]; + ${exe} + sleep 5 # avoid race conditions - text = '' - set -x + if ${check}; then + echo "Processes failed to launch! Exiting with error" + ${kill} + exit 1 + fi - exec ${lib.getExe config.procfiles.daemons.package} & - sleep 5 # avoid race conditions + ${kill} + echo "Process finished! Exiting as success" + ''; + + processes = { + redis = lib.getExe' pkgs.redis "redis-server"; + }; + in { + procfiles = { + # overmind as default + overmind-dft = {inherit processes;}; + + # explicit overmind + overmind = { + inherit processes; + procRunner = pkgs.overmind; + }; + + # honcho + honcho = { + inherit processes; + procRunner = pkgs.honcho; + }; + }; - if ! overmind status | grep running; then - echo "Processes failed to launch! Exiting with error" - overmind kill - exit 1 - fi + devShells = { + overmind-dft = mkTestShell [pkgs.overmind] ( + testScript + "exec ${(lib.getExe config.procfiles.overmind-dft.package)} &" + "! overmind status | grep running" + "overmind kill" + ); - overmind kill - echo "Process finished! Exiting as success" - ''; - }) - ]; + overmind = mkTestShell [pkgs.overmind] ( + testScript + "exec ${(lib.getExe config.procfiles.overmind.package)} &" + "! overmind status | grep running" + "overmind kill" + ); + honcho = mkTestShell [pkgs.honcho] ( + testScript + '' + exec ${(lib.getExe config.procfiles.honcho.package)} & \ + PROC_PID=$! + '' + "! ps -p \"$PROC_PID\" > /dev/null" + "kill -2 $PROC_PID; pkill -f \"redis\"" + ); }; }; }; |
