1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-20 12:42:24 +00:00
nixpkgs/nixos/tests/memcached.nix
Andreas Rammhold 1305752ba0
nixos/memcached: added simple set/get test
The test ensures that the services comes up and accepts/provides values.
2018-06-09 02:11:15 +02:00

29 lines
680 B
Nix

import ./make-test.nix ({ pkgs, ...} : {
name = "memcached";
nodes = {
machine =
{ config, pkgs, ... }:
{
imports = [ ../modules/profiles/minimal.nix ];
services.memcached.enable = true;
};
};
testScript = let
testScript = pkgs.writeScript "testScript.py" ''
#!${pkgs.python3.withPackages (p: [p.memcached])}/bin/python
import memcache
c = memcache.Client(['localhost:11211'])
c.set('key', 'value')
assert 'value' == c.get('key')
'';
in ''
startAll;
$machine->waitForUnit("memcached.service");
$machine->waitForOpenPort("11211");
$machine->succeed("${testScript}");
'';
})