about summary refs log tree commit diff
path: root/nixos/tests/txredisapi.nix
blob: 47c2ba6d3749adde2abbe1380cf796e195851cee (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
25
26
27
28
29
import ./make-test-python.nix ({ pkgs, ... }:
{
  name = "txredisapi";
  meta = with pkgs.lib.maintainers; {
    maintainers = [ dandellion ];
  };

  nodes = {
    machine =
      { pkgs, ... }:

      {
        services.redis.servers."".enable = true;

        environment.systemPackages = with pkgs; [ (python3.withPackages (ps: [ ps.twisted ps.txredisapi ps.mock ]))];
      };
  };

  testScript = { nodes, ... }: let
    inherit (nodes.machine.config.services) redis;
    in ''
    start_all()
    machine.wait_for_unit("redis")
    machine.wait_for_file("${redis.servers."".unixSocket}")
    machine.succeed("ln -s ${redis.servers."".unixSocket} /tmp/redis.sock")

    tests = machine.succeed("PYTHONPATH=\"${pkgs.python3Packages.txredisapi.src}\" python -m twisted.trial ${pkgs.python3Packages.txredisapi.src}/tests")
  '';
})