Merge pull request #18622 from rvl/mongodb-test-default-i686

mongodb service: Add test case and fix default storage engine on i686
This commit is contained in:
Domen Kožar 2016-09-21 14:19:45 +02:00 committed by GitHub
commit 30e35d1218
3 changed files with 40 additions and 0 deletions

View File

@ -260,6 +260,7 @@ in rec {
#tests.logstash = callTest tests/logstash.nix {}; #tests.logstash = callTest tests/logstash.nix {};
tests.mathics = callTest tests/mathics.nix {}; tests.mathics = callTest tests/mathics.nix {};
tests.misc = callTest tests/misc.nix {}; tests.misc = callTest tests/misc.nix {};
tests.mongodb = callTest tests/mongodb.nix {};
tests.mumble = callTest tests/mumble.nix {}; tests.mumble = callTest tests/mumble.nix {};
tests.munin = callTest tests/munin.nix {}; tests.munin = callTest tests/munin.nix {};
tests.mysql = callTest tests/mysql.nix {}; tests.mysql = callTest tests/mysql.nix {};

34
nixos/tests/mongodb.nix Normal file
View 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;
'';
})

View File

@ -80,6 +80,11 @@ in stdenv.mkDerivation rec {
substituteInPlace src/third_party/s2/s2cap.cc --replace drem remainder substituteInPlace src/third_party/s2/s2cap.cc --replace drem remainder
substituteInPlace src/third_party/s2/s2latlng.cc --replace drem remainder substituteInPlace src/third_party/s2/s2latlng.cc --replace drem remainder
substituteInPlace src/third_party/s2/s2latlngrect.cc --replace drem remainder substituteInPlace src/third_party/s2/s2latlngrect.cc --replace drem remainder
'' + stdenv.lib.optionalString stdenv.isi686 ''
# don't fail by default on i686
substituteInPlace src/mongo/db/storage/storage_options.h \
--replace 'engine("wiredTiger")' 'engine("mmapv1")'
''; '';
buildPhase = '' buildPhase = ''