Improve single schema cache (#7214)
* Initial Commit * fix flaky test * temporary set ci timeout * turn off ci check * fix postgres tests * fix tests * node flaky test * remove improvements * Update SchemaPerformance.spec.js * fix tests * revert ci * Create Singleton Object * properly clear cache testing * Cleanup * remove fit * try PushController.spec * try push test rewrite * try push enqueue time * Increase test timeout * remove pg server creation test * xit push tests * more xit * remove skipped tests * Fix conflicts * reduce ci timeout * fix push tests * Revert "fix push tests" This reverts commit 05aba62f1cbbca7d5d3e80b9444529f59407cb56. * improve initialization * fix flaky tests * xit flaky test * Update CHANGELOG.md * enable debug logs * Update LogsRouter.spec.js * create initial indexes in series * lint * horizontal scaling documentation * Update Changelog * change horizontalScaling db option * Add enableSchemaHooks option * move enableSchemaHooks to databaseOptions
This commit is contained in:
@@ -18,6 +18,7 @@ const fakeClient = {
|
||||
describe_only_db('mongo')('MongoStorageAdapter', () => {
|
||||
beforeEach(done => {
|
||||
new MongoStorageAdapter({ uri: databaseURI }).deleteAllClasses().then(done, fail);
|
||||
Config.get(Parse.applicationId).schemaCache.clear();
|
||||
});
|
||||
|
||||
it('auto-escapes symbols in auth information', () => {
|
||||
@@ -314,6 +315,8 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
|
||||
await user.signUp();
|
||||
|
||||
const database = Config.get(Parse.applicationId).database;
|
||||
await database.adapter.dropAllIndexes('_User');
|
||||
|
||||
const preIndexPlan = await database.find(
|
||||
'_User',
|
||||
{ username: 'bugs' },
|
||||
@@ -546,5 +549,33 @@ describe_only_db('mongo')('MongoStorageAdapter', () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('watch _SCHEMA', () => {
|
||||
it('should change', async done => {
|
||||
const adapter = new MongoStorageAdapter({
|
||||
uri: databaseURI,
|
||||
collectionPrefix: '',
|
||||
mongoOptions: { enableSchemaHooks: true },
|
||||
});
|
||||
await reconfigureServer({ databaseAdapter: adapter });
|
||||
expect(adapter.enableSchemaHooks).toBe(true);
|
||||
spyOn(adapter, '_onchange');
|
||||
const schema = {
|
||||
fields: {
|
||||
array: { type: 'Array' },
|
||||
object: { type: 'Object' },
|
||||
date: { type: 'Date' },
|
||||
},
|
||||
};
|
||||
|
||||
await adapter.createClass('Stuff', schema);
|
||||
const myClassSchema = await adapter.getClass('Stuff');
|
||||
expect(myClassSchema).toBeDefined();
|
||||
setTimeout(() => {
|
||||
expect(adapter._onchange).toHaveBeenCalled();
|
||||
done();
|
||||
}, 5000);
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user