2013-06-25 14:54:34 +01:00
|
|
|
// SERVER-9137 test that the httpinterface parameter enables the web interface
|
2015-09-01 16:19:57 -04:00
|
|
|
var conn = MongoRunner.runMongod({smallfiles: ""});
|
|
|
|
|
var httpPort = conn.port + 1000;
|
2013-09-17 11:43:44 -04:00
|
|
|
|
|
|
|
|
tryHttp = function() {
|
|
|
|
|
try {
|
2016-03-09 12:17:50 -05:00
|
|
|
var mongo = new Mongo('localhost:' + httpPort);
|
|
|
|
|
} catch (e) {
|
2013-09-17 11:43:44 -04:00
|
|
|
return false;
|
|
|
|
|
}
|
|
|
|
|
// if we managed to start and connect a new mongo then the web interface is working
|
|
|
|
|
return true;
|
2016-02-04 12:29:26 -05:00
|
|
|
};
|
2013-09-17 11:43:44 -04:00
|
|
|
|
2016-03-09 12:17:50 -05:00
|
|
|
assert.throws(function() {
|
|
|
|
|
assert.soon(tryHttp, "tryHttp failed, like we expected it to");
|
|
|
|
|
});
|
2013-06-25 14:54:34 +01:00
|
|
|
|
|
|
|
|
MongoRunner.stopMongod(conn);
|
2013-09-17 11:43:44 -04:00
|
|
|
|
2015-09-01 16:19:57 -04:00
|
|
|
conn = MongoRunner.runMongod({port: conn.port, smallfiles: "", httpinterface: ""});
|
2016-03-09 12:17:50 -05:00
|
|
|
assert.soon(tryHttp, "the web interface should be running on " + httpPort);
|
2013-09-17 11:43:44 -04:00
|
|
|
|
2013-06-25 14:54:34 +01:00
|
|
|
MongoRunner.stopMongod(conn);
|