Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: use consistent timeouts #42893

Closed

Conversation

ShogunPanda
Copy link
Contributor

This PR enforces consistent timeouts for HTTP tests.

@nodejs-github-bot nodejs-github-bot added needs-ci PRs that need a full CI run. test Issues and PRs related to the tests. labels Apr 28, 2022
@ShogunPanda
Copy link
Contributor Author

ShogunPanda commented Apr 28, 2022

CC: @nodejs/http

@richardlau richardlau added the request-ci Add this label to start a Jenkins CI on a PR. label Apr 28, 2022
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Apr 28, 2022
@nodejs-github-bot
Copy link
Collaborator

@nodejs-github-bot
Copy link
Collaborator

@@ -0,0 +1,133 @@
'use strict';
Copy link
Member

Choose a reason for hiding this comment

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

Relying on timers is the most frequent source of flakiness in tests. Apart from doing it concurrently with multiple requests, does this test tests something not already tested in existing tests?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I know, timers are messy. But unfortunately this test is about testing timers. :(

Yes, it checks that the concurrent checking of requestTimeout and headersTimeout works properly.

Copy link
Member

Choose a reason for hiding this comment

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

My point is, are requestTimeout and headersTimeout already tested with a single request? If so what makes this test special? Why wouldn't the options work with multiple concurrent request if they work with a single one?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Well, they should, but I thought adding a more complex "real world like" scenario would have helped for future regression testing.

Copy link
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

Co-authored-by: Luigi Pinca <[email protected]>
@ShogunPanda
Copy link
Contributor Author

@lpinca Are we good on this PR? Can we land it?

@lpinca
Copy link
Member

lpinca commented May 3, 2022

I have no objections.

@ShogunPanda
Copy link
Contributor Author

@lpinca Do you mind leaving the second approval so I can proceed?

@nodejs-github-bot
Copy link
Collaborator

ShogunPanda added a commit that referenced this pull request May 3, 2022
PR-URL: #42893
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Co-authored-by: Luigi Pinca <[email protected]>
@ShogunPanda
Copy link
Contributor Author

Landed in c3aa86d

@ShogunPanda ShogunPanda closed this May 3, 2022
@ShogunPanda ShogunPanda deleted the http-test-timeouts-consistency branch May 3, 2022 13:23
RafaelGSS pushed a commit that referenced this pull request May 10, 2022
PR-URL: #42893
Reviewed-By: Matteo Collina <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Co-authored-by: Luigi Pinca <[email protected]>
@juanarbol
Copy link
Member

Sadly, a test seems to be break ( test/parallel/test-http-server-request-timeouts-mixed.js) in V16.x:

$ ./node test/parallel/test-http-server-request-timeouts-mixed.js
node:assert:123
  throw new AssertionError(obj);
  ^

AssertionError [ERR_ASSERTION]: Expected values to be strictly equal:

60000 !== 2000

    at Object.<anonymous> (/home/juanarbol/GitHub/node/test/parallel/test-http-server-request-timeouts-mixed.js:34:8)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:77:12)
    at node:internal/main/run_main_module:17:47 {
  generatedMessage: true,
  code: 'ERR_ASSERTION',
  actual: 60000,
  expected: 2000,
  operator: 'strictEqual'
**}**

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-ci PRs that need a full CI run. test Issues and PRs related to the tests.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants