Merge pull request #74312 from filalex77/nixosTests.memcached-python
nixosTests.memcached: port to python
This commit is contained in:
commit
470f29cdd2
1 changed files with 11 additions and 15 deletions
|
@ -1,28 +1,24 @@
|
|||
import ./make-test.nix ({ pkgs, ...} : {
|
||||
import ./make-test-python.nix ({ pkgs, ... }: {
|
||||
name = "memcached";
|
||||
|
||||
nodes = {
|
||||
machine =
|
||||
{ ... }:
|
||||
{
|
||||
imports = [ ../modules/profiles/minimal.nix ];
|
||||
services.memcached.enable = true;
|
||||
};
|
||||
machine = {
|
||||
imports = [ ../modules/profiles/minimal.nix ];
|
||||
services.memcached.enable = true;
|
||||
};
|
||||
|
||||
testScript = let
|
||||
testScript = pkgs.writeScript "testScript.py" ''
|
||||
#!${pkgs.python3.withPackages (p: [p.memcached])}/bin/python
|
||||
|
||||
testScript = pkgs.writers.writePython3 "test_memcache" {
|
||||
libraries = with pkgs.python3Packages; [ memcached ];
|
||||
} ''
|
||||
import memcache
|
||||
c = memcache.Client(['localhost:11211'])
|
||||
c.set('key', 'value')
|
||||
assert 'value' == c.get('key')
|
||||
'';
|
||||
in ''
|
||||
startAll;
|
||||
$machine->waitForUnit("memcached.service");
|
||||
$machine->waitForOpenPort("11211");
|
||||
$machine->succeed("${testScript}");
|
||||
machine.start()
|
||||
machine.wait_for_unit("memcached.service")
|
||||
machine.wait_for_open_port(11211)
|
||||
machine.succeed("${testScript}")
|
||||
'';
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue