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

Log levels incorrect (INFO when they should be DEBUG or TRACE) #1114

Open
5 tasks done
satishautade opened this issue Sep 6, 2023 · 1 comment
Open
5 tasks done
Labels
bug Indicates an unexpected problem or unintended behavior triage This issue is yet to be triaged by a maintainer

Comments

@satishautade
Copy link

satishautade commented Sep 6, 2023

Software versions

  • OS: Mac OSX 13.4.1
  • Consumer Pact library: Pact JS V3 ( "@pact-foundation/pact": "^12.1.0")
  • Provider Pact library: N/A
  • Node Version: v18.14.2

Issue Checklist

Please confirm the following:

  • I have upgraded to the latest
  • I have the read the FAQs in the Readme
  • I have triple checked, that there are no unhandled promises in my code and have read the section on intermittent test failures
  • I have set my log level to debug and attached a log file showing the complete request/response cycle
  • For bonus points and virtual high fives, I have created a reproduceable git repository (see below) to illustrate the problem

Expected behaviour

When the log level is set to INFO, there should NOT be any logs from pact internals/core.
When the log level is set to DEBUG/TRACE, then the logs from pact core should display.

Actual behaviour

When the log level is set to INFO, there are still some logs showing the pact internals which should only show if log level was DEBUG or TRACE.

 ~/Documents/projects/open/pact-bug/ npm test

> [email protected] test
> jest __tests__/ --runInBand


 RUNS  __tests__/simple-example.pact.js
 RUNS  __tests__/simple-example.pact.js
2023-09-06T02:20:00.525252Z  INFO tokio-runtime-worker pact_mock_server::hyper_server: Received request GET /dogs
2023-09-06T02:20:00.526028Z  INFO tokio-runtime-worker pact_matching: comparing to expected HTTP Request ( method: GET, path: /dogs, query: None, headers: Some({"Accept": ["application/json"], "Host": ["localhost"]}), body: Missing )
[12:20:00.532] ERROR (97438): [email protected]: Test failed for the following reasons:

  Mock server failed with the following mismatches:

	0) The following request was incorrect:

            	GET /dogs

 RUNS  __tests__/simple-example.pact.js
2023-09-06T02:20:00.536053Z  INFO tokio-runtime-worker pact_mock_server::hyper_server: Received request GET /cats
2023-09-06T02:20:00.536094Z  INFO tokio-runtime-worker pact_matching: comparing to expected HTTP Request ( method: GET, path: /cats, query: Some({"catId[]": ["1", "1"]}), headers: Some({"Accept": ["application/json"]}), body: Missing )
2023-09-06T02:20:00.537772Z  INFO tokio-runtime-worker pact_mock_server::hyper_server: Request matched, sending response
2023-09-06T02:20:00.540438Z  WARN ThreadId(02) pact_models::pact: Note: Existing pact is an older specification version (V3), and will be upgraded
 FAIL  __tests__/simple-example.pact.jsdId(02) pact_models::content_types: Failed to parse 'application/json, application/json' as a content type: mime parse error: an invalid token was encountered, 2C at position 16
  Dogs API
    ✕ returns a successful body (30 ms)
  Cats API
    ✓ returns a successful body (10 ms)

  ● Dogs API › returns a successful body

Test Suites: 1 failed, 1 total
Tests:       1 failed, 1 passed, 2 total
Snapshots:   0 total
Time:        0.619 s, estimated 1 s

Steps to reproduce

  1. Checkout this test repo : https://github.com/satishautade/pact-bug
  2. Set the log level to INFO and run npm install && npm test
  3. Now set it to DEBUG and run npm install && npm test

Relevant log files

pact-failure-debug-log.log

@satishautade satishautade added bug Indicates an unexpected problem or unintended behavior triage This issue is yet to be triaged by a maintainer labels Sep 6, 2023
@mefellows
Copy link
Member

Thanks for this too!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior triage This issue is yet to be triaged by a maintainer
Projects
Status: New Issue
Development

No branches or pull requests

2 participants