blob: 9b7ac111a57b5a8a88ce3d45c49fb000c83d54a1 (
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
import ./make-test.nix ({ pkgs, lib, ... }:
let
produce = pkgs.writeScript "produce.py" ''
#!${pkgs.python2.withPackages (p: [p.beanstalkc])}/bin/python
import beanstalkc
queue = beanstalkc.Connection(host='localhost', port=11300, parse_yaml=False);
queue.put('this is a job')
queue.put('this is another job')
'';
consume = pkgs.writeScript "consume.py" ''
#!${pkgs.python2.withPackages (p: [p.beanstalkc])}/bin/python
import beanstalkc
queue = beanstalkc.Connection(host='localhost', port=11300, parse_yaml=False);
job = queue.reserve(timeout=0)
print job.body
job.delete()
'';
in
{
name = "beanstalkd";
meta.maintainers = [ lib.maintainers.aanderse ];
machine =
{ ... }:
{ services.beanstalkd.enable = true;
};
testScript = ''
startAll;
$machine->waitForUnit('beanstalkd.service');
$machine->succeed("${produce}");
$machine->succeed("${consume}") eq "this is a job\n" or die;
$machine->succeed("${consume}") eq "this is another job\n" or die;
'';
})
|