nixpkgs-suyu/nixos/tests/memcached.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

25 lines
636 B
Nix
Raw Permalink Normal View History

2019-11-27 08:56:35 +01:00
import ./make-test-python.nix ({ pkgs, ... }: {
name = "memcached";
2022-03-21 00:15:30 +01:00
nodes.machine = {
2019-11-27 08:56:35 +01:00
imports = [ ../modules/profiles/minimal.nix ];
services.memcached.enable = true;
};
testScript = let
2019-11-27 08:56:35 +01:00
testScript = pkgs.writers.writePython3 "test_memcache" {
libraries = with pkgs.python3Packages; [ memcached ];
} ''
import memcache
c = memcache.Client(['localhost:11211'])
c.set('key', 'value')
assert 'value' == c.get('key')
'';
in ''
2019-11-27 08:56:35 +01:00
machine.start()
machine.wait_for_unit("memcached.service")
machine.wait_for_open_port(11211)
machine.succeed("${testScript}")
'';
})