diff options
Diffstat (limited to 'nixos/tests/mongodb.nix')
-rw-r--r-- | nixos/tests/mongodb.nix | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/nixos/tests/mongodb.nix b/nixos/tests/mongodb.nix new file mode 100644 index 000000000000..18535f51af9b --- /dev/null +++ b/nixos/tests/mongodb.nix @@ -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; + ''; +}) |