2021-01-15 22:18:51 +00:00
|
|
|
import ./make-test-python.nix ({ pkgs, ... }:
|
|
|
|
let
|
|
|
|
redisSocket = "/run/redis/redis.sock";
|
|
|
|
in
|
|
|
|
{
|
2020-04-24 23:36:52 +00:00
|
|
|
name = "redis";
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with pkgs.lib.maintainers; {
|
2020-04-24 23:36:52 +00:00
|
|
|
maintainers = [ flokli ];
|
|
|
|
};
|
|
|
|
|
|
|
|
nodes = {
|
|
|
|
machine =
|
|
|
|
{ pkgs, ... }:
|
|
|
|
|
|
|
|
{
|
|
|
|
services.redis.enable = true;
|
2021-01-15 22:18:51 +00:00
|
|
|
services.redis.unixSocket = redisSocket;
|
|
|
|
|
|
|
|
# Allow access to the unix socket for the "redis" group.
|
2021-04-12 18:23:04 +00:00
|
|
|
services.redis.unixSocketPerm = 770;
|
2021-01-15 22:18:51 +00:00
|
|
|
|
|
|
|
users.users."member" = {
|
|
|
|
createHome = false;
|
|
|
|
description = "A member of the redis group";
|
2021-04-15 00:37:46 +00:00
|
|
|
isNormalUser = true;
|
2021-01-15 22:18:51 +00:00
|
|
|
extraGroups = [
|
|
|
|
"redis"
|
|
|
|
];
|
|
|
|
};
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
testScript = ''
|
|
|
|
start_all()
|
|
|
|
machine.wait_for_unit("redis")
|
|
|
|
machine.wait_for_open_port("6379")
|
2021-01-15 22:18:51 +00:00
|
|
|
|
|
|
|
# The unix socket is accessible to the redis group
|
|
|
|
machine.succeed('su member -c "redis-cli ping | grep PONG"')
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
machine.succeed("redis-cli ping | grep PONG")
|
2021-01-15 22:18:51 +00:00
|
|
|
machine.succeed("redis-cli -s ${redisSocket} ping | grep PONG")
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
})
|