Skip to content
This repository was archived by the owner on May 17, 2021. It is now read-only.

Commit 924215c

Browse files
committed
INT-973 detect enterprise module for versions < 3.1.3
1 parent 0cafb36 commit 924215c

File tree

3 files changed

+91
-1
lines changed

3 files changed

+91
-1
lines changed

lib/fetch.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ function parseBuildInfo(resp) {
5353
max_bson_object_size: resp.maxBsonObjectSize,
5454
enterprise_module: false
5555
};
56+
// cover both cases of detecting enterprise module, see SERVER-18099
57+
if (resp.gitVersion.match(/enterprise/)) {
58+
res.enterprise_module = true;
59+
}
5660
if (resp.modules && resp.modules.indexOf('enterprise') !== -1) {
5761
res.enterprise_module = true;
5862
}

test/fetch-mocked.test.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,26 @@ describe('unit tests on fetch functions', function() {
5555
done();
5656
}, results);
5757
});
58+
it('should detect enterprise module correctly for 2.6 and 3.0', function(done) {
59+
var results = {
60+
db: makeMockDB(null, fixtures.BUILD_INFO_OLD)
61+
};
62+
fetch.getBuildInfo(function(err, res) {
63+
assert.equal(err, null);
64+
assert.equal(res.enterprise_module, true);
65+
done();
66+
}, results);
67+
});
68+
it('should detect enterprise module correctly for 3.2 +', function(done) {
69+
var results = {
70+
db: makeMockDB(null, fixtures.BUILD_INFO_3_2)
71+
};
72+
fetch.getBuildInfo(function(err, res) {
73+
assert.equal(err, null);
74+
assert.equal(res.enterprise_module, true);
75+
done();
76+
}, results);
77+
});
5878
});
5979

6080
describe('getHostInfo', function() {

test/fixtures.js

Lines changed: 67 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,73 @@ var USER_INFO = {
377377
]
378378
};
379379

380+
var BUILD_INFO_OLD = {
381+
"version" : "2.6.11",
382+
"gitVersion" : "d00c1735675c457f75a12d530bee85421f0c5548 modules: enterprise",
383+
"OpenSSLVersion" : "OpenSSL 1.0.1f 6 Jan 2014",
384+
"sysInfo" : "Linux ip-10-203-203-194 3.13.0-24-generic #46-Ubuntu SMP Thu Apr 10 19:11:08 UTC 2014 x86_64 BOOST_LIB_VERSION=1_49",
385+
"loaderFlags" : "-fPIC -pthread -Wl,-z,now -rdynamic -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,-z,now -Wl,-E",
386+
"compilerFlags" : "-Wnon-virtual-dtor -Woverloaded-virtual -fPIC -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch -pipe -Werror -O3 -Wno-unused-local-typedefs -Wno-unused-function -Wno-deprecated-declarations -fno-builtin-memcmp",
387+
"allocator" : "tcmalloc",
388+
"versionArray" : [
389+
2,
390+
6,
391+
11,
392+
0
393+
],
394+
"javascriptEngine" : "V8",
395+
"bits" : 64,
396+
"debug" : false,
397+
"maxBsonObjectSize" : 16777216,
398+
"ok" : 1
399+
};
400+
401+
var BUILD_INFO_3_2 = {
402+
"version" : "3.2.0-rc2",
403+
"gitVersion" : "8a3acb42742182c5e314636041c2df368232bbc5",
404+
"modules" : [
405+
"enterprise"
406+
],
407+
"allocator" : "system",
408+
"javascriptEngine" : "mozjs",
409+
"sysInfo" : "deprecated",
410+
"versionArray" : [
411+
3,
412+
2,
413+
0,
414+
-48
415+
],
416+
"openssl" : {
417+
"running" : "OpenSSL 0.9.8zg 14 July 2015",
418+
"compiled" : "OpenSSL 0.9.8y 5 Feb 2013"
419+
},
420+
"buildEnvironment" : {
421+
"distmod" : "",
422+
"distarch" : "x86_64",
423+
"cc" : "gcc: Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)",
424+
"ccflags" : "-fno-omit-frame-pointer -fPIC -fno-strict-aliasing -ggdb -pthread -Wall -Wsign-compare -Wno-unknown-pragmas -Winvalid-pch -Werror -O2 -Wno-unused-function -Wno-unused-private-field -Wno-deprecated-declarations -Wno-tautological-constant-out-of-range-compare -Wno-unused-const-variable -Wno-missing-braces -mmacosx-version-min=10.7 -fno-builtin-memcmp",
425+
"cxx" : "g++: Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)",
426+
"cxxflags" : "-Wnon-virtual-dtor -Woverloaded-virtual -stdlib=libc++ -std=c++11",
427+
"linkflags" : "-fPIC -pthread -Wl,-bind_at_load -mmacosx-version-min=10.7 -stdlib=libc++ -fuse-ld=gold",
428+
"target_arch" : "x86_64",
429+
"target_os" : "osx"
430+
},
431+
"bits" : 64,
432+
"debug" : false,
433+
"maxBsonObjectSize" : 16777216,
434+
"storageEngines" : [
435+
"devnull",
436+
"ephemeralForTest",
437+
"inMemory",
438+
"mmapv1",
439+
"wiredTiger"
440+
],
441+
"ok" : 1
442+
};
443+
380444
module.exports = {
381445
HOST_INFO: HOST_INFO,
382-
USER_INFO: USER_INFO
446+
USER_INFO: USER_INFO,
447+
BUILD_INFO_OLD: BUILD_INFO_OLD,
448+
BUILD_INFO_3_2: BUILD_INFO_3_2
383449
};

0 commit comments

Comments
 (0)