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

@@ -9,7 +9,7 @@ var express = require('express');
const MongoStorageAdapter = require('../src/Adapters/Storage/Mongo/MongoStorageAdapter');
describe('server', () => {
it_exclude_dbs(['postgres'])('requires a master key and app id', done => {
it('requires a master key and app id', done => {
reconfigureServer({ appId: undefined })
.catch(error => {
expect(error).toEqual('You must provide an appId!');
@@ -25,7 +25,7 @@ describe('server', () => {
});
});
it_exclude_dbs(['postgres'])('support http basic authentication with masterkey', done => {
it('support http basic authentication with masterkey', done => {
request.get({
url: 'http://localhost:8378/1/classes/TestObject',
headers: {
@@ -37,7 +37,7 @@ describe('server', () => {
});
});
it_exclude_dbs(['postgres'])('support http basic authentication with javascriptKey', done => {
it('support http basic authentication with javascriptKey', done => {
request.get({
url: 'http://localhost:8378/1/classes/TestObject',
headers: {
@@ -49,7 +49,7 @@ describe('server', () => {
});
});
it_exclude_dbs(['postgres'])('fails if database is unreachable', done => {
it('fails if database is unreachable', done => {
reconfigureServer({ databaseAdapter: new MongoStorageAdapter({ uri: 'mongodb://fake:fake@localhost:43605/drew3' }) })
.catch(() => {
//Need to use rest api because saving via JS SDK results in fail() not getting called
@@ -70,7 +70,7 @@ describe('server', () => {
});
});
it_exclude_dbs(['postgres'])('can load email adapter via object', done => {
it('can load email adapter via object', done => {
reconfigureServer({
appName: 'unused',
verifyUserEmails: true,
@@ -83,7 +83,7 @@ describe('server', () => {
}).then(done, fail);
});
it_exclude_dbs(['postgres'])('can load email adapter via class', done => {
it('can load email adapter via class', done => {
reconfigureServer({
appName: 'unused',
verifyUserEmails: true,
@@ -99,7 +99,7 @@ describe('server', () => {
}).then(done, fail);
});
it_exclude_dbs(['postgres'])('can load email adapter via module name', done => {
it('can load email adapter via module name', done => {
reconfigureServer({
appName: 'unused',
verifyUserEmails: true,
@@ -115,7 +115,7 @@ describe('server', () => {
}).then(done, fail);
});
it_exclude_dbs(['postgres'])('can load email adapter via only module name', done => {
it('can load email adapter via only module name', done => {
reconfigureServer({
appName: 'unused',
verifyUserEmails: true,
@@ -128,7 +128,7 @@ describe('server', () => {
});
});
it_exclude_dbs(['postgres'])('throws if you initialize email adapter incorrecly', done => {
it('throws if you initialize email adapter incorrecly', done => {
reconfigureServer({
appName: 'unused',
verifyUserEmails: true,
@@ -146,7 +146,7 @@ describe('server', () => {
});
});
it_exclude_dbs(['postgres'])('can report the server version', done => {
it('can report the server version', done => {
request.get({
url: 'http://localhost:8378/1/serverInfo',
headers: {
@@ -160,7 +160,7 @@ describe('server', () => {
})
});
it_exclude_dbs(['postgres'])('can create a parse-server v1', done => {
it('can create a parse-server v1', done => {
var parseServer = new ParseServer.default(Object.assign({},
defaultConfiguration, {
appId: "aTestApp",
@@ -191,7 +191,7 @@ describe('server', () => {
);
});
it_exclude_dbs(['postgres'])('can create a parse-server v2', done => {
it('can create a parse-server v2', done => {
let objId;
let server
let parseServer = ParseServer.ParseServer(Object.assign({},
@@ -221,13 +221,17 @@ describe('server', () => {
})
.catch(error => {
fail(JSON.stringify(error))
done();
if (server) {
server.close(done);
} else {
done();
}
});
}}
));
});
it_exclude_dbs(['postgres'])('has createLiveQueryServer', done => {
it('has createLiveQueryServer', done => {
// original implementation through the factory
expect(typeof ParseServer.ParseServer.createLiveQueryServer).toEqual('function');
// For import calls
@@ -235,7 +239,7 @@ describe('server', () => {
done();
});
it_exclude_dbs(['postgres'])('exposes correct adapters', done => {
it('exposes correct adapters', done => {
expect(ParseServer.S3Adapter).toThrow();
expect(ParseServer.GCSAdapter).toThrow('GCSAdapter is not provided by parse-server anymore; please install parse-server-gcs-adapter');
expect(ParseServer.FileSystemAdapter).toThrow();
@@ -243,7 +247,7 @@ describe('server', () => {
done();
});
it_exclude_dbs(['postgres'])('properly gives publicServerURL when set', done => {
it('properly gives publicServerURL when set', done => {
reconfigureServer({ publicServerURL: 'https://myserver.com/1' })
.then(() => {
var config = new Config('test', 'http://localhost:8378/1');
@@ -252,7 +256,7 @@ describe('server', () => {
});
});
it_exclude_dbs(['postgres'])('properly removes trailing slash in mount', done => {
it('properly removes trailing slash in mount', done => {
reconfigureServer({})
.then(() => {
var config = new Config('test', 'http://localhost:8378/1/');
@@ -261,7 +265,7 @@ describe('server', () => {
});
});
it_exclude_dbs(['postgres'])('should throw when getting invalid mount', done => {
it('should throw when getting invalid mount', done => {
reconfigureServer({ publicServerURL: 'blabla:/some' })
.catch(error => {
expect(error).toEqual('publicServerURL should be a valid HTTPS URL starting with https://')
@@ -269,7 +273,7 @@ describe('server', () => {
})
});
it_exclude_dbs(['postgres'])('fails if the session length is not a number', done => {
it('fails if the session length is not a number', done => {
reconfigureServer({ sessionLength: 'test' })
.catch(error => {
expect(error).toEqual('Session length must be a valid number.');
@@ -277,7 +281,7 @@ describe('server', () => {
});
});
it_exclude_dbs(['postgres'])('fails if the session length is less than or equal to 0', done => {
it('fails if the session length is less than or equal to 0', done => {
reconfigureServer({ sessionLength: '-33' })
.catch(error => {
expect(error).toEqual('Session length must be a value greater than 0.');
@@ -289,7 +293,7 @@ describe('server', () => {
});
});
it_exclude_dbs(['postgres'])('ignores the session length when expireInactiveSessions set to false', (done) => {
it('ignores the session length when expireInactiveSessions set to false', (done) => {
reconfigureServer({
sessionLength: '-33',
expireInactiveSessions: false
@@ -301,7 +305,7 @@ describe('server', () => {
.then(done);
})
it_exclude_dbs(['postgres'])('fails if you try to set revokeSessionOnPasswordReset to non-boolean', done => {
it('fails if you try to set revokeSessionOnPasswordReset to non-boolean', done => {
reconfigureServer({ revokeSessionOnPasswordReset: 'non-bool' })
.catch(done);
});