about summary refs log tree commit diff
path: root/nixos
diff options
context:
space:
mode:
authorDomen Kožar <domen@dev.si>2016-09-21 14:19:45 +0200
committerGitHub <noreply@github.com>2016-09-21 14:19:45 +0200
commit30e35d12186402856c5e897c9ea3d3325655e8d4 (patch)
tree4f5d49ae914bcbec91325c33e1773173dc5e294b /nixos
parent001d314e874e7fcf819847f88051346684d22e32 (diff)
parent795a6e7610c5242d68cbc37247e0cef6a263e76d (diff)
downloadnixlib-30e35d12186402856c5e897c9ea3d3325655e8d4.tar
nixlib-30e35d12186402856c5e897c9ea3d3325655e8d4.tar.gz
nixlib-30e35d12186402856c5e897c9ea3d3325655e8d4.tar.bz2
nixlib-30e35d12186402856c5e897c9ea3d3325655e8d4.tar.lz
nixlib-30e35d12186402856c5e897c9ea3d3325655e8d4.tar.xz
nixlib-30e35d12186402856c5e897c9ea3d3325655e8d4.tar.zst
nixlib-30e35d12186402856c5e897c9ea3d3325655e8d4.zip
Merge pull request #18622 from rvl/mongodb-test-default-i686
mongodb service: Add test case and fix default storage engine on i686
Diffstat (limited to 'nixos')
-rw-r--r--nixos/release.nix1
-rw-r--r--nixos/tests/mongodb.nix34
2 files changed, 35 insertions, 0 deletions
diff --git a/nixos/release.nix b/nixos/release.nix
index d66ebd7cb15c..7fcff78f6b95 100644
--- a/nixos/release.nix
+++ b/nixos/release.nix
@@ -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 {};
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;
+  '';
+})