From a649a9e6008f8109508d466be563222b927a0b08 Mon Sep 17 00:00:00 2001 From: Antonio Davi Macedo Coelho de Castro Date: Sat, 20 Feb 2021 11:32:55 -0800 Subject: [PATCH] Fix flaky test4 (#7212) * Increase timeout for redis tests * Remove for * Increase little bit more one of the tests since it requires two calls to be done in time-fahsion way * increase default ttl a bit more --- spec/RedisCacheAdapter.spec.js | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/spec/RedisCacheAdapter.spec.js b/spec/RedisCacheAdapter.spec.js index 4991d2b9..ac5c209c 100644 --- a/spec/RedisCacheAdapter.spec.js +++ b/spec/RedisCacheAdapter.spec.js @@ -34,20 +34,20 @@ describe_only(() => { }); it('should expire after ttl', done => { - const cache = new RedisCacheAdapter(null, 50); + const cache = new RedisCacheAdapter(null, 100); cache .put(KEY, VALUE) .then(() => cache.get(KEY)) .then(value => expect(value).toEqual(VALUE)) - .then(wait.bind(null, 52)) + .then(wait.bind(null, 102)) .then(() => cache.get(KEY)) .then(value => expect(value).toEqual(null)) .then(done); }); it('should not store value for ttl=0', done => { - const cache = new RedisCacheAdapter(null, 5); + const cache = new RedisCacheAdapter(null, 100); cache .put(KEY, VALUE, 0) @@ -57,20 +57,20 @@ describe_only(() => { }); it('should not expire when ttl=Infinity', done => { - const cache = new RedisCacheAdapter(null, 1); + const cache = new RedisCacheAdapter(null, 100); cache .put(KEY, VALUE, Infinity) .then(() => cache.get(KEY)) .then(value => expect(value).toEqual(VALUE)) - .then(wait.bind(null, 5)) + .then(wait.bind(null, 102)) .then(() => cache.get(KEY)) .then(value => expect(value).toEqual(VALUE)) .then(done); }); it('should fallback to default ttl', done => { - const cache = new RedisCacheAdapter(null, 1); + const cache = new RedisCacheAdapter(null, 100); let promise = Promise.resolve(); [-100, null, undefined, 'not number', true].forEach(ttl => { @@ -79,7 +79,7 @@ describe_only(() => { .put(KEY, VALUE, ttl) .then(() => cache.get(KEY)) .then(value => expect(value).toEqual(VALUE)) - .then(wait.bind(null, 5)) + .then(wait.bind(null, 102)) .then(() => cache.get(KEY)) .then(value => expect(value).toEqual(null)) ); @@ -89,7 +89,7 @@ describe_only(() => { }); it('should find un-expired records', done => { - const cache = new RedisCacheAdapter(null, 5); + const cache = new RedisCacheAdapter(null, 100); cache .put(KEY, VALUE) @@ -102,7 +102,7 @@ describe_only(() => { }); it('handleShutdown, close connection', async () => { - const cache = new RedisCacheAdapter(null, 5); + const cache = new RedisCacheAdapter(null, 100); await cache.handleShutdown(); setTimeout(() => {