Some checks failed
Periodic Merges (6h) / master → staging-nixos (push) Failing after 12m50s
Periodic Merges (6h) / master → staging-next (push) Failing after 12m54s
Periodic Merges (24h) / merge-base(master,staging) → haskell-updates (push) Failing after 11m54s
Periodic Merges (6h) / staging-next → staging (push) Failing after 12m13s
Periodic Merges (24h) / staging-next-25.05 → staging-25.05 (push) Failing after 13m24s
Periodic Merges (24h) / release-25.05 → staging-next-25.05 (push) Failing after 14m28s
51 lines
1.1 KiB
Nix
51 lines
1.1 KiB
Nix
{ pkgs, lib, ... }:
|
|
|
|
let
|
|
pythonEnv = pkgs.python3.withPackages (p: [ p.beanstalkc ]);
|
|
|
|
produce = pkgs.writeScript "produce.py" ''
|
|
#!${pythonEnv.interpreter}
|
|
import beanstalkc
|
|
|
|
queue = beanstalkc.Connection(host='localhost', port=11300, parse_yaml=False);
|
|
queue.put(b'this is a job')
|
|
queue.put(b'this is another job')
|
|
'';
|
|
|
|
consume = pkgs.writeScript "consume.py" ''
|
|
#!${pythonEnv.interpreter}
|
|
import beanstalkc
|
|
|
|
queue = beanstalkc.Connection(host='localhost', port=11300, parse_yaml=False);
|
|
|
|
job = queue.reserve(timeout=0)
|
|
print(job.body.decode('utf-8'))
|
|
job.delete()
|
|
'';
|
|
|
|
in
|
|
{
|
|
name = "beanstalkd";
|
|
meta.maintainers = [ lib.maintainers.aanderse ];
|
|
|
|
nodes.machine =
|
|
{ ... }:
|
|
{
|
|
services.beanstalkd.enable = true;
|
|
};
|
|
|
|
testScript = ''
|
|
start_all()
|
|
|
|
machine.wait_for_unit("beanstalkd.service")
|
|
|
|
machine.succeed("${produce}")
|
|
assert "this is a job\n" == machine.succeed(
|
|
"${consume}"
|
|
)
|
|
assert "this is another job\n" == machine.succeed(
|
|
"${consume}"
|
|
)
|
|
'';
|
|
}
|