2016-09-13 16:38:45 +01:00
|
|
|
# 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; {
|
2019-01-26 10:01:09 +00:00
|
|
|
maintainers = [ bluescreen303 offline cstrahan rvl ];
|
2016-09-13 16:38:45 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
nodes = {
|
|
|
|
one =
|
2018-07-20 21:56:59 +01:00
|
|
|
{ ... }:
|
2016-09-13 16:38:45 +01:00
|
|
|
{
|
|
|
|
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;
|
|
|
|
'';
|
|
|
|
})
|