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

ttl: make some integration test faster #56719

Merged
merged 1 commit into from
Oct 21, 2024

Conversation

lcwangchao
Copy link
Collaborator

@lcwangchao lcwangchao commented Oct 18, 2024

What problem does this PR solve?

Issue Number: close #56718

What changed and how does it work?

  1. Provides boostJobScheduleForTest to make some intervals smaller to boost test.
  2. Modify some cases to make it more reasonable and faster

In master, run tests in pkg/ttl/ttlworker takes 34.5s:

> X="run pkg/ttl/ttlworker" make ut
cd tools/check; \
	GO111MODULE=on go build -o ../bin/ut ut.go
cd tools/check; \
	GO111MODULE=on go build -o ../bin/xprog xprog.go
GOBIN=/Users/wangchao/Code/pingcap/tidb/tools/bin GO111MODULE=on go install github.com/pingcap/failpoint/failpoint-ctl@9b3b6e3
tools/bin/ut run pkg/ttl/ttlworker || { find $PWD/ -type d | grep -vE "(\.git|tools)" | xargs tools/bin/failpoint-ctl disable; exit 1; }
2024/10/18 12:09:12 maxprocs: Leaving GOMAXPROCS=10: CPU quota undefined
building task finish, parallelism=20, count=55, takes=1m3.719834292s
run all tasks takes 34.5330225s

In this PR, it takes 3.4s:

> X="run pkg/ttl/ttlworker" make ut
cd tools/check; \
	GO111MODULE=on go build -o ../bin/ut ut.go
cd tools/check; \
	GO111MODULE=on go build -o ../bin/xprog xprog.go
GOBIN=/Users/wangchao/Code/pingcap/tidb/tools/bin GO111MODULE=on go install github.com/pingcap/failpoint/failpoint-ctl@9b3b6e3
tools/bin/ut run pkg/ttl/ttlworker || { find $PWD/ -type d | grep -vE "(\.git|tools)" | xargs tools/bin/failpoint-ctl disable; exit 1; }
2024/10/18 12:11:16 maxprocs: Leaving GOMAXPROCS=10: CPU quota undefined
building task finish, parallelism=20, count=55, takes=30.296769208s
run all tasks takes 3.442459375s

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No need to test
    • I checked and no code files have been changed.

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/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels Oct 18, 2024
Copy link

tiprow bot commented Oct 18, 2024

Hi @lcwangchao. 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-sigs/prow repository.

@lcwangchao
Copy link
Collaborator Author

/retest

Copy link

tiprow bot commented Oct 18, 2024

@lcwangchao: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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-sigs/prow repository.

@@ -416,6 +394,10 @@ func TestTTLJobDisable(t *testing.T) {
store, dom := testkit.CreateMockStoreAndDomain(t)
tk := testkit.NewTestKit(t, store)

// turn off the `tidb_ttl_job_enable`
tk.MustExec("set global tidb_ttl_job_enable = 'OFF'")
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Set the tidb_ttl_job_enable to OFF before creating TTL table to make test stable

for retryTime >= 0 {
retryTime--
time.Sleep(retryInterval)
time.Sleep(time.Second)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Just sleep 1s to make the test faster. And boostJobScheduleForTest can boost the test

Copy link

codecov bot commented Oct 18, 2024

Codecov Report

Attention: Patch coverage is 82.71605% with 14 lines in your changes missing coverage. Please review.

Project coverage is 56.6010%. Comparing base (457ff81) to head (2944c3f).
Report is 15 commits behind head on master.

Additional details and impacted files
@@                Coverage Diff                @@
##             master     #56719         +/-   ##
=================================================
- Coverage   73.3334%   56.6010%   -16.7325%     
=================================================
  Files          1630       1755        +125     
  Lines        450148     633259     +183111     
=================================================
+ Hits         330109     358431      +28322     
- Misses        99772     250841     +151069     
- Partials      20267      23987       +3720     
Flag Coverage Δ
integration 36.9140% <30.3797%> (?)
unit 72.6805% <82.7160%> (+0.2177%) ⬆️

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

Components Coverage Δ
dumpling 52.9478% <ø> (ø)
parser ∅ <ø> (∅)
br 52.2122% <ø> (+6.6231%) ⬆️

}()
require.NoError(t, m.SubmitJob(se, tblID, tblID, "request1"))

// notification is sent
wg.Wait()

for time.Now().Before(now.Add(time.Second * 5)) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

What is this case used for? It does not have any assertions. @YangKeao

Copy link
Member

@YangKeao YangKeao 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 Oct 19, 2024
Copy link

ti-chi-bot bot commented Oct 21, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: tiancaiamao, YangKeao

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:
  • OWNERS [YangKeao,tiancaiamao]

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 Oct 21, 2024
Copy link

ti-chi-bot bot commented Oct 21, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-10-19 03:28:10.167320343 +0000 UTC m=+62490.864110953: ☑️ agreed by YangKeao.
  • 2024-10-21 02:50:07.464499579 +0000 UTC m=+233008.161290181: ☑️ agreed by tiancaiamao.

@lcwangchao
Copy link
Collaborator Author

/retest

Copy link

tiprow bot commented Oct 21, 2024

@lcwangchao: Cannot trigger testing until a trusted user reviews the PR and leaves an /ok-to-test message.

In response to this:

/retest

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-sigs/prow repository.

@ti-chi-bot ti-chi-bot bot merged commit 73584bb into pingcap:master Oct 21, 2024
23 checks passed
@lcwangchao lcwangchao deleted the ttlfasttest branch October 21, 2024 06:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none Denotes a PR that doesn't merit a release note. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

make ttl unit test faster
3 participants