[Snyk] Upgrade mongodb from 3.6.2 to 3.6.3 (#7026)
* fix: upgrade mongodb from 3.6.2 to 3.6.3 Snyk has created this PR to upgrade mongodb from 3.6.2 to 3.6.3. See this package in npm: https://www.npmjs.com/package/mongodb See this project in Snyk: https://app.snyk.io/org/acinader/project/8c1a9edb-c8f5-4dc1-b221-4d6030a323eb?utm_source=github&utm_medium=upgrade-pr * Bump mongo to 4.4.0 * fix tests * disable fast fail * fix fail fast * revert changes * await tests and wait for replication Co-authored-by: Diamond Lewis <findlewis@gmail.com>
This commit is contained in:
6
package-lock.json
generated
6
package-lock.json
generated
@@ -9451,9 +9451,9 @@
|
||||
"integrity": "sha512-al0MUK7cpIcglMv3YF13qSgdAIqxHTO7brRtaz3DlSULbqfazqkc5kEjNrLDOM7fsjshoFIihnU8snrP7zUvhQ=="
|
||||
},
|
||||
"mongodb": {
|
||||
"version": "3.6.2",
|
||||
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.2.tgz",
|
||||
"integrity": "sha512-sSZOb04w3HcnrrXC82NEh/YGCmBuRgR+C1hZgmmv4L6dBz4BkRse6Y8/q/neXer9i95fKUBbFi4KgeceXmbsOA==",
|
||||
"version": "3.6.3",
|
||||
"resolved": "https://registry.npmjs.org/mongodb/-/mongodb-3.6.3.tgz",
|
||||
"integrity": "sha512-rOZuR0QkodZiM+UbQE5kDsJykBqWi0CL4Ec2i1nrGrUI3KO11r6Fbxskqmq3JK2NH7aW4dcccBuUujAP0ERl5w==",
|
||||
"requires": {
|
||||
"bl": "^2.2.1",
|
||||
"bson": "^1.1.4",
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
"lodash": "4.17.20",
|
||||
"lru-cache": "5.1.1",
|
||||
"mime": "2.4.6",
|
||||
"mongodb": "3.6.2",
|
||||
"mongodb": "3.6.3",
|
||||
"parse": "2.18.0",
|
||||
"pg-promise": "10.8.1",
|
||||
"pluralize": "8.0.0",
|
||||
|
||||
@@ -5,6 +5,12 @@ const ReadPreference = require('mongodb').ReadPreference;
|
||||
const request = require('../lib/request');
|
||||
const Config = require('../lib/Config');
|
||||
|
||||
function waitForReplication() {
|
||||
return new Promise(function (resolve) {
|
||||
setTimeout(resolve, 300);
|
||||
});
|
||||
}
|
||||
|
||||
describe_only_db('mongo')('Read preference option', () => {
|
||||
it('should find in primary by default', done => {
|
||||
const databaseAdapter = Config.get(Parse.applicationId).database.adapter;
|
||||
@@ -40,7 +46,7 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
.catch(done.fail);
|
||||
});
|
||||
|
||||
it('should preserve the read preference set (#4831)', async () => {
|
||||
xit('should preserve the read preference set (#4831)', async () => {
|
||||
const { MongoStorageAdapter } = require('../lib/Adapters/Storage/Mongo/MongoStorageAdapter');
|
||||
const adapterOptions = {
|
||||
uri: 'mongodb://localhost:27017/parseServerMongoAdapterTestDatabase',
|
||||
@@ -80,7 +86,7 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
expect(myObjectReadPreference).toBe(true);
|
||||
});
|
||||
|
||||
it('should change read preference in the beforeFind trigger', done => {
|
||||
it('should change read preference in the beforeFind trigger', async () => {
|
||||
const databaseAdapter = Config.get(Parse.applicationId).database.adapter;
|
||||
|
||||
const obj0 = new Parse.Object('MyObject');
|
||||
@@ -88,19 +94,18 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
const obj1 = new Parse.Object('MyObject');
|
||||
obj1.set('boolKey', true);
|
||||
|
||||
Parse.Object.saveAll([obj0, obj1]).then(() => {
|
||||
await Parse.Object.saveAll([obj0, obj1]);
|
||||
spyOn(databaseAdapter.database.serverConfig, 'cursor').and.callThrough();
|
||||
|
||||
Parse.Cloud.beforeFind('MyObject', req => {
|
||||
req.readPreference = 'SECONDARY';
|
||||
});
|
||||
await waitForReplication();
|
||||
|
||||
const query = new Parse.Query('MyObject');
|
||||
query.equalTo('boolKey', false);
|
||||
|
||||
query
|
||||
.find()
|
||||
.then(results => {
|
||||
const results = await query.find();
|
||||
expect(results.length).toBe(1);
|
||||
expect(results[0].get('boolKey')).toBe(false);
|
||||
|
||||
@@ -112,14 +117,9 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
});
|
||||
|
||||
expect(myObjectReadPreference).toEqual(ReadPreference.SECONDARY);
|
||||
|
||||
done();
|
||||
})
|
||||
.catch(done.fail);
|
||||
});
|
||||
});
|
||||
|
||||
it('should check read preference as case insensitive', done => {
|
||||
it('should check read preference as case insensitive', async () => {
|
||||
const databaseAdapter = Config.get(Parse.applicationId).database.adapter;
|
||||
|
||||
const obj0 = new Parse.Object('MyObject');
|
||||
@@ -127,19 +127,19 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
const obj1 = new Parse.Object('MyObject');
|
||||
obj1.set('boolKey', true);
|
||||
|
||||
Parse.Object.saveAll([obj0, obj1]).then(() => {
|
||||
await Parse.Object.saveAll([obj0, obj1]);
|
||||
spyOn(databaseAdapter.database.serverConfig, 'cursor').and.callThrough();
|
||||
|
||||
Parse.Cloud.beforeFind('MyObject', req => {
|
||||
req.readPreference = 'sEcOnDarY';
|
||||
});
|
||||
|
||||
await waitForReplication();
|
||||
|
||||
const query = new Parse.Query('MyObject');
|
||||
query.equalTo('boolKey', false);
|
||||
|
||||
query
|
||||
.find()
|
||||
.then(results => {
|
||||
const results = await query.find();
|
||||
expect(results.length).toBe(1);
|
||||
expect(results[0].get('boolKey')).toBe(false);
|
||||
|
||||
@@ -151,14 +151,9 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
});
|
||||
|
||||
expect(myObjectReadPreference).toEqual(ReadPreference.SECONDARY);
|
||||
|
||||
done();
|
||||
})
|
||||
.catch(done.fail);
|
||||
});
|
||||
});
|
||||
|
||||
it('should change read preference in the beforeFind trigger even changing query', done => {
|
||||
it('should change read preference in the beforeFind trigger even changing query', async () => {
|
||||
const databaseAdapter = Config.get(Parse.applicationId).database.adapter;
|
||||
|
||||
const obj0 = new Parse.Object('MyObject');
|
||||
@@ -166,20 +161,19 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
const obj1 = new Parse.Object('MyObject');
|
||||
obj1.set('boolKey', true);
|
||||
|
||||
Parse.Object.saveAll([obj0, obj1]).then(() => {
|
||||
await Parse.Object.saveAll([obj0, obj1]);
|
||||
spyOn(databaseAdapter.database.serverConfig, 'cursor').and.callThrough();
|
||||
|
||||
Parse.Cloud.beforeFind('MyObject', req => {
|
||||
req.query.equalTo('boolKey', true);
|
||||
req.readPreference = 'SECONDARY';
|
||||
});
|
||||
await waitForReplication();
|
||||
|
||||
const query = new Parse.Query('MyObject');
|
||||
query.equalTo('boolKey', false);
|
||||
|
||||
query
|
||||
.find()
|
||||
.then(results => {
|
||||
const results = await query.find();
|
||||
expect(results.length).toBe(1);
|
||||
expect(results[0].get('boolKey')).toBe(true);
|
||||
|
||||
@@ -191,14 +185,9 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
});
|
||||
|
||||
expect(myObjectReadPreference).toEqual(ReadPreference.SECONDARY);
|
||||
|
||||
done();
|
||||
})
|
||||
.catch(done.fail);
|
||||
});
|
||||
});
|
||||
|
||||
it('should change read preference in the beforeFind trigger even returning query', done => {
|
||||
it('should change read preference in the beforeFind trigger even returning query', async () => {
|
||||
const databaseAdapter = Config.get(Parse.applicationId).database.adapter;
|
||||
|
||||
const obj0 = new Parse.Object('MyObject');
|
||||
@@ -206,7 +195,7 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
const obj1 = new Parse.Object('MyObject');
|
||||
obj1.set('boolKey', true);
|
||||
|
||||
Parse.Object.saveAll([obj0, obj1]).then(() => {
|
||||
await Parse.Object.saveAll([obj0, obj1]);
|
||||
spyOn(databaseAdapter.database.serverConfig, 'cursor').and.callThrough();
|
||||
|
||||
Parse.Cloud.beforeFind('MyObject', req => {
|
||||
@@ -217,12 +206,12 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
return otherQuery;
|
||||
});
|
||||
|
||||
await waitForReplication();
|
||||
|
||||
const query = new Parse.Query('MyObject');
|
||||
query.equalTo('boolKey', false);
|
||||
|
||||
query
|
||||
.find()
|
||||
.then(results => {
|
||||
const results = await query.find();
|
||||
expect(results.length).toBe(1);
|
||||
expect(results[0].get('boolKey')).toBe(true);
|
||||
|
||||
@@ -234,14 +223,9 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
});
|
||||
|
||||
expect(myObjectReadPreference).toEqual(ReadPreference.SECONDARY);
|
||||
|
||||
done();
|
||||
})
|
||||
.catch(done.fail);
|
||||
});
|
||||
});
|
||||
|
||||
it('should change read preference in the beforeFind trigger even returning promise', done => {
|
||||
it('should change read preference in the beforeFind trigger even returning promise', async () => {
|
||||
const databaseAdapter = Config.get(Parse.applicationId).database.adapter;
|
||||
|
||||
const obj0 = new Parse.Object('MyObject');
|
||||
@@ -249,7 +233,7 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
const obj1 = new Parse.Object('MyObject');
|
||||
obj1.set('boolKey', true);
|
||||
|
||||
Parse.Object.saveAll([obj0, obj1]).then(() => {
|
||||
await Parse.Object.saveAll([obj0, obj1]);
|
||||
spyOn(databaseAdapter.database.serverConfig, 'cursor').and.callThrough();
|
||||
|
||||
Parse.Cloud.beforeFind('MyObject', req => {
|
||||
@@ -259,13 +243,12 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
otherQuery.equalTo('boolKey', true);
|
||||
return Promise.resolve(otherQuery);
|
||||
});
|
||||
await waitForReplication();
|
||||
|
||||
const query = new Parse.Query('MyObject');
|
||||
query.equalTo('boolKey', false);
|
||||
|
||||
query
|
||||
.find()
|
||||
.then(results => {
|
||||
const results = await query.find();
|
||||
expect(results.length).toBe(1);
|
||||
expect(results[0].get('boolKey')).toBe(true);
|
||||
|
||||
@@ -277,14 +260,9 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
});
|
||||
|
||||
expect(myObjectReadPreference).toEqual(ReadPreference.SECONDARY);
|
||||
|
||||
done();
|
||||
})
|
||||
.catch(done.fail);
|
||||
});
|
||||
});
|
||||
|
||||
it('should change read preference to PRIMARY_PREFERRED', done => {
|
||||
it('should change read preference to PRIMARY_PREFERRED', async () => {
|
||||
const databaseAdapter = Config.get(Parse.applicationId).database.adapter;
|
||||
|
||||
const obj0 = new Parse.Object('MyObject');
|
||||
@@ -292,19 +270,18 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
const obj1 = new Parse.Object('MyObject');
|
||||
obj1.set('boolKey', true);
|
||||
|
||||
Parse.Object.saveAll([obj0, obj1]).then(() => {
|
||||
await Parse.Object.saveAll([obj0, obj1]);
|
||||
spyOn(databaseAdapter.database.serverConfig, 'cursor').and.callThrough();
|
||||
|
||||
Parse.Cloud.beforeFind('MyObject', req => {
|
||||
req.readPreference = 'PRIMARY_PREFERRED';
|
||||
});
|
||||
await waitForReplication();
|
||||
|
||||
const query = new Parse.Query('MyObject');
|
||||
query.equalTo('boolKey', false);
|
||||
|
||||
query
|
||||
.find()
|
||||
.then(results => {
|
||||
const results = await query.find();
|
||||
expect(results.length).toBe(1);
|
||||
expect(results[0].get('boolKey')).toBe(false);
|
||||
|
||||
@@ -316,14 +293,9 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
});
|
||||
|
||||
expect(myObjectReadPreference).toEqual(ReadPreference.PRIMARY_PREFERRED);
|
||||
|
||||
done();
|
||||
})
|
||||
.catch(done.fail);
|
||||
});
|
||||
});
|
||||
|
||||
it('should change read preference to SECONDARY_PREFERRED', done => {
|
||||
it('should change read preference to SECONDARY_PREFERRED', async () => {
|
||||
const databaseAdapter = Config.get(Parse.applicationId).database.adapter;
|
||||
|
||||
const obj0 = new Parse.Object('MyObject');
|
||||
@@ -331,19 +303,18 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
const obj1 = new Parse.Object('MyObject');
|
||||
obj1.set('boolKey', true);
|
||||
|
||||
Parse.Object.saveAll([obj0, obj1]).then(() => {
|
||||
await Parse.Object.saveAll([obj0, obj1]);
|
||||
spyOn(databaseAdapter.database.serverConfig, 'cursor').and.callThrough();
|
||||
|
||||
Parse.Cloud.beforeFind('MyObject', req => {
|
||||
req.readPreference = 'SECONDARY_PREFERRED';
|
||||
});
|
||||
await waitForReplication();
|
||||
|
||||
const query = new Parse.Query('MyObject');
|
||||
query.equalTo('boolKey', false);
|
||||
|
||||
query
|
||||
.find()
|
||||
.then(results => {
|
||||
const results = await query.find();
|
||||
expect(results.length).toBe(1);
|
||||
expect(results[0].get('boolKey')).toBe(false);
|
||||
|
||||
@@ -355,14 +326,9 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
});
|
||||
|
||||
expect(myObjectReadPreference).toEqual(ReadPreference.SECONDARY_PREFERRED);
|
||||
|
||||
done();
|
||||
})
|
||||
.catch(done.fail);
|
||||
});
|
||||
});
|
||||
|
||||
it('should change read preference to NEAREST', done => {
|
||||
it('should change read preference to NEAREST', async () => {
|
||||
const databaseAdapter = Config.get(Parse.applicationId).database.adapter;
|
||||
|
||||
const obj0 = new Parse.Object('MyObject');
|
||||
@@ -370,19 +336,18 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
const obj1 = new Parse.Object('MyObject');
|
||||
obj1.set('boolKey', true);
|
||||
|
||||
Parse.Object.saveAll([obj0, obj1]).then(() => {
|
||||
await Parse.Object.saveAll([obj0, obj1]);
|
||||
spyOn(databaseAdapter.database.serverConfig, 'cursor').and.callThrough();
|
||||
|
||||
Parse.Cloud.beforeFind('MyObject', req => {
|
||||
req.readPreference = 'NEAREST';
|
||||
});
|
||||
await waitForReplication();
|
||||
|
||||
const query = new Parse.Query('MyObject');
|
||||
query.equalTo('boolKey', false);
|
||||
|
||||
query
|
||||
.find()
|
||||
.then(results => {
|
||||
const results = await query.find();
|
||||
expect(results.length).toBe(1);
|
||||
expect(results[0].get('boolKey')).toBe(false);
|
||||
|
||||
@@ -394,14 +359,9 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
});
|
||||
|
||||
expect(myObjectReadPreference).toEqual(ReadPreference.NEAREST);
|
||||
|
||||
done();
|
||||
})
|
||||
.catch(done.fail);
|
||||
});
|
||||
});
|
||||
|
||||
it('should change read preference for GET', done => {
|
||||
it('should change read preference for GET', async () => {
|
||||
const databaseAdapter = Config.get(Parse.applicationId).database.adapter;
|
||||
|
||||
const obj0 = new Parse.Object('MyObject');
|
||||
@@ -409,18 +369,17 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
const obj1 = new Parse.Object('MyObject');
|
||||
obj1.set('boolKey', true);
|
||||
|
||||
Parse.Object.saveAll([obj0, obj1]).then(() => {
|
||||
await Parse.Object.saveAll([obj0, obj1]);
|
||||
spyOn(databaseAdapter.database.serverConfig, 'cursor').and.callThrough();
|
||||
|
||||
Parse.Cloud.beforeFind('MyObject', req => {
|
||||
req.readPreference = 'SECONDARY';
|
||||
});
|
||||
await waitForReplication();
|
||||
|
||||
const query = new Parse.Query('MyObject');
|
||||
|
||||
query
|
||||
.get(obj0.id)
|
||||
.then(result => {
|
||||
const result = await query.get(obj0.id);
|
||||
expect(result.get('boolKey')).toBe(false);
|
||||
|
||||
let myObjectReadPreference = null;
|
||||
@@ -431,14 +390,9 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
});
|
||||
|
||||
expect(myObjectReadPreference).toEqual(ReadPreference.SECONDARY);
|
||||
|
||||
done();
|
||||
})
|
||||
.catch(done.fail);
|
||||
});
|
||||
});
|
||||
|
||||
it('should change read preference for GET using API', done => {
|
||||
it('should change read preference for GET using API', async () => {
|
||||
const databaseAdapter = Config.get(Parse.applicationId).database.adapter;
|
||||
|
||||
const obj0 = new Parse.Object('MyObject');
|
||||
@@ -446,14 +400,15 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
const obj1 = new Parse.Object('MyObject');
|
||||
obj1.set('boolKey', true);
|
||||
|
||||
Parse.Object.saveAll([obj0, obj1]).then(() => {
|
||||
await Parse.Object.saveAll([obj0, obj1]);
|
||||
spyOn(databaseAdapter.database.serverConfig, 'cursor').and.callThrough();
|
||||
|
||||
Parse.Cloud.beforeFind('MyObject', req => {
|
||||
req.readPreference = 'SECONDARY';
|
||||
});
|
||||
await waitForReplication();
|
||||
|
||||
request({
|
||||
const response = await request({
|
||||
method: 'GET',
|
||||
url: 'http://localhost:8378/1/classes/MyObject/' + obj0.id,
|
||||
headers: {
|
||||
@@ -461,8 +416,7 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
'X-Parse-REST-API-Key': 'rest',
|
||||
},
|
||||
json: true,
|
||||
})
|
||||
.then(response => {
|
||||
});
|
||||
const body = response.data;
|
||||
expect(body.boolKey).toBe(false);
|
||||
|
||||
@@ -474,14 +428,9 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
});
|
||||
|
||||
expect(myObjectReadPreference).toEqual(ReadPreference.SECONDARY);
|
||||
|
||||
done();
|
||||
})
|
||||
.catch(done.fail);
|
||||
});
|
||||
});
|
||||
|
||||
it('should change read preference for GET directly from API', done => {
|
||||
it('should change read preference for GET directly from API', async () => {
|
||||
const databaseAdapter = Config.get(Parse.applicationId).database.adapter;
|
||||
|
||||
const obj0 = new Parse.Object('MyObject');
|
||||
@@ -489,10 +438,11 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
const obj1 = new Parse.Object('MyObject');
|
||||
obj1.set('boolKey', true);
|
||||
|
||||
Parse.Object.saveAll([obj0, obj1]).then(() => {
|
||||
await Parse.Object.saveAll([obj0, obj1]);
|
||||
spyOn(databaseAdapter.database.serverConfig, 'cursor').and.callThrough();
|
||||
await waitForReplication();
|
||||
|
||||
request({
|
||||
const response = await request({
|
||||
method: 'GET',
|
||||
url: 'http://localhost:8378/1/classes/MyObject/' + obj0.id + '?readPreference=SECONDARY',
|
||||
headers: {
|
||||
@@ -500,8 +450,7 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
'X-Parse-REST-API-Key': 'rest',
|
||||
},
|
||||
json: true,
|
||||
})
|
||||
.then(response => {
|
||||
});
|
||||
expect(response.data.boolKey).toBe(false);
|
||||
|
||||
let myObjectReadPreference = null;
|
||||
@@ -512,14 +461,9 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
});
|
||||
|
||||
expect(myObjectReadPreference).toEqual(ReadPreference.SECONDARY);
|
||||
|
||||
done();
|
||||
})
|
||||
.catch(done.fail);
|
||||
});
|
||||
});
|
||||
|
||||
it('should change read preference for GET using API through the beforeFind overriding API option', done => {
|
||||
it('should change read preference for GET using API through the beforeFind overriding API option', async () => {
|
||||
const databaseAdapter = Config.get(Parse.applicationId).database.adapter;
|
||||
|
||||
const obj0 = new Parse.Object('MyObject');
|
||||
@@ -527,14 +471,15 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
const obj1 = new Parse.Object('MyObject');
|
||||
obj1.set('boolKey', true);
|
||||
|
||||
Parse.Object.saveAll([obj0, obj1]).then(() => {
|
||||
await Parse.Object.saveAll([obj0, obj1]);
|
||||
spyOn(databaseAdapter.database.serverConfig, 'cursor').and.callThrough();
|
||||
|
||||
Parse.Cloud.beforeFind('MyObject', req => {
|
||||
req.readPreference = 'SECONDARY_PREFERRED';
|
||||
});
|
||||
await waitForReplication();
|
||||
|
||||
request({
|
||||
const response = await request({
|
||||
method: 'GET',
|
||||
url: 'http://localhost:8378/1/classes/MyObject/' + obj0.id + '?readPreference=SECONDARY',
|
||||
headers: {
|
||||
@@ -542,8 +487,7 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
'X-Parse-REST-API-Key': 'rest',
|
||||
},
|
||||
json: true,
|
||||
})
|
||||
.then(response => {
|
||||
});
|
||||
expect(response.data.boolKey).toBe(false);
|
||||
|
||||
let myObjectReadPreference = null;
|
||||
@@ -554,14 +498,9 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
});
|
||||
|
||||
expect(myObjectReadPreference).toEqual(ReadPreference.SECONDARY_PREFERRED);
|
||||
|
||||
done();
|
||||
})
|
||||
.catch(done.fail);
|
||||
});
|
||||
});
|
||||
|
||||
it('should change read preference for FIND using API through beforeFind trigger', done => {
|
||||
it('should change read preference for FIND using API through beforeFind trigger', async () => {
|
||||
const databaseAdapter = Config.get(Parse.applicationId).database.adapter;
|
||||
|
||||
const obj0 = new Parse.Object('MyObject');
|
||||
@@ -569,14 +508,15 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
const obj1 = new Parse.Object('MyObject');
|
||||
obj1.set('boolKey', true);
|
||||
|
||||
Parse.Object.saveAll([obj0, obj1]).then(() => {
|
||||
await Parse.Object.saveAll([obj0, obj1]);
|
||||
spyOn(databaseAdapter.database.serverConfig, 'cursor').and.callThrough();
|
||||
|
||||
Parse.Cloud.beforeFind('MyObject', req => {
|
||||
req.readPreference = 'SECONDARY';
|
||||
});
|
||||
await waitForReplication();
|
||||
|
||||
request({
|
||||
const response = await request({
|
||||
method: 'GET',
|
||||
url: 'http://localhost:8378/1/classes/MyObject/',
|
||||
headers: {
|
||||
@@ -584,8 +524,7 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
'X-Parse-REST-API-Key': 'rest',
|
||||
},
|
||||
json: true,
|
||||
})
|
||||
.then(response => {
|
||||
});
|
||||
expect(response.data.results.length).toEqual(2);
|
||||
|
||||
let myObjectReadPreference = null;
|
||||
@@ -596,14 +535,9 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
});
|
||||
|
||||
expect(myObjectReadPreference).toEqual(ReadPreference.SECONDARY);
|
||||
|
||||
done();
|
||||
})
|
||||
.catch(done.fail);
|
||||
});
|
||||
});
|
||||
|
||||
it('should change read preference for FIND directly from API', done => {
|
||||
it('should change read preference for FIND directly from API', async () => {
|
||||
const databaseAdapter = Config.get(Parse.applicationId).database.adapter;
|
||||
|
||||
const obj0 = new Parse.Object('MyObject');
|
||||
@@ -611,10 +545,11 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
const obj1 = new Parse.Object('MyObject');
|
||||
obj1.set('boolKey', true);
|
||||
|
||||
Parse.Object.saveAll([obj0, obj1]).then(() => {
|
||||
await Parse.Object.saveAll([obj0, obj1]);
|
||||
spyOn(databaseAdapter.database.serverConfig, 'cursor').and.callThrough();
|
||||
await waitForReplication();
|
||||
|
||||
request({
|
||||
const response = await request({
|
||||
method: 'GET',
|
||||
url: 'http://localhost:8378/1/classes/MyObject?readPreference=SECONDARY',
|
||||
headers: {
|
||||
@@ -622,8 +557,7 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
'X-Parse-REST-API-Key': 'rest',
|
||||
},
|
||||
json: true,
|
||||
})
|
||||
.then(response => {
|
||||
});
|
||||
expect(response.data.results.length).toEqual(2);
|
||||
|
||||
let myObjectReadPreference = null;
|
||||
@@ -634,14 +568,9 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
});
|
||||
|
||||
expect(myObjectReadPreference).toEqual(ReadPreference.SECONDARY);
|
||||
|
||||
done();
|
||||
})
|
||||
.catch(done.fail);
|
||||
});
|
||||
});
|
||||
|
||||
it('should change read preference for FIND using API through the beforeFind overriding API option', done => {
|
||||
it('should change read preference for FIND using API through the beforeFind overriding API option', async () => {
|
||||
const databaseAdapter = Config.get(Parse.applicationId).database.adapter;
|
||||
|
||||
const obj0 = new Parse.Object('MyObject');
|
||||
@@ -649,14 +578,15 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
const obj1 = new Parse.Object('MyObject');
|
||||
obj1.set('boolKey', true);
|
||||
|
||||
Parse.Object.saveAll([obj0, obj1]).then(() => {
|
||||
await Parse.Object.saveAll([obj0, obj1]);
|
||||
spyOn(databaseAdapter.database.serverConfig, 'cursor').and.callThrough();
|
||||
|
||||
Parse.Cloud.beforeFind('MyObject', req => {
|
||||
req.readPreference = 'SECONDARY_PREFERRED';
|
||||
});
|
||||
await waitForReplication();
|
||||
|
||||
request({
|
||||
const response = await request({
|
||||
method: 'GET',
|
||||
url: 'http://localhost:8378/1/classes/MyObject/?readPreference=SECONDARY',
|
||||
headers: {
|
||||
@@ -664,8 +594,7 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
'X-Parse-REST-API-Key': 'rest',
|
||||
},
|
||||
json: true,
|
||||
})
|
||||
.then(response => {
|
||||
});
|
||||
expect(response.data.results.length).toEqual(2);
|
||||
|
||||
let myObjectReadPreference = null;
|
||||
@@ -676,11 +605,6 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
});
|
||||
|
||||
expect(myObjectReadPreference).toEqual(ReadPreference.SECONDARY_PREFERRED);
|
||||
|
||||
done();
|
||||
})
|
||||
.catch(done.fail);
|
||||
});
|
||||
});
|
||||
|
||||
xit('should change read preference for count', done => {
|
||||
@@ -732,6 +656,8 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
Parse.Cloud.beforeFind('MyObject', req => {
|
||||
req.readPreference = 'SECONDARY';
|
||||
});
|
||||
await waitForReplication();
|
||||
|
||||
// Spy on DB adapter
|
||||
const databaseAdapter = Config.get(Parse.applicationId).database.adapter;
|
||||
spyOn(databaseAdapter.database.serverConfig, 'startSession').and.callThrough();
|
||||
@@ -756,6 +682,8 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
const obj1 = new Parse.Object('MyObject');
|
||||
obj1.set('boolKey', true);
|
||||
await Parse.Object.saveAll([obj0, obj1]);
|
||||
await waitForReplication();
|
||||
|
||||
// Spy on DB adapter
|
||||
const databaseAdapter = Config.get(Parse.applicationId).database.adapter;
|
||||
spyOn(databaseAdapter.database.serverConfig, 'cursor').and.callThrough();
|
||||
@@ -782,6 +710,8 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
const obj1 = new Parse.Object('MyObject');
|
||||
obj1.set('boolKey', true);
|
||||
await Parse.Object.saveAll([obj0, obj1]);
|
||||
await waitForReplication();
|
||||
|
||||
// Spy on DB adapter
|
||||
const databaseAdapter = Config.get(Parse.applicationId).database.adapter;
|
||||
spyOn(databaseAdapter.database.serverConfig, 'startSession').and.callThrough();
|
||||
@@ -800,7 +730,7 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
expect(readPreference).toEqual(ReadPreference.SECONDARY);
|
||||
});
|
||||
|
||||
it('should find includes in same replica of readPreference by default', done => {
|
||||
it('should find includes in same replica of readPreference by default', async () => {
|
||||
const databaseAdapter = Config.get(Parse.applicationId).database.adapter;
|
||||
|
||||
const obj0 = new Parse.Object('MyObject0');
|
||||
@@ -812,21 +742,20 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
obj2.set('boolKey', false);
|
||||
obj2.set('myObject1', obj1);
|
||||
|
||||
Parse.Object.saveAll([obj0, obj1, obj2]).then(() => {
|
||||
await Parse.Object.saveAll([obj0, obj1, obj2]);
|
||||
spyOn(databaseAdapter.database.serverConfig, 'cursor').and.callThrough();
|
||||
|
||||
Parse.Cloud.beforeFind('MyObject2', req => {
|
||||
req.readPreference = 'SECONDARY';
|
||||
});
|
||||
await waitForReplication();
|
||||
|
||||
const query = new Parse.Query('MyObject2');
|
||||
query.equalTo('boolKey', false);
|
||||
query.include('myObject1');
|
||||
query.include('myObject1.myObject0');
|
||||
|
||||
query
|
||||
.find()
|
||||
.then(results => {
|
||||
const results = await query.find();
|
||||
expect(results.length).toBe(1);
|
||||
const firstResult = results[0];
|
||||
expect(firstResult.get('boolKey')).toBe(false);
|
||||
@@ -851,14 +780,9 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
expect(myObjectReadPreference0).toEqual(ReadPreference.SECONDARY);
|
||||
expect(myObjectReadPreference1).toEqual(ReadPreference.SECONDARY);
|
||||
expect(myObjectReadPreference2).toEqual(ReadPreference.SECONDARY);
|
||||
|
||||
done();
|
||||
})
|
||||
.catch(done.fail);
|
||||
});
|
||||
});
|
||||
|
||||
it('should change includes read preference', done => {
|
||||
it('should change includes read preference', async () => {
|
||||
const databaseAdapter = Config.get(Parse.applicationId).database.adapter;
|
||||
|
||||
const obj0 = new Parse.Object('MyObject0');
|
||||
@@ -870,22 +794,21 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
obj2.set('boolKey', false);
|
||||
obj2.set('myObject1', obj1);
|
||||
|
||||
Parse.Object.saveAll([obj0, obj1, obj2]).then(() => {
|
||||
await Parse.Object.saveAll([obj0, obj1, obj2]);
|
||||
spyOn(databaseAdapter.database.serverConfig, 'cursor').and.callThrough();
|
||||
|
||||
Parse.Cloud.beforeFind('MyObject2', req => {
|
||||
req.readPreference = 'SECONDARY_PREFERRED';
|
||||
req.includeReadPreference = 'SECONDARY';
|
||||
});
|
||||
await waitForReplication();
|
||||
|
||||
const query = new Parse.Query('MyObject2');
|
||||
query.equalTo('boolKey', false);
|
||||
query.include('myObject1');
|
||||
query.include('myObject1.myObject0');
|
||||
|
||||
query
|
||||
.find()
|
||||
.then(results => {
|
||||
const results = await query.find();
|
||||
expect(results.length).toBe(1);
|
||||
const firstResult = results[0];
|
||||
expect(firstResult.get('boolKey')).toBe(false);
|
||||
@@ -910,14 +833,9 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
expect(myObjectReadPreference0).toEqual(ReadPreference.SECONDARY);
|
||||
expect(myObjectReadPreference1).toEqual(ReadPreference.SECONDARY);
|
||||
expect(myObjectReadPreference2).toEqual(ReadPreference.SECONDARY_PREFERRED);
|
||||
|
||||
done();
|
||||
})
|
||||
.catch(done.fail);
|
||||
});
|
||||
});
|
||||
|
||||
it('should change includes read preference when finding through API', done => {
|
||||
it('should change includes read preference when finding through API', async () => {
|
||||
const databaseAdapter = Config.get(Parse.applicationId).database.adapter;
|
||||
|
||||
const obj0 = new Parse.Object('MyObject0');
|
||||
@@ -929,10 +847,11 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
obj2.set('boolKey', false);
|
||||
obj2.set('myObject1', obj1);
|
||||
|
||||
Parse.Object.saveAll([obj0, obj1, obj2]).then(() => {
|
||||
await Parse.Object.saveAll([obj0, obj1, obj2]);
|
||||
spyOn(databaseAdapter.database.serverConfig, 'cursor').and.callThrough();
|
||||
await waitForReplication();
|
||||
|
||||
request({
|
||||
const response = await request({
|
||||
method: 'GET',
|
||||
url:
|
||||
'http://localhost:8378/1/classes/MyObject2/' +
|
||||
@@ -945,8 +864,7 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
'X-Parse-REST-API-Key': 'rest',
|
||||
},
|
||||
json: true,
|
||||
})
|
||||
.then(response => {
|
||||
});
|
||||
const firstResult = response.data;
|
||||
expect(firstResult.boolKey).toBe(false);
|
||||
expect(firstResult.myObject1.boolKey).toBe(true);
|
||||
@@ -970,14 +888,9 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
expect(myObjectReadPreference0).toEqual(ReadPreference.SECONDARY);
|
||||
expect(myObjectReadPreference1).toEqual(ReadPreference.SECONDARY);
|
||||
expect(myObjectReadPreference2).toEqual(ReadPreference.SECONDARY_PREFERRED);
|
||||
|
||||
done();
|
||||
})
|
||||
.catch(done.fail);
|
||||
});
|
||||
});
|
||||
|
||||
it('should change includes read preference when getting through API', done => {
|
||||
it('should change includes read preference when getting through API', async () => {
|
||||
const databaseAdapter = Config.get(Parse.applicationId).database.adapter;
|
||||
|
||||
const obj0 = new Parse.Object('MyObject0');
|
||||
@@ -989,10 +902,11 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
obj2.set('boolKey', false);
|
||||
obj2.set('myObject1', obj1);
|
||||
|
||||
Parse.Object.saveAll([obj0, obj1, obj2]).then(() => {
|
||||
await Parse.Object.saveAll([obj0, obj1, obj2]);
|
||||
spyOn(databaseAdapter.database.serverConfig, 'cursor').and.callThrough();
|
||||
await waitForReplication();
|
||||
|
||||
request({
|
||||
const response = await request({
|
||||
method: 'GET',
|
||||
url:
|
||||
'http://localhost:8378/1/classes/MyObject2?where=' +
|
||||
@@ -1005,8 +919,7 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
'X-Parse-REST-API-Key': 'rest',
|
||||
},
|
||||
json: true,
|
||||
})
|
||||
.then(response => {
|
||||
});
|
||||
expect(response.data.results.length).toBe(1);
|
||||
const firstResult = response.data.results[0];
|
||||
expect(firstResult.boolKey).toBe(false);
|
||||
@@ -1031,14 +944,9 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
expect(myObjectReadPreference0).toEqual(ReadPreference.SECONDARY);
|
||||
expect(myObjectReadPreference1).toEqual(ReadPreference.SECONDARY);
|
||||
expect(myObjectReadPreference2).toEqual(ReadPreference.SECONDARY_PREFERRED);
|
||||
|
||||
done();
|
||||
})
|
||||
.catch(done.fail);
|
||||
});
|
||||
});
|
||||
|
||||
it('should find subqueries in same replica of readPreference by default', done => {
|
||||
it('should find subqueries in same replica of readPreference by default', async () => {
|
||||
const databaseAdapter = Config.get(Parse.applicationId).database.adapter;
|
||||
|
||||
const obj0 = new Parse.Object('MyObject0');
|
||||
@@ -1050,12 +958,13 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
obj2.set('boolKey', false);
|
||||
obj2.set('myObject1', obj1);
|
||||
|
||||
Parse.Object.saveAll([obj0, obj1, obj2]).then(() => {
|
||||
await Parse.Object.saveAll([obj0, obj1, obj2]);
|
||||
spyOn(databaseAdapter.database.serverConfig, 'cursor').and.callThrough();
|
||||
|
||||
Parse.Cloud.beforeFind('MyObject2', req => {
|
||||
req.readPreference = 'SECONDARY';
|
||||
});
|
||||
await waitForReplication();
|
||||
|
||||
const query0 = new Parse.Query('MyObject0');
|
||||
query0.equalTo('boolKey', false);
|
||||
@@ -1066,9 +975,7 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
const query2 = new Parse.Query('MyObject2');
|
||||
query2.matchesQuery('myObject1', query1);
|
||||
|
||||
query2
|
||||
.find()
|
||||
.then(results => {
|
||||
const results = await query2.find();
|
||||
expect(results.length).toBe(1);
|
||||
expect(results[0].get('boolKey')).toBe(false);
|
||||
|
||||
@@ -1090,14 +997,9 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
expect(myObjectReadPreference0).toEqual(ReadPreference.SECONDARY);
|
||||
expect(myObjectReadPreference1).toEqual(ReadPreference.SECONDARY);
|
||||
expect(myObjectReadPreference2).toEqual(ReadPreference.SECONDARY);
|
||||
|
||||
done();
|
||||
})
|
||||
.catch(done.fail);
|
||||
});
|
||||
});
|
||||
|
||||
it('should change subqueries read preference when using matchesQuery', done => {
|
||||
it('should change subqueries read preference when using matchesQuery', async () => {
|
||||
const databaseAdapter = Config.get(Parse.applicationId).database.adapter;
|
||||
|
||||
const obj0 = new Parse.Object('MyObject0');
|
||||
@@ -1109,13 +1011,14 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
obj2.set('boolKey', false);
|
||||
obj2.set('myObject1', obj1);
|
||||
|
||||
Parse.Object.saveAll([obj0, obj1, obj2]).then(() => {
|
||||
await Parse.Object.saveAll([obj0, obj1, obj2]);
|
||||
spyOn(databaseAdapter.database.serverConfig, 'cursor').and.callThrough();
|
||||
|
||||
Parse.Cloud.beforeFind('MyObject2', req => {
|
||||
req.readPreference = 'SECONDARY_PREFERRED';
|
||||
req.subqueryReadPreference = 'SECONDARY';
|
||||
});
|
||||
await waitForReplication();
|
||||
|
||||
const query0 = new Parse.Query('MyObject0');
|
||||
query0.equalTo('boolKey', false);
|
||||
@@ -1126,9 +1029,7 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
const query2 = new Parse.Query('MyObject2');
|
||||
query2.matchesQuery('myObject1', query1);
|
||||
|
||||
query2
|
||||
.find()
|
||||
.then(results => {
|
||||
const results = await query2.find();
|
||||
expect(results.length).toBe(1);
|
||||
expect(results[0].get('boolKey')).toBe(false);
|
||||
|
||||
@@ -1150,14 +1051,9 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
expect(myObjectReadPreference0).toEqual(ReadPreference.SECONDARY);
|
||||
expect(myObjectReadPreference1).toEqual(ReadPreference.SECONDARY);
|
||||
expect(myObjectReadPreference2).toEqual(ReadPreference.SECONDARY_PREFERRED);
|
||||
|
||||
done();
|
||||
})
|
||||
.catch(done.fail);
|
||||
});
|
||||
});
|
||||
|
||||
it('should change subqueries read preference when using doesNotMatchQuery', done => {
|
||||
it('should change subqueries read preference when using doesNotMatchQuery', async () => {
|
||||
const databaseAdapter = Config.get(Parse.applicationId).database.adapter;
|
||||
|
||||
const obj0 = new Parse.Object('MyObject0');
|
||||
@@ -1169,13 +1065,14 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
obj2.set('boolKey', false);
|
||||
obj2.set('myObject1', obj1);
|
||||
|
||||
Parse.Object.saveAll([obj0, obj1, obj2]).then(() => {
|
||||
await Parse.Object.saveAll([obj0, obj1, obj2]);
|
||||
spyOn(databaseAdapter.database.serverConfig, 'cursor').and.callThrough();
|
||||
|
||||
Parse.Cloud.beforeFind('MyObject2', req => {
|
||||
req.readPreference = 'SECONDARY_PREFERRED';
|
||||
req.subqueryReadPreference = 'SECONDARY';
|
||||
});
|
||||
await waitForReplication();
|
||||
|
||||
const query0 = new Parse.Query('MyObject0');
|
||||
query0.equalTo('boolKey', false);
|
||||
@@ -1186,9 +1083,7 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
const query2 = new Parse.Query('MyObject2');
|
||||
query2.doesNotMatchQuery('myObject1', query1);
|
||||
|
||||
query2
|
||||
.find()
|
||||
.then(results => {
|
||||
const results = await query2.find();
|
||||
expect(results.length).toBe(1);
|
||||
expect(results[0].get('boolKey')).toBe(false);
|
||||
|
||||
@@ -1210,14 +1105,9 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
expect(myObjectReadPreference0).toEqual(ReadPreference.SECONDARY);
|
||||
expect(myObjectReadPreference1).toEqual(ReadPreference.SECONDARY);
|
||||
expect(myObjectReadPreference2).toEqual(ReadPreference.SECONDARY_PREFERRED);
|
||||
|
||||
done();
|
||||
})
|
||||
.catch(done.fail);
|
||||
});
|
||||
});
|
||||
|
||||
it('should change subqueries read preference when using matchesKeyInQuery and doesNotMatchKeyInQuery', done => {
|
||||
it('should change subqueries read preference when using matchesKeyInQuery and doesNotMatchKeyInQuery', async () => {
|
||||
const databaseAdapter = Config.get(Parse.applicationId).database.adapter;
|
||||
|
||||
const obj0 = new Parse.Object('MyObject0');
|
||||
@@ -1229,13 +1119,14 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
obj2.set('boolKey', false);
|
||||
obj2.set('myObject1', obj1);
|
||||
|
||||
Parse.Object.saveAll([obj0, obj1, obj2]).then(() => {
|
||||
await Parse.Object.saveAll([obj0, obj1, obj2]);
|
||||
spyOn(databaseAdapter.database.serverConfig, 'cursor').and.callThrough();
|
||||
|
||||
Parse.Cloud.beforeFind('MyObject2', req => {
|
||||
req.readPreference = 'SECONDARY_PREFERRED';
|
||||
req.subqueryReadPreference = 'SECONDARY';
|
||||
});
|
||||
await waitForReplication();
|
||||
|
||||
const query0 = new Parse.Query('MyObject0');
|
||||
query0.equalTo('boolKey', false);
|
||||
@@ -1247,9 +1138,7 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
query2.matchesKeyInQuery('boolKey', 'boolKey', query0);
|
||||
query2.doesNotMatchKeyInQuery('boolKey', 'boolKey', query1);
|
||||
|
||||
query2
|
||||
.find()
|
||||
.then(results => {
|
||||
const results = await query2.find();
|
||||
expect(results.length).toBe(1);
|
||||
expect(results[0].get('boolKey')).toBe(false);
|
||||
|
||||
@@ -1271,14 +1160,9 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
expect(myObjectReadPreference0).toEqual(ReadPreference.SECONDARY);
|
||||
expect(myObjectReadPreference1).toEqual(ReadPreference.SECONDARY);
|
||||
expect(myObjectReadPreference2).toEqual(ReadPreference.SECONDARY_PREFERRED);
|
||||
|
||||
done();
|
||||
})
|
||||
.catch(done.fail);
|
||||
});
|
||||
});
|
||||
|
||||
it('should change subqueries read preference when using matchesKeyInQuery and doesNotMatchKeyInQuery to find through API', done => {
|
||||
it('should change subqueries read preference when using matchesKeyInQuery and doesNotMatchKeyInQuery to find through API', async () => {
|
||||
const databaseAdapter = Config.get(Parse.applicationId).database.adapter;
|
||||
|
||||
const obj0 = new Parse.Object('MyObject0');
|
||||
@@ -1290,8 +1174,9 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
obj2.set('boolKey', false);
|
||||
obj2.set('myObject1', obj1);
|
||||
|
||||
Parse.Object.saveAll([obj0, obj1, obj2]).then(() => {
|
||||
await Parse.Object.saveAll([obj0, obj1, obj2]);
|
||||
spyOn(databaseAdapter.database.serverConfig, 'cursor').and.callThrough();
|
||||
await waitForReplication();
|
||||
|
||||
const whereString = JSON.stringify({
|
||||
boolKey: {
|
||||
@@ -1312,7 +1197,7 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
},
|
||||
});
|
||||
|
||||
request({
|
||||
const response = await request({
|
||||
method: 'GET',
|
||||
url:
|
||||
'http://localhost:8378/1/classes/MyObject2/?where=' +
|
||||
@@ -1323,8 +1208,7 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
'X-Parse-REST-API-Key': 'rest',
|
||||
},
|
||||
json: true,
|
||||
})
|
||||
.then(response => {
|
||||
});
|
||||
expect(response.data.results.length).toBe(1);
|
||||
expect(response.data.results[0].boolKey).toBe(false);
|
||||
|
||||
@@ -1346,10 +1230,5 @@ describe_only_db('mongo')('Read preference option', () => {
|
||||
expect(myObjectReadPreference0).toEqual(ReadPreference.SECONDARY);
|
||||
expect(myObjectReadPreference1).toEqual(ReadPreference.SECONDARY);
|
||||
expect(myObjectReadPreference2).toEqual(ReadPreference.SECONDARY_PREFERRED);
|
||||
|
||||
done();
|
||||
})
|
||||
.catch(done.fail);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user