From 1305752ba01dba39cfd1dec3ed410b460af72b96 Mon Sep 17 00:00:00 2001 From: Andreas Rammhold Date: Sat, 9 Jun 2018 02:05:21 +0200 Subject: [PATCH] nixos/memcached: added simple set/get test The test ensures that the services comes up and accepts/provides values. --- nixos/release.nix | 1 + nixos/tests/memcached.nix | 28 ++++++++++++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 nixos/tests/memcached.nix diff --git a/nixos/release.nix b/nixos/release.nix index 2b9c58df95bc..0fa8b22cc898 100644 --- a/nixos/release.nix +++ b/nixos/release.nix @@ -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 {}; diff --git a/nixos/tests/memcached.nix b/nixos/tests/memcached.nix new file mode 100644 index 000000000000..f9ef3647bd1a --- /dev/null +++ b/nixos/tests/memcached.nix @@ -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}"); + ''; +})