Allow single server instance in test suite (#7262)
* initial pass * reconfigureServer when needed * finish postgres tests * mongo tests * more tests * clean up * re-add skipped test * Fix transaction tests * handle batch * AuthenticationAdapter fix * More reconfiguration * clean up * properly terminate cli servers * handle Parse.Push * Flaky PushController * ensure reconfigureServer when changed * fix postgres tests * remove console.log * LiveQuery spec remove duplicates and listeners
This commit is contained in:
@@ -10,26 +10,32 @@ const { spawn } = require('child_process');
|
||||
|
||||
describe('Server Url Checks', () => {
|
||||
let server;
|
||||
beforeAll(done => {
|
||||
const app = express();
|
||||
app.get('/health', function (req, res) {
|
||||
res.json({
|
||||
status: 'ok',
|
||||
beforeEach(done => {
|
||||
if (!server) {
|
||||
const app = express();
|
||||
app.get('/health', function (req, res) {
|
||||
res.json({
|
||||
status: 'ok',
|
||||
});
|
||||
});
|
||||
});
|
||||
server = app.listen(13376, undefined, done);
|
||||
server = app.listen(13376, undefined, done);
|
||||
} else {
|
||||
done();
|
||||
}
|
||||
});
|
||||
|
||||
afterAll(done => {
|
||||
Parse.serverURL = 'http://localhost:8378/1';
|
||||
server.close(done);
|
||||
});
|
||||
|
||||
it('validate good server url', done => {
|
||||
Parse.serverURL = 'http://localhost:13376';
|
||||
ParseServer.verifyServerUrl(function (result) {
|
||||
ParseServer.verifyServerUrl(async result => {
|
||||
if (!result) {
|
||||
done.fail('Did not pass valid url');
|
||||
}
|
||||
await reconfigureServer();
|
||||
done();
|
||||
});
|
||||
});
|
||||
@@ -37,10 +43,11 @@ describe('Server Url Checks', () => {
|
||||
it('mark bad server url', done => {
|
||||
spyOn(console, 'warn').and.callFake(() => {});
|
||||
Parse.serverURL = 'notavalidurl';
|
||||
ParseServer.verifyServerUrl(function (result) {
|
||||
ParseServer.verifyServerUrl(async result => {
|
||||
if (result) {
|
||||
done.fail('Did not mark invalid url');
|
||||
}
|
||||
await reconfigureServer();
|
||||
done();
|
||||
});
|
||||
});
|
||||
@@ -98,10 +105,11 @@ describe('Server Url Checks', () => {
|
||||
parseServerProcess.stderr.on('data', data => {
|
||||
stderr = data.toString();
|
||||
});
|
||||
parseServerProcess.on('close', code => {
|
||||
parseServerProcess.on('close', async code => {
|
||||
expect(code).toEqual(1);
|
||||
expect(stdout).toBeUndefined();
|
||||
expect(stderr).toContain('MongoServerSelectionError');
|
||||
await reconfigureServer();
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user