From fe814c5e91620528c834a9c9eb8cbd99d364fec6 Mon Sep 17 00:00:00 2001 From: Andrew Seward Date: Mon, 2 Nov 2020 19:26:39 -0800 Subject: [PATCH] Add some test coverage for redis service --- release.nix | 1 + tests/services-redis.nix | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+) create mode 100644 tests/services-redis.nix diff --git a/release.nix b/release.nix index 750510dc..2747eb64 100644 --- a/release.nix +++ b/release.nix @@ -121,6 +121,7 @@ let tests.services-ofborg = makeTest ./tests/services-ofborg.nix; tests.services-offlineimap = makeTest ./tests/services-offlineimap.nix; tests.services-privoxy = makeTest ./tests/services-privoxy.nix; + tests.services-redis = makeTest ./tests/services-redis.nix; tests.services-skhd = makeTest ./tests/services-skhd.nix; tests.services-spacebar = makeTest ./tests/services-spacebar.nix; tests.services-synapse-bt = makeTest ./tests/services-synapse-bt.nix; diff --git a/tests/services-redis.nix b/tests/services-redis.nix new file mode 100644 index 00000000..a46916b7 --- /dev/null +++ b/tests/services-redis.nix @@ -0,0 +1,26 @@ +{ config, lib, pkgs, ... }: + +with lib; + +let + redis = pkgs.runCommand "redis-0.0.0" {} "mkdir $out"; +in + +{ + services.redis.enable = true; + services.redis.package = redis; + services.redis.extraConfig = '' + maxmemory-policy allkeys-lru + stop-writes-on-bgsave-error no + ''; + + test = '' + echo >&2 "checking redis service in ~/Library/LaunchAgents" + grep "org.nixos.redis" ${config.out}/user/Library/LaunchAgents/org.nixos.redis.plist + grep "${redis}/bin/redis-server /etc/redis.conf" ${config.out}/user/Library/LaunchAgents/org.nixos.redis.plist + + echo >&2 "checking config in /etc/redis.conf" + grep "maxmemory-policy allkeys-lru" ${config.out}/etc/redis.conf + grep "stop-writes-on-bgsave-error no" ${config.out}/etc/redis.conf + ''; +}