mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-06-09 19:13:26 +03:00
parent
28a81fbea8
commit
dc3df2d066
2 changed files with 40 additions and 42 deletions
|
@ -228,7 +228,7 @@ in
|
|||
babeld = runTest ./babeld.nix;
|
||||
bazarr = runTest ./bazarr.nix;
|
||||
bcachefs = runTestOn [ "x86_64-linux" "aarch64-linux" ] ./bcachefs.nix;
|
||||
beanstalkd = handleTest ./beanstalkd.nix { };
|
||||
beanstalkd = runTest ./beanstalkd.nix;
|
||||
bees = handleTest ./bees.nix { };
|
||||
benchexec = handleTest ./benchexec.nix { };
|
||||
binary-cache = handleTest ./binary-cache.nix { compression = "zstd"; };
|
||||
|
|
|
@ -1,52 +1,50 @@
|
|||
import ./make-test-python.nix (
|
||||
{ pkgs, lib, ... }:
|
||||
{ pkgs, lib, ... }:
|
||||
|
||||
let
|
||||
pythonEnv = pkgs.python3.withPackages (p: [ p.beanstalkc ]);
|
||||
let
|
||||
pythonEnv = pkgs.python3.withPackages (p: [ p.beanstalkc ]);
|
||||
|
||||
produce = pkgs.writeScript "produce.py" ''
|
||||
#!${pythonEnv.interpreter}
|
||||
import 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')
|
||||
'';
|
||||
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
|
||||
consume = pkgs.writeScript "consume.py" ''
|
||||
#!${pythonEnv.interpreter}
|
||||
import beanstalkc
|
||||
|
||||
queue = beanstalkc.Connection(host='localhost', port=11300, parse_yaml=False);
|
||||
queue = beanstalkc.Connection(host='localhost', port=11300, parse_yaml=False);
|
||||
|
||||
job = queue.reserve(timeout=0)
|
||||
print(job.body.decode('utf-8'))
|
||||
job.delete()
|
||||
'';
|
||||
job = queue.reserve(timeout=0)
|
||||
print(job.body.decode('utf-8'))
|
||||
job.delete()
|
||||
'';
|
||||
|
||||
in
|
||||
{
|
||||
name = "beanstalkd";
|
||||
meta.maintainers = [ lib.maintainers.aanderse ];
|
||||
in
|
||||
{
|
||||
name = "beanstalkd";
|
||||
meta.maintainers = [ lib.maintainers.aanderse ];
|
||||
|
||||
nodes.machine =
|
||||
{ ... }:
|
||||
{
|
||||
services.beanstalkd.enable = true;
|
||||
};
|
||||
nodes.machine =
|
||||
{ ... }:
|
||||
{
|
||||
services.beanstalkd.enable = true;
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
start_all()
|
||||
testScript = ''
|
||||
start_all()
|
||||
|
||||
machine.wait_for_unit("beanstalkd.service")
|
||||
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}"
|
||||
)
|
||||
'';
|
||||
}
|
||||
)
|
||||
machine.succeed("${produce}")
|
||||
assert "this is a job\n" == machine.succeed(
|
||||
"${consume}"
|
||||
)
|
||||
assert "this is another job\n" == machine.succeed(
|
||||
"${consume}"
|
||||
)
|
||||
'';
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue