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] Investigate console warnings in get_local_stats.test.ts #556

Open
ananzh opened this issue Jun 25, 2021 · 0 comments
Open

[Test] Investigate console warnings in get_local_stats.test.ts #556

ananzh opened this issue Jun 25, 2021 · 0 comments
Labels
good first issue Good for newcomers technical debt If not paid, jeapardizes long-term success and maintainability of the repository. test:unit

Comments

@ananzh
Copy link
Member

ananzh commented Jun 25, 2021

Describe the issue

Currently, get_local_stats.test.ts prints out console warnings when run the unit test. To make a clean unit test, we want to explore the reasons for these errors/warnings and decide whether we could fix or remove them.

  console.warn
    No OpenSearchDashboards stats returned from usage collectors

      60 | ) {
      61 |   if (!response) {
    > 62 |     logger.warn('No OpenSearchDashboards stats returned from usage collectors');
         |            ^
      63 |     return;
      64 |   }
      65 |   const {

      at handleOpenSearchDashboardsStats (src/plugins/telemetry/server/telemetry_collection/get_opensearch_dashboards.ts:62:12)
      at handleLocalStats (src/plugins/telemetry/server/telemetry_collection/get_local_stats.ts:73:30)
      at Object.it (src/plugins/telemetry/server/telemetry_collection/get_local_stats.test.ts:199:22)

  console.warn
    No OpenSearchDashboards stats returned from usage collectors

      60 | ) {
      61 |   if (!response) {
    > 62 |     logger.warn('No OpenSearchDashboards stats returned from usage collectors');
         |            ^
      63 |     return;
      64 |   }
      65 |   const {

      at handleOpenSearchDashboardsStats (src/plugins/telemetry/server/telemetry_collection/get_opensearch_dashboards.ts:62:12)
      at handleLocalStats (src/plugins/telemetry/server/telemetry_collection/get_local_stats.ts:73:30)
      at Object.it (src/plugins/telemetry/server/telemetry_collection/get_local_stats.test.ts:216:22)


To Reproduce
Run:yarn test:jest {path to get_local_stats.test.ts}

Tasks

I think the logger warning is being called as expected, indicating that the code is handling some specific case. The fact that the logger is outputting a warning is not a problem in itself, as long as it's the expected behavior in this specific test case. But it's essential to understand the context of the test and the purpose of the warning message. If the test is designed to check the handling of missing OpenSearchDashboards stats, then this warning message is expected and normal.

To sum up, this is a good research task to help us understand the testing context and make sure there is no issue to see logger warning. To close the issue, pls answer:

  • What does this test test about? What is the purpose of the warning message?
  • Is it expected to see logger warning? If yes, close the issue.
  • If no, please comment in the issue and raise a PR.
@tmarkley tmarkley added the technical debt If not paid, jeapardizes long-term success and maintainability of the repository. label May 25, 2022
@ananzh ananzh added the good first issue Good for newcomers label Apr 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers technical debt If not paid, jeapardizes long-term success and maintainability of the repository. test:unit
Projects
None yet
Development

No branches or pull requests

2 participants