@@ -0,0 +1,43 @@
1+import ./make-test.nix ({ pkgs, lib, ... }:
2+
3+let
4+ produce = pkgs.writeScript "produce.py" ''
5+ #!${pkgs.python2.withPackages (p: [p.beanstalkc])}/bin/python
6+ import beanstalkc
7+
8+ queue = beanstalkc.Connection(host='localhost', port=11300, parse_yaml=False);
9+ queue.put('this is a job')
10+ queue.put('this is another job')
11+ '';
12+
13+ consume = pkgs.writeScript "consume.py" ''
14+ #!${pkgs.python2.withPackages (p: [p.beanstalkc])}/bin/python
15+ import beanstalkc
16+
17+ queue = beanstalkc.Connection(host='localhost', port=11300, parse_yaml=False);
18+
19+ job = queue.reserve(timeout=0)
20+ print job.body
21+ job.delete()
22+ '';
23+
24+in
25+{
26+ name = "beanstalkd";
27+ meta.maintainers = [ lib.maintainers.aanderse ];
28+
29+ machine =
30+ { ... }:
31+ { services.beanstalkd.enable = true;
32+ };
33+
34+ testScript = ''
35+ startAll;
36+
37+ $machine->waitForUnit('beanstalkd.service');
38+
39+ $machine->succeed("${produce}");
40+ $machine->succeed("${consume}") eq "this is a job\n" or die;
41+ $machine->succeed("${consume}") eq "this is another job\n" or die;
42+ '';
43+})