Merge pull request #41731 from andir/memcached-test

nixos/memcached: added simple set/get test
This commit is contained in:
Andreas Rammhold 2018-06-09 08:07:51 +02:00 committed by GitHub
commit 2b1915b9f6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 29 additions and 0 deletions

View File

@ -334,6 +334,7 @@ in rec {
#tests.logstash = callTest tests/logstash.nix {};
tests.mathics = callTest tests/mathics.nix {};
tests.matrix-synapse = callTest tests/matrix-synapse.nix {};
tests.memcached = callTest tests/memcached.nix {};
tests.mesos = callTest tests/mesos.nix {};
tests.misc = callTest tests/misc.nix {};
tests.mongodb = callTest tests/mongodb.nix {};

28
nixos/tests/memcached.nix Normal file
View File

@ -0,0 +1,28 @@
import ./make-test.nix ({ pkgs, ...} : {
name = "memcached";
nodes = {
machine =
{ config, pkgs, ... }:
{
imports = [ ../modules/profiles/minimal.nix ];
services.memcached.enable = true;
};
};
testScript = let
testScript = pkgs.writeScript "testScript.py" ''
#!${pkgs.python3.withPackages (p: [p.memcached])}/bin/python
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}");
'';
})