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

Fixed Slowlogs local unit test #1462

Merged
merged 2 commits into from
Sep 11, 2023
Merged

Fixed Slowlogs local unit test #1462

merged 2 commits into from
Sep 11, 2023

Conversation

luiztiago
Copy link
Contributor

Description

Fixed Slowlogs test running on the local environment

Summary of all failing tests
 FAIL  __tests__/bin/vip-slowlogs.js
  ● getSlowlogs › should display the slowlogs in the output

    expect(jest.fn()).toHaveBeenCalledWith(...expected)

    Expected: "┌────────────────────────────────┬───────────┬───────────────┬────────────┬─────────────────────┬────────────────────────┐
    │ timestamp                      │ rows sent │ rows examined │ query time │ request uri         │ query                  │
    ├────────────────────────────────┼───────────┼───────────────┼────────────┼─────────────────────┼────────────────────────┤
    │ 2021-11-05T20:18:36.234041811Z │ 1         │ 1             │ 0.1        │ dashboard.wpvip.com │ SELECT * FROM wp_posts │
    ├────────────────────────────────┼───────────┼───────────────┼────────────┼─────────────────────┼────────────────────────┤
    │ 2021-11-09T20:47:07.301221112Z │ 1         │ 1             │ 0.1        │ dashboard.wpvip.com │ SELECT * FROM wp_posts │
    └────────────────────────────────┴───────────┴───────────────┴────────────┴─────────────────────┴────────────────────────┘"
    Received: "┌────────────────────────────────┬───────────┬───────────────┬────────────┬─────────────────────┬────────────────────────┐
    │ timestamp                      │ rows sent │ rows examined │ query time │ request uri         │ query                  │
    ├────────────────────────────────┼───────────┼───────────────┼────────────┼─────────────────────┼────────────────────────┤
    │ 2021-11-05T20:18:36.234041811Z │ 1         │ 1             │ 0.1        │ dashboard.wpvip.com │ SELECT * FROM wp_posts │
    ├────────────────────────────────┼───────────┼───────────────┼────────────┼─────────────────────┼────────────────────────┤
    │ 2021-11-09T20:47:07.301221112Z │ 1         │ 1             │ 0.1        │ dashboard.wpvip.com │ SELECT * FROM wp_posts │
    └────────────────────────────────┴───────────┴───────────────┴────────────┴─────────────────────┴────────────────────────┘"

    Number of calls: 1

      85 |
      86 | 		expect( console.log ).toHaveBeenCalledTimes( 1 );
    > 87 | 		expect( console.log ).toHaveBeenCalledWith(
         | 		                      ^
      88 | 			'┌────────────────────────────────┬───────────┬───────────────┬────────────┬─────────────────────┬────────────────────────┐\n' +
      89 | 				'│ timestamp                      │ rows sent │ rows examined │ query time │ request uri         │ query                  │\n' +
      90 | 				'├────────────────────────────────┼───────────┼───────────────┼────────────┼─────────────────────┼────────────────────────┤\n' +

      at Object.toHaveBeenCalledWith (__tests__/bin/vip-slowlogs.js:87:25)

Steps to Test

  1. Check out PR.
  2. Run npm run build and npm link
  3. Run node ./dist/bin/vip @SITE_ID.production slowlogs
  4. Verify list of slowlogs or "No logs found" if don't have any slowlogs to be listed

Copy link
Contributor

@saroshaga saroshaga left a comment

Choose a reason for hiding this comment

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

It's a bummer that it's not allowing us to test the entire table. Not sure what's going on either. Maybe it's this?

Nevertheless, thanks for the fix!

@sjinks sjinks merged commit a580636 into trunk Sep 11, 2023
@sjinks sjinks deleted the fix/slowlogs-local-test branch September 11, 2023 09:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants