Skip to content

Commit a649a9e

Browse files
authored
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
1 parent fd3c7fc commit a649a9e

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

spec/RedisCacheAdapter.spec.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -34,20 +34,20 @@ describe_only(() => {
3434
});
3535

3636
it('should expire after ttl', done => {
37-
const cache = new RedisCacheAdapter(null, 50);
37+
const cache = new RedisCacheAdapter(null, 100);
3838

3939
cache
4040
.put(KEY, VALUE)
4141
.then(() => cache.get(KEY))
4242
.then(value => expect(value).toEqual(VALUE))
43-
.then(wait.bind(null, 52))
43+
.then(wait.bind(null, 102))
4444
.then(() => cache.get(KEY))
4545
.then(value => expect(value).toEqual(null))
4646
.then(done);
4747
});
4848

4949
it('should not store value for ttl=0', done => {
50-
const cache = new RedisCacheAdapter(null, 5);
50+
const cache = new RedisCacheAdapter(null, 100);
5151

5252
cache
5353
.put(KEY, VALUE, 0)
@@ -57,20 +57,20 @@ describe_only(() => {
5757
});
5858

5959
it('should not expire when ttl=Infinity', done => {
60-
const cache = new RedisCacheAdapter(null, 1);
60+
const cache = new RedisCacheAdapter(null, 100);
6161

6262
cache
6363
.put(KEY, VALUE, Infinity)
6464
.then(() => cache.get(KEY))
6565
.then(value => expect(value).toEqual(VALUE))
66-
.then(wait.bind(null, 5))
66+
.then(wait.bind(null, 102))
6767
.then(() => cache.get(KEY))
6868
.then(value => expect(value).toEqual(VALUE))
6969
.then(done);
7070
});
7171

7272
it('should fallback to default ttl', done => {
73-
const cache = new RedisCacheAdapter(null, 1);
73+
const cache = new RedisCacheAdapter(null, 100);
7474
let promise = Promise.resolve();
7575

7676
[-100, null, undefined, 'not number', true].forEach(ttl => {
@@ -79,7 +79,7 @@ describe_only(() => {
7979
.put(KEY, VALUE, ttl)
8080
.then(() => cache.get(KEY))
8181
.then(value => expect(value).toEqual(VALUE))
82-
.then(wait.bind(null, 5))
82+
.then(wait.bind(null, 102))
8383
.then(() => cache.get(KEY))
8484
.then(value => expect(value).toEqual(null))
8585
);
@@ -89,7 +89,7 @@ describe_only(() => {
8989
});
9090

9191
it('should find un-expired records', done => {
92-
const cache = new RedisCacheAdapter(null, 5);
92+
const cache = new RedisCacheAdapter(null, 100);
9393

9494
cache
9595
.put(KEY, VALUE)
@@ -102,7 +102,7 @@ describe_only(() => {
102102
});
103103

104104
it('handleShutdown, close connection', async () => {
105-
const cache = new RedisCacheAdapter(null, 5);
105+
const cache = new RedisCacheAdapter(null, 100);
106106

107107
await cache.handleShutdown();
108108
setTimeout(() => {

0 commit comments

Comments
 (0)