mongodb service: add test case
This commit is contained in:
parent
6d7b77df0a
commit
795a6e7610
|
@ -260,6 +260,7 @@ in rec {
|
|||
#tests.logstash = callTest tests/logstash.nix {};
|
||||
tests.mathics = callTest tests/mathics.nix {};
|
||||
tests.misc = callTest tests/misc.nix {};
|
||||
tests.mongodb = callTest tests/mongodb.nix {};
|
||||
tests.mumble = callTest tests/mumble.nix {};
|
||||
tests.munin = callTest tests/munin.nix {};
|
||||
tests.mysql = callTest tests/mysql.nix {};
|
||||
|
|
34
nixos/tests/mongodb.nix
Normal file
34
nixos/tests/mongodb.nix
Normal file
|
@ -0,0 +1,34 @@
|
|||
# This test start mongodb, runs a query using mongo shell
|
||||
|
||||
import ./make-test.nix ({ pkgs, ...} : let
|
||||
testQuery = pkgs.writeScript "nixtest.js" ''
|
||||
db.greetings.insert({ "greeting": "hello" });
|
||||
print(db.greetings.findOne().greeting);
|
||||
'';
|
||||
in {
|
||||
name = "mongodb";
|
||||
meta = with pkgs.stdenv.lib.maintainers; {
|
||||
maintainers = [ bluescreen303 offline wkennington cstrahan rvl ];
|
||||
};
|
||||
|
||||
nodes = {
|
||||
one =
|
||||
{ config, pkgs, ... }:
|
||||
{
|
||||
services = {
|
||||
mongodb.enable = true;
|
||||
mongodb.extraConfig = ''
|
||||
# Allow starting engine with only a small virtual disk
|
||||
storage.journal.enabled: false
|
||||
storage.mmapv1.smallFiles: true
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
testScript = ''
|
||||
startAll;
|
||||
$one->waitForUnit("mongodb.service");
|
||||
$one->succeed("mongo nixtest ${testQuery}") =~ /hello/ or die;
|
||||
'';
|
||||
})
|
Loading…
Reference in a new issue