[WIP] Enable test suite to be randomized (#7265)

* initial run

* Update ParseGraphQLServer.spec.js

* temporarily enable reporter

* Bump retry limit

* fix undefined database

* try to catch error

* Handle LiveQueryServers

* Update Config.js

* fast-fail false

* Remove usage of AppCache

* oops

* Update contributing guide

* enable debugger, try network retry attempt 1

* Fix ldap unbinding

* move non specs to support

* add missing mock adapter

* fix Parse.Push

* RestController should match batch.spec.js

* Remove request attempt limit

* handle index.spec.js

* Update CHANGELOG.md

* Handle error: tuple concurrently updated

* test transactions

* Clear RedisCache after every test

* LoggerController.spec.js

* Update schemas.spec.js

* finally fix transactions

* fix geopoint deadlock

* transaction with clean database

* batch.spec.js
This commit is contained in:
Diamond Lewis
2021-03-15 02:04:09 -05:00
committed by GitHub
parent 9563793303
commit 1666c3e382
36 changed files with 688 additions and 700 deletions

View File

@@ -1,6 +1,11 @@
const RedisCacheAdapter = require('../lib/Adapters/Cache/RedisCacheAdapter').default;
const Config = require('../lib/Config');
function wait(sleep) {
return new Promise(function (resolve) {
setTimeout(resolve, sleep);
});
}
/*
To run this test part of the complete suite
set PARSE_SERVER_TEST_CACHE='redis'
@@ -11,31 +16,30 @@ describe_only(() => {
})('RedisCacheAdapter', function () {
const KEY = 'hello';
const VALUE = 'world';
let cache;
function wait(sleep) {
return new Promise(function (resolve) {
setTimeout(resolve, sleep);
});
}
beforeEach(async () => {
cache = new RedisCacheAdapter(null, 100);
await cache.clear();
});
it('should get/set/clear', done => {
const cache = new RedisCacheAdapter({
const cacheNaN = new RedisCacheAdapter({
ttl: NaN,
});
cache
cacheNaN
.put(KEY, VALUE)
.then(() => cache.get(KEY))
.then(() => cacheNaN.get(KEY))
.then(value => expect(value).toEqual(VALUE))
.then(() => cache.clear())
.then(() => cache.get(KEY))
.then(() => cacheNaN.clear())
.then(() => cacheNaN.get(KEY))
.then(value => expect(value).toEqual(null))
.then(() => cacheNaN.clear())
.then(done);
});
it('should expire after ttl', done => {
const cache = new RedisCacheAdapter(null, 100);
cache
.put(KEY, VALUE)
.then(() => cache.get(KEY))
@@ -47,8 +51,6 @@ describe_only(() => {
});
it('should not store value for ttl=0', done => {
const cache = new RedisCacheAdapter(null, 100);
cache
.put(KEY, VALUE, 0)
.then(() => cache.get(KEY))
@@ -57,8 +59,6 @@ describe_only(() => {
});
it('should not expire when ttl=Infinity', done => {
const cache = new RedisCacheAdapter(null, 100);
cache
.put(KEY, VALUE, Infinity)
.then(() => cache.get(KEY))
@@ -70,7 +70,6 @@ describe_only(() => {
});
it('should fallback to default ttl', done => {
const cache = new RedisCacheAdapter(null, 100);
let promise = Promise.resolve();
[-100, null, undefined, 'not number', true].forEach(ttl => {
@@ -89,8 +88,6 @@ describe_only(() => {
});
it('should find un-expired records', done => {
const cache = new RedisCacheAdapter(null, 100);
cache
.put(KEY, VALUE)
.then(() => cache.get(KEY))
@@ -102,8 +99,6 @@ describe_only(() => {
});
it('handleShutdown, close connection', async () => {
const cache = new RedisCacheAdapter(null, 100);
await cache.handleShutdown();
setTimeout(() => {
expect(cache.client.connected).toBe(false);