about summary refs log tree commit diff
path: root/nixos/tests/memcached.nix
blob: 6549995110d790ae8b862490564958039b7da64e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import ./make-test-python.nix ({ pkgs, ... }: {
  name = "memcached";

  nodes.machine = {
    imports = [ ../modules/profiles/minimal.nix ];
    services.memcached.enable = true;
  };

  testScript = let
    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 ''
    machine.start()
    machine.wait_for_unit("memcached.service")
    machine.wait_for_open_port(11211)
    machine.succeed("${testScript}")
  '';
})