[CI] test with 6.10 and 7.10, mongoDB 3.2 and 3.4 (#3787)

* Node modernization on CI

* Makes sure tests dont yeild unhandled promise rejections

* Adds small delay to startDB

* Adds mongodb service

* testing default

* stupid

* testing with silent nugget

* proper versions

* Single release step
This commit is contained in:
Florent Vilmart
2017-05-14 10:50:53 -04:00
committed by GitHub
parent f40019a326
commit ab5b759e26
5 changed files with 51 additions and 56 deletions

View File

@@ -51,7 +51,7 @@ if (process.env.PARSE_SERVER_TEST_DB === 'postgres') {
startDB = require('mongodb-runner/mocha/before').bind({
timeout: () => {},
slow: () => {}
});
})
stopDB = require('mongodb-runner/mocha/after');
databaseAdapter = new MongoStorageAdapter({
uri: mongoURI,
@@ -118,44 +118,40 @@ if (process.env.PARSE_SERVER_TEST_CACHE === 'redis') {
const openConnections = {};
// Set up a default API server for testing with default configuration.
var app = express();
var api = new ParseServer(defaultConfiguration);
app.use('/1', api);
app.use('/1', () => {
fail('should not call next');
});
var server = app.listen(port);
server.on('connection', connection => {
const key = `${connection.remoteAddress}:${connection.remotePort}`;
openConnections[key] = connection;
connection.on('close', () => { delete openConnections[key] });
});
var app;
var api;
var server;
// Allows testing specific configurations of Parse Server
const reconfigureServer = changedConfiguration => {
return new Promise((resolve, reject) => {
server.close(() => {
try {
const newConfiguration = Object.assign({}, defaultConfiguration, changedConfiguration, {
__indexBuildCompletionCallbackForTests: indexBuildPromise => indexBuildPromise.then(resolve, reject)
});
cache.clear();
app = express();
api = new ParseServer(newConfiguration);
api.use(require('./testing-routes').router);
app.use('/1', api);
app.use('/1', () => {
fail('should not call next');
});
server = app.listen(port);
server.on('connection', connection => {
const key = `${connection.remoteAddress}:${connection.remotePort}`;
openConnections[key] = connection;
connection.on('close', () => { delete openConnections[key] });
});
} catch(error) {
reject(error);
}
});
if (server) {
return server.close(() => {
server = undefined;
reconfigureServer(changedConfiguration).then(resolve, reject);
});
}
try {
const newConfiguration = Object.assign({}, defaultConfiguration, changedConfiguration, {
__indexBuildCompletionCallbackForTests: indexBuildPromise => indexBuildPromise.then(resolve, reject)
});
cache.clear();
app = express();
api = new ParseServer(newConfiguration);
api.use(require('./testing-routes').router);
app.use('/1', api);
app.use('/1', () => {
fail('should not call next');
});
server = app.listen(port);
server.on('connection', connection => {
const key = `${connection.remoteAddress}:${connection.remotePort}`;
openConnections[key] = connection;
connection.on('close', () => { delete openConnections[key] });
});
} catch(error) {
reject(error);
}
});
}