Advancements with postgres (#2510)

* Start DB runner from tests

* Connect GridstoreAdapter only when needed

* removes unused package

* better test errors reporting

* Adds support for __op.Delete

* Better test error reporting

* Makes sure all tests can run without crashing

* Use xdescribe to skip test suite

* Removes unused dependencies

* Let volatiles classes be created with PG on start

* Do not fail if class dont exist

* adds index.spec.js to the pg suite

* Use a new config each test to prevent side effects

* Enable EmailVerificationToken specs with pg

* Makes sure failure output is not cut

* Reduces number of ignored tests in ParseObject.spec

* Inspect reconfiguration errors

* Mark GlobalConfig is incompatible with PG

- Problem is with nested updates (param.prop = value)

* PG: Nested JSON queries and updates

- Adds support for nested json and . operator queries
- Adds debug support for PG adapter
- Adds loglevel support in helper

* Enable working specs in ParseUser

* Sets default logLevel in tests to undefined

* Adds File type support, retores purchaseValidation specs

* Adds support for updating jsonb objects

- Restores PushController tests

* Proper implementation of deleteByQuery and ORs

- Adds ParseInstallation spec to the test suite

* xit only failing tests

* Nit on ParseAPI spec

* add sorting operator

* properly bound order keys

* reverts describe_only_db behavior

* Enables passing tests

* Adds basic support for relations, upsertOneObject aliased to createObject

* progress on queries options

* Fix ACL update related problems

* Creates relation tables on class creation

* Adds Relation tests

* remove flaky tests

* use promises instead of CB

* disable flaky test

* nits

* Fixes on schema spec

- Next thing is to implemenet geopoint and files correctly

* fix failues

* Basic GeoPoint support

* Adds support for $nearSphere/$maxDistance geopoint queries

* enable passing tests

* drop tables afterEach for PG, clean up relation tables too

* Better initialization/dropTables
This commit is contained in:
Florent Vilmart
2016-08-15 16:48:39 -04:00
committed by GitHub
parent 2f1ee2186b
commit c0249283ac
42 changed files with 1447 additions and 716 deletions

View File

@@ -22,7 +22,7 @@ describe('Installations', () => {
database = config.database;
});
it_exclude_dbs(['postgres'])('creates an android installation with ids', (done) => {
it('creates an android installation with ids', (done) => {
var installId = '12345678-abcd-abcd-abcd-123456789abc';
var device = 'android';
var input = {
@@ -40,7 +40,7 @@ describe('Installations', () => {
}).catch((error) => { console.log(error); });
});
it_exclude_dbs(['postgres'])('creates an ios installation with ids', (done) => {
it('creates an ios installation with ids', (done) => {
var t = '11433856eed2f1285fb3aa11136718c1198ed5647875096952c66bf8cb976306';
var device = 'ios';
var input = {
@@ -58,7 +58,7 @@ describe('Installations', () => {
}).catch((error) => { console.log(error); });
});
it_exclude_dbs(['postgres'])('creates an embedded installation with ids', (done) => {
it('creates an embedded installation with ids', (done) => {
var installId = '12345678-abcd-abcd-abcd-123456789abc';
var device = 'embedded';
var input = {
@@ -76,7 +76,7 @@ describe('Installations', () => {
}).catch((error) => { console.log(error); });
});
it_exclude_dbs(['postgres'])('creates an android installation with all fields', (done) => {
it('creates an android installation with all fields', (done) => {
var installId = '12345678-abcd-abcd-abcd-123456789abc';
var device = 'android';
var input = {
@@ -99,7 +99,7 @@ describe('Installations', () => {
}).catch((error) => { console.log(error); });
});
it_exclude_dbs(['postgres'])('creates an ios installation with all fields', (done) => {
it('creates an ios installation with all fields', (done) => {
var t = '11433856eed2f1285fb3aa11136718c1198ed5647875096952c66bf8cb976306';
var device = 'ios';
var input = {
@@ -143,7 +143,7 @@ describe('Installations', () => {
});
});
it_exclude_dbs(['postgres'])('should properly queying installations with masterKey', (done) => {
it('should properly queying installations with masterKey', (done) => {
var installId = '12345678-abcd-abcd-abcd-123456789abc';
var device = 'android';
var input = {
@@ -197,7 +197,7 @@ describe('Installations', () => {
});
});
it_exclude_dbs(['postgres'])('creates an object with custom fields', (done) => {
it('creates an object with custom fields', (done) => {
var t = '11433856eed2f1285fb3aa11136718c1198ed5647875096952c66bf8cb976306';
var input = {
'deviceToken': t,
@@ -217,7 +217,7 @@ describe('Installations', () => {
// Note: did not port test 'TestObjectIDForIdentifiers'
it_exclude_dbs(['postgres'])('merging when installationId already exists', (done) => {
it('merging when installationId already exists', (done) => {
var installId1 = '12345678-abcd-abcd-abcd-123456789abc';
var t = '11433856eed2f1285fb3aa11136718c1198ed5647875096952c66bf8cb976306';
var installId2 = '12345678-abcd-abcd-abcd-123456789abd';
@@ -250,7 +250,7 @@ describe('Installations', () => {
}).catch((error) => { console.log(error); });
});
it_exclude_dbs(['postgres'])('merging when two objects both only have one id', (done) => {
it('merging when two objects both only have one id', (done) => {
var installId = '12345678-abcd-abcd-abcd-123456789abc';
var t = '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef';
var input1 = {
@@ -290,7 +290,10 @@ describe('Installations', () => {
expect(results.length).toEqual(1);
expect(results[0]['_id']).toEqual(secondObject._id);
done();
}).catch((error) => { console.log(error); });
}).catch((error) => {
jfail(error);
done();
});
});
xit('creating multiple devices with same device token works', (done) => {
@@ -324,7 +327,7 @@ describe('Installations', () => {
}).catch((error) => { console.log(error); });
});
it_exclude_dbs(['postgres'])('updating with new channels', (done) => {
it('updating with new channels', (done) => {
var input = {
installationId: '12345678-abcd-abcd-abcd-123456789abc',
deviceType: 'android',
@@ -347,13 +350,12 @@ describe('Installations', () => {
expect(results[0].channels[0]).toEqual('baz');
done();
}).catch(error => {
console.log(error);
fail();
jfail(error);
done();
});
});
it_exclude_dbs(['postgres'])('update android fails with new installation id', (done) => {
it('update android fails with new installation id', (done) => {
var installId1 = '12345678-abcd-abcd-abcd-123456789abc';
var installId2 = '87654321-abcd-abcd-abcd-123456789abc';
var input = {
@@ -376,7 +378,7 @@ describe('Installations', () => {
});
});
it_exclude_dbs(['postgres'])('update ios fails with new deviceToken and no installationId', (done) => {
it('update ios fails with new deviceToken and no installationId', (done) => {
var a = '11433856eed2f1285fb3aa11136718c1198ed5647875096952c66bf8cb976306';
var b = '91433856eed2f1285fb3aa11136718c1198ed5647875096952c66bf8cb976306';
var input = {
@@ -398,7 +400,7 @@ describe('Installations', () => {
});
});
it_exclude_dbs(['postgres'])('update ios updates device token', (done) => {
it('update ios updates device token', (done) => {
var installId = '12345678-abcd-abcd-abcd-123456789abc';
var t = '11433856eed2f1285fb3aa11136718c1198ed5647875096952c66bf8cb976306';
var u = '91433856eed2f1285fb3aa11136718c1198ed5647875096952c66bf8cb976306';
@@ -424,10 +426,13 @@ describe('Installations', () => {
expect(results.length).toEqual(1);
expect(results[0].deviceToken).toEqual(u);
done();
});
}).catch(err => {
jfail(err);
done();
})
});
it_exclude_dbs(['postgres'])('update fails to change deviceType', (done) => {
it('update fails to change deviceType', (done) => {
var installId = '12345678-abcd-abcd-abcd-123456789abc';
var input = {
'installationId': installId,
@@ -451,7 +456,7 @@ describe('Installations', () => {
});
});
it_exclude_dbs(['postgres'])('update android with custom field', (done) => {
it('update android with custom field', (done) => {
var installId = '12345678-abcd-abcd-abcd-123456789abc';
var input = {
'installationId': installId,
@@ -475,7 +480,7 @@ describe('Installations', () => {
});
});
it_exclude_dbs(['postgres'])('update android device token with duplicate device token', (done) => {
it('update android device token with duplicate device token', (done) => {
var installId1 = '11111111-abcd-abcd-abcd-123456789abc';
var installId2 = '22222222-abcd-abcd-abcd-123456789abc';
var t = '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef';
@@ -514,10 +519,13 @@ describe('Installations', () => {
// The first object should have been deleted
expect(results.length).toEqual(0);
done();
}).catch((error) => { console.log(error); });
}).catch(error => {
jfail(error);
done();
});
});
it_exclude_dbs(['postgres'])('update ios device token with duplicate device token', (done) => {
it('update ios device token with duplicate device token', (done) => {
var installId1 = '11111111-abcd-abcd-abcd-123456789abc';
var installId2 = '22222222-abcd-abcd-abcd-123456789abc';
var t = '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef';
@@ -557,7 +565,10 @@ describe('Installations', () => {
// The first object should have been deleted
expect(results.length).toEqual(0);
done();
}).catch((error) => { console.log(error); });
}).catch(error => {
jfail(error);
done();
});
});
xit('update ios device token with duplicate token different app', (done) => {
@@ -582,10 +593,13 @@ describe('Installations', () => {
expect(results.length).toEqual(1);
expect(results[0].installationId).toEqual(installId2);
done();
}).catch(error => {
jfail(error);
done();
});
});
it_exclude_dbs(['postgres'])('update ios token and channels', (done) => {
it('update ios token and channels', (done) => {
var installId = '12345678-abcd-abcd-abcd-123456789abc';
var t = '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef';
var input = {
@@ -609,10 +623,13 @@ describe('Installations', () => {
expect(results[0].deviceToken).toEqual(t);
expect(results[0].channels.length).toEqual(0);
done();
}).catch(error => {
jfail(error);
done();
});
});
it_exclude_dbs(['postgres'])('update ios linking two existing objects', (done) => {
it('update ios linking two existing objects', (done) => {
var installId = '12345678-abcd-abcd-abcd-123456789abc';
var t = '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef';
var input = {
@@ -644,10 +661,13 @@ describe('Installations', () => {
expect(results[0].deviceToken).toEqual(t);
expect(results[0].deviceType).toEqual('ios');
done();
}).catch(error => {
jfail(error);
done();
});
});
it_exclude_dbs(['postgres'])('update is linking two existing objects w/ increment', (done) => {
it('update is linking two existing objects w/ increment', (done) => {
var installId = '12345678-abcd-abcd-abcd-123456789abc';
var t = '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef';
var input = {
@@ -684,10 +704,13 @@ describe('Installations', () => {
expect(results[0].deviceType).toEqual('ios');
expect(results[0].score).toEqual(1);
done();
}).catch(error => {
jfail(error);
done();
});
});
it_exclude_dbs(['postgres'])('update is linking two existing with installation id', (done) => {
it('update is linking two existing with installation id', (done) => {
var installId = '12345678-abcd-abcd-abcd-123456789abc';
var t = '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef';
var input = {
@@ -724,10 +747,13 @@ describe('Installations', () => {
expect(results[0].installationId).toEqual(installId);
expect(results[0].deviceToken).toEqual(t);
done();
}).catch((error) => { console.log(error); });
}).catch(error => {
jfail(error);
done();
});
});
it_exclude_dbs(['postgres'])('update is linking two existing with installation id w/ op', (done) => {
it('update is linking two existing with installation id w/ op', (done) => {
var installId = '12345678-abcd-abcd-abcd-123456789abc';
var t = '0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef';
var input = {
@@ -769,10 +795,13 @@ describe('Installations', () => {
expect(results[0].deviceToken).toEqual(t);
expect(results[0].score).toEqual(1);
done();
}).catch((error) => { console.log(error); });
}).catch(error => {
jfail(error);
done();
});
});
it_exclude_dbs(['postgres'])('ios merge existing same token no installation id', (done) => {
it('ios merge existing same token no installation id', (done) => {
// Test creating installation when there is an existing object with the
// same device token but no installation ID. This is possible when
// developers import device tokens from another push provider; the import