2021-01-03 21:20:02 +03:00
|
|
|
import ./make-test-python.nix ({ pkgs, ... }:
|
|
|
|
let
|
|
|
|
redisSocket = "/run/redis/redis.sock";
|
|
|
|
in
|
|
|
|
{
|
2019-08-31 21:17:33 +03:00
|
|
|
name = "redis";
|
2021-01-10 22:08:30 +03:00
|
|
|
meta = with pkgs.lib.maintainers; {
|
2019-08-31 21:17:33 +03:00
|
|
|
maintainers = [ flokli ];
|
|
|
|
};
|
|
|
|
|
|
|
|
nodes = {
|
|
|
|
machine =
|
|
|
|
{ pkgs, ... }:
|
|
|
|
|
|
|
|
{
|
|
|
|
services.redis.enable = true;
|
2021-01-03 21:20:02 +03:00
|
|
|
services.redis.unixSocket = redisSocket;
|
|
|
|
|
|
|
|
# Allow access to the unix socket for the "redis" group.
|
|
|
|
services.redis.settings.unixsocketperm = "770";
|
|
|
|
|
|
|
|
users.users."member" = {
|
|
|
|
createHome = false;
|
|
|
|
description = "A member of the redis group";
|
|
|
|
extraGroups = [
|
|
|
|
"redis"
|
|
|
|
];
|
|
|
|
group = "users";
|
|
|
|
shell = "/bin/sh";
|
|
|
|
};
|
2019-08-31 21:17:33 +03:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
2019-11-06 17:57:56 +03:00
|
|
|
start_all()
|
|
|
|
machine.wait_for_unit("redis")
|
|
|
|
machine.wait_for_open_port("6379")
|
2021-01-03 21:20:02 +03:00
|
|
|
|
|
|
|
# The unix socket is accessible to the redis group
|
|
|
|
machine.succeed('su member -c "redis-cli ping | grep PONG"')
|
|
|
|
|
2019-11-06 17:57:56 +03:00
|
|
|
machine.succeed("redis-cli ping | grep PONG")
|
2021-01-03 21:20:02 +03:00
|
|
|
machine.succeed("redis-cli -s ${redisSocket} ping | grep PONG")
|
2019-08-31 21:17:33 +03:00
|
|
|
'';
|
|
|
|
})
|