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:
Diamond Lewis
2021-03-13 09:05:22 -06:00
committed by GitHub
parent 8b0e8cd02c
commit 9563793303
36 changed files with 941 additions and 1020 deletions

View File

@@ -238,6 +238,7 @@ describe('Parse.User testing', () => {
});
it_only_db('mongo')('should let legacy users without ACL login', async () => {
await reconfigureServer();
const databaseURI = 'mongodb://localhost:27017/parseServerMongoAdapterTestDatabase';
const adapter = new MongoStorageAdapter({
collectionPrefix: 'test_',
@@ -826,8 +827,9 @@ describe('Parse.User testing', () => {
done();
});
it('user modified while saving', done => {
it('user modified while saving', async done => {
Parse.Object.disableSingleInstance();
await reconfigureServer();
const user = new Parse.User();
user.set('username', 'alice');
user.set('password', 'password');
@@ -2907,7 +2909,8 @@ describe('Parse.User testing', () => {
});
});
it('should send email when upgrading from anon', done => {
it('should send email when upgrading from anon', async done => {
await reconfigureServer();
let emailCalled = false;
let emailOptions;
const emailAdapter = {
@@ -3897,6 +3900,7 @@ describe('Parse.User testing', () => {
});
it('should throw OBJECT_NOT_FOUND instead of SESSION_MISSING when using masterKey', async () => {
await reconfigureServer();
// create a fake user (just so we simulate an object not found)
const non_existent_user = Parse.User.createWithoutData('fake_id');
try {
@@ -3929,6 +3933,7 @@ describe('Parse.User testing', () => {
it_only_db('mongo')('should be able to login with a legacy user (no ACL)', async () => {
// This issue is a side effect of the locked users and legacy users which don't have ACL's
// In this scenario, a legacy user wasn't be able to login as there's no ACL on it
await reconfigureServer();
const database = Config.get(Parse.applicationId).database;
const collection = await database.adapter._adaptiveCollection('_User');
await collection.insertOne({
@@ -3962,6 +3967,7 @@ describe('Security Advisory GHSA-8w3j-g983-8jh5', function () {
it_only_db('mongo')(
'should validate credentials first and check if account already linked afterwards ()',
async done => {
await reconfigureServer();
// Add User to Database with authData
const database = Config.get(Parse.applicationId).database;
const collection = await database.adapter._adaptiveCollection('_User');
@@ -4000,6 +4006,7 @@ describe('Security Advisory GHSA-8w3j-g983-8jh5', function () {
);
it_only_db('mongo')('should ignore authData field', async () => {
// Add User to Database with authData
await reconfigureServer();
const database = Config.get(Parse.applicationId).database;
const collection = await database.adapter._adaptiveCollection('_User');
await collection.insertOne({