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

disttask: replace manually mock with gomock #46392

Merged
merged 7 commits into from
Aug 25, 2023
Merged

disttask: replace manually mock with gomock #46392

merged 7 commits into from
Aug 25, 2023

Conversation

D3Hunter
Copy link
Contributor

@D3Hunter D3Hunter commented Aug 24, 2023

What problem does this PR solve?

Issue Number: ref #41495

Problem Summary:
replace manually mock with mock generated by gomock.

Note: do make gen_mock after any of the mocked interface changed

What is changed and how it works?

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

Please refer to Release Notes Language Style Guide to write a quality release note.

None

@ti-chi-bot ti-chi-bot bot added release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Aug 24, 2023
@tiprow
Copy link

tiprow bot commented Aug 24, 2023

Hi @D3Hunter. Thanks for your PR.

PRs from untrusted users cannot be marked as trusted with /ok-to-test in this repo meaning untrusted PR authors can never trigger tests themselves. Collaborators can still trigger tests on the PR using /test all.

I understand the commands that are listed here.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@D3Hunter
Copy link
Contributor Author

/ok-to-test

1 similar comment
@D3Hunter
Copy link
Contributor Author

/ok-to-test

@ti-chi-bot ti-chi-bot bot added the ok-to-test Indicates a PR is ready to be tested. label Aug 24, 2023
@codecov
Copy link

codecov bot commented Aug 24, 2023

Codecov Report

Merging #46392 (094227f) into master (9b7c1e2) will decrease coverage by 0.5669%.
Report is 5 commits behind head on master.
The diff coverage is 100.0000%.

Additional details and impacted files
@@               Coverage Diff                @@
##             master     #46392        +/-   ##
================================================
- Coverage   73.3944%   72.8275%   -0.5669%     
================================================
  Files          1295       1316        +21     
  Lines        393594     400659      +7065     
================================================
+ Hits         288876     291790      +2914     
- Misses        86351      90454      +4103     
- Partials      18367      18415        +48     
Flag Coverage Δ
integration 25.7701% <ø> (?)
unit 73.5065% <100.0000%> (+0.1121%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
dumpling 54.0444% <ø> (ø)
parser 85.0633% <ø> (ø)
br 48.0112% <ø> (-4.3144%) ⬇️

var wg sync.WaitGroup
var taskCount int
runFn := func(f func()) error {
taskCount++
Copy link
Contributor

Choose a reason for hiding this comment

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

seems useless?

mockPool.AssertExpectations(t)
m.onRunnableTasks(context.Background(), []*proto.Task{task})

wg.Wait()
}

func TestManager(t *testing.T) {
// TODO(gmhdbjd): use real subtask table instead of mock
Copy link
Contributor

Choose a reason for hiding this comment

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

remove the todo?

)

func getPoolRunFn() (*sync.WaitGroup, func(f func()) error) {
wg := &sync.WaitGroup{}
Copy link
Member

Choose a reason for hiding this comment

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

use util.WaitGroupWrapper ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

no,current is enough

Copy link
Contributor

@GMHDBJD GMHDBJD left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Aug 25, 2023
Copy link
Contributor

@ywqzzy ywqzzy left a comment

Choose a reason for hiding this comment

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

LGTM

@ti-chi-bot
Copy link

ti-chi-bot bot commented Aug 25, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: GMHDBJD, ywqzzy

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels Aug 25, 2023
@ti-chi-bot
Copy link

ti-chi-bot bot commented Aug 25, 2023

[LGTM Timeline notifier]

Timeline:

  • 2023-08-25 06:22:39.870976861 +0000 UTC m=+1476124.419992833: ☑️ agreed by GMHDBJD.
  • 2023-08-25 07:52:56.074047255 +0000 UTC m=+1481540.623063242: ☑️ agreed by ywqzzy.

@ti-chi-bot ti-chi-bot bot merged commit 2f2bc41 into master Aug 25, 2023
@ti-chi-bot ti-chi-bot bot deleted the change-mock branch August 25, 2023 08:47
@ywqzzy ywqzzy mentioned this pull request Aug 31, 2023
12 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm ok-to-test Indicates a PR is ready to be tested. release-note-none Denotes a PR that doesn't merit a release note. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants