about summary refs log tree commit diff
path: root/nixos/tests/mongodb.nix
diff options
context:
space:
mode:
Diffstat (limited to 'nixos/tests/mongodb.nix')
-rw-r--r--nixos/tests/mongodb.nix10
1 files changed, 8 insertions, 2 deletions
diff --git a/nixos/tests/mongodb.nix b/nixos/tests/mongodb.nix
index c9439b65292d..0ccbeb062f92 100644
--- a/nixos/tests/mongodb.nix
+++ b/nixos/tests/mongodb.nix
@@ -8,7 +8,7 @@ import ./make-test.nix ({ pkgs, ...} : let
 in {
   name = "mongodb";
   meta = with pkgs.stdenv.lib.maintainers; {
-    maintainers = [ bluescreen303 offline cstrahan rvl ];
+    maintainers = [ bluescreen303 offline cstrahan rvl phile314 ];
   };
 
   nodes = {
@@ -17,6 +17,12 @@ in {
         {
           services = {
            mongodb.enable = true;
+           mongodb.enableAuth = true;
+           mongodb.initialRootPassword = "root";
+           mongodb.initialScript = pkgs.writeText "mongodb_initial.js" ''
+             db = db.getSiblingDB("nixtest");
+             db.createUser({user:"nixtest",pwd:"nixtest",roles:[{role:"readWrite",db:"nixtest"}]});
+           '';
            mongodb.extraConfig = ''
              # Allow starting engine with only a small virtual disk
              storage.journal.enabled: false
@@ -29,6 +35,6 @@ in {
   testScript = ''
     startAll;
     $one->waitForUnit("mongodb.service");
-    $one->succeed("mongo nixtest ${testQuery}") =~ /hello/ or die;
+    $one->succeed("mongo -u nixtest -p nixtest nixtest ${testQuery}") =~ /hello/ or die;
   '';
 })