diff options
author | Andreas Rammhold <andreas@rammhold.de> | 2018-06-09 02:05:21 +0200 |
---|---|---|
committer | Andreas Rammhold <andreas@rammhold.de> | 2018-06-09 02:11:15 +0200 |
commit | 1305752ba01dba39cfd1dec3ed410b460af72b96 (patch) | |
tree | 1c627d4f10a3ba2d8b1dda39507e6bbdcbd016fe /nixos/tests/memcached.nix | |
parent | 500f1a94388f817b9d2d91ffbb68cf554268c2d7 (diff) | |
download | nixpkgs-1305752ba01dba39cfd1dec3ed410b460af72b96.tar nixpkgs-1305752ba01dba39cfd1dec3ed410b460af72b96.tar.gz nixpkgs-1305752ba01dba39cfd1dec3ed410b460af72b96.tar.bz2 nixpkgs-1305752ba01dba39cfd1dec3ed410b460af72b96.tar.lz nixpkgs-1305752ba01dba39cfd1dec3ed410b460af72b96.tar.xz nixpkgs-1305752ba01dba39cfd1dec3ed410b460af72b96.tar.zst nixpkgs-1305752ba01dba39cfd1dec3ed410b460af72b96.zip |
nixos/memcached: added simple set/get test
The test ensures that the services comes up and accepts/provides values.
Diffstat (limited to 'nixos/tests/memcached.nix')
-rw-r--r-- | nixos/tests/memcached.nix | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/nixos/tests/memcached.nix b/nixos/tests/memcached.nix new file mode 100644 index 00000000000..f9ef3647bd1 --- /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}"); + ''; +}) |