Skip to content

web: mute Polly.js error logging on CI

Warren Gifford requested to merge vb/mute-polly-errors into main

Created by: valerybugakov

Context

Removing logs from Polly.js to unclutter out integration test logs.

Details

  1. We mock GraphQL request responses in integration tests.
  2. If a request is initiated and there's no mock for it, we throw an error.
  3. Some GraphQL API requests initiated by the page are not required for an integration test to pass. (e.g., they do not critically affect the UI checked by the test)
  4. If they are initiated after an integration test has already passed, the missing-mock error won't affect the test status. But it will be logged into the integration test output by Polly.js.
  5. Polly.js logging: false does not work correctly on our current Polly.js version. That's why these errors are visible in the output.
  6. Upgrading Polly.js to the next major version where this issue is fixed is not feasible because the scope of the task is too big, and we need to do it separately.
  7. Some console methods were patched in this PR to remove Polly.js logs.
  8. These logs are removed on CI only to keep all the information available for local development. See why it's important in the next section.

Ideally, we want all GraphQL requests used by the page opened during the integration test to be mocked. But there's no way to enforce this rule with the existing driver implementation. We will be able to address this issue fully next quarter when we will look at our integration tests fundamentals.

Before After
Screen Shot 2022-07-08 at 16 06 29 Screen Shot 2022-07-08 at 16 06 43

Partially addresses https://github.com/sourcegraph/sourcegraph/issues/37666. Follow up that closes the issue https://github.com/sourcegraph/sourcegraph/pull/38470.

Flaky missing GraphQL overrides

  1. Sometimes, GraphQL requests not affecting integration test execution are initiated after the test is passed.
  2. Sometimes, they do not. That's when a missing-mock error will cause the test to fail.
  3. Boom, we got a flake!
  4. To debug it locally, we need to inspect missing-mock errors thrown after test completion, so preserving all logs locally is helpful.

Test plan

  1. Ensure that there are no GraphQL query "XXX" has no configured mock response errors in integration tests output on CI.
  2. See some log examples here.

App preview:

Check out the client app preview documentation to learn more.

Merge request reports

Loading