nixos/memcached: added simple set/get test

The test ensures that the services comes up and accepts/provides values.
This commit is contained in:
Andreas Rammhold 2018-06-09 02:05:21 +02:00
parent 500f1a9438
commit 1305752ba0
No known key found for this signature in database
GPG Key ID: E432E410B5E48C86
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}");
'';
})