1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-24 06:31:02 +00:00
nixpkgs/nixos/tests/redis.nix

45 lines
1 KiB
Nix
Raw Normal View History

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