Skip to content

Commit

Permalink
fix(clients): reduce common tests flakyness (#3205)
Browse files Browse the repository at this point in the history
  • Loading branch information
millotp authored Jun 18, 2024
1 parent b2b7cd2 commit 9ad5c8c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ describe('createIterablePromise', () => {
await expect(promise).resolves.toEqual('success #2');

expect(Date.now() - before).toBeGreaterThanOrEqual(0);
expect(Date.now() - before).toBeLessThanOrEqual(10);
expect(Date.now() - before).toBeLessThanOrEqual(20);
expect(calls).toBe(2);
});

Expand All @@ -133,7 +133,7 @@ describe('createIterablePromise', () => {
await expect(promise).resolves.toEqual('success #2');

expect(Date.now() - before).toBeGreaterThanOrEqual(2000);
expect(Date.now() - before).toBeLessThanOrEqual(2010);
expect(Date.now() - before).toBeLessThanOrEqual(2020);
expect(calls).toBe(2);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ describe('timeout handling', () => {
const response = await requester.send({
...timeoutRequest,
connectTimeout: 1000,
url: 'http://localhost:1111/connection_timeout',
url: 'http://localhost:1113/connection_timeout',
});

const now = Date.now();
Expand All @@ -145,7 +145,7 @@ describe('timeout handling', () => {
const response = await requester.send({
...timeoutRequest,
connectTimeout: 2000,
url: 'http://localhost:1111/connection_timeout',
url: 'http://localhost:1113/connection_timeout',
});

const now = Date.now();
Expand All @@ -161,7 +161,7 @@ describe('timeout handling', () => {
const response = await requester.send({
...timeoutRequest,
responseTimeout: 2000,
url: 'http://localhost:1111',
url: 'http://localhost:1113',
});

const now = Date.now();
Expand All @@ -176,7 +176,7 @@ describe('timeout handling', () => {
const response = await requester.send({
...timeoutRequest,
responseTimeout: 3000,
url: 'http://localhost:1111',
url: 'http://localhost:1113',
});

const now = Date.now();
Expand All @@ -190,7 +190,7 @@ describe('timeout handling', () => {
const before = Date.now();
const response = await requester.send({
...requestStub,
url: 'http://localhost:1111',
url: 'http://localhost:1113',
responseTimeout: 6000,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ describe('timeout handling', () => {
const response = await requester.send({
...timeoutRequest,
connectTimeout: 1000,
url: 'http://localhost:1111/connection_timeout',
url: 'http://localhost:1112/connection_timeout',
});

const now = Date.now();
Expand All @@ -201,7 +201,7 @@ describe('timeout handling', () => {
const response = await requester.send({
...timeoutRequest,
connectTimeout: 2000,
url: 'http://localhost:1111/connection_timeout',
url: 'http://localhost:1112/connection_timeout',
});

const now = Date.now();
Expand All @@ -217,7 +217,7 @@ describe('timeout handling', () => {
const response = await requester.send({
...timeoutRequest,
responseTimeout: 2000,
url: 'http://localhost:1111',
url: 'http://localhost:1112',
});

const now = Date.now();
Expand All @@ -232,7 +232,7 @@ describe('timeout handling', () => {
const response = await requester.send({
...timeoutRequest,
responseTimeout: 3000,
url: 'http://localhost:1111',
url: 'http://localhost:1112',
});

const now = Date.now();
Expand All @@ -246,7 +246,7 @@ describe('timeout handling', () => {
const before = Date.now();
const response = await requester.send({
...requestStub,
url: 'http://localhost:1111',
url: 'http://localhost:1112',
responseTimeout: 6000,
});

Expand Down

1 comment on commit 9ad5c8c

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.