1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-19 04:02:10 +00:00
nixpkgs/nixos/tests/redis.nix
2021-04-03 19:07:27 +03:00

46 lines
1 KiB
Nix

import ./make-test-python.nix ({ pkgs, ... }:
let
redisSocket = "/run/redis/redis.sock";
in
{
name = "redis";
meta = with pkgs.lib.maintainers; {
maintainers = [ flokli ];
};
nodes = {
machine =
{ pkgs, ... }:
{
services.redis.enable = true;
services.redis.unixSocket = redisSocket;
# Allow access to the unix socket for the "redis" group.
services.redis.unixSocketPerm = 770;
users.users."member" = {
createHome = false;
description = "A member of the redis group";
extraGroups = [
"redis"
];
group = "users";
shell = "/bin/sh";
};
};
};
testScript = ''
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"')
machine.succeed("redis-cli ping | grep PONG")
machine.succeed("redis-cli -s ${redisSocket} ping | grep PONG")
'';
})