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

statistics: migrate test-infra to testify for handle/update_test.go #30006

Closed
wants to merge 19 commits into from

Conversation

feitian124
Copy link
Contributor

What problem does this PR solve?

Issue Number: close #28127

Release note

None

@ti-chi-bot
Copy link
Member

[REVIEW NOTIFICATION]

This pull request has not been approved.

To complete the pull request process, please ask the reviewers in the list to review by filling /cc @reviewer in the comment.
After your PR has acquired the required number of LGTMs, you can assign this pull request to the committer in the list by filling /assign @committer in the comment to help you merge this pull request.

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

Reviewer can indicate their review by submitting an approval review.
Reviewer can cancel approval by submitting a request changes review.

@ti-chi-bot ti-chi-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 Nov 22, 2021
@feitian124 feitian124 force-pushed the issue-28127 branch 2 times, most recently from 13ea37b to 6ec1b66 Compare November 23, 2021 02:28
@feitian124
Copy link
Contributor Author

/run-check_dev_2

1 similar comment
@feitian124
Copy link
Contributor Author

/run-check_dev_2

@tisonkun
Copy link
Contributor

/cc @rebelice @time-and-fate

@tisonkun
Copy link
Contributor

/cc @xuyifangreeneyes

Comment on lines 100 to 135
type logHook struct {
zapcore.Core
results string
}

func (h *logHook) Write(entry zapcore.Entry, fields []zapcore.Field) error {
message := entry.Message
if idx := strings.Index(message, "[stats"); idx != -1 {
h.results = h.results + message
for _, f := range fields {
h.results = h.results + ", " + f.Key + "=" + h.field2String(f)
}
}
return nil
}

func (h *logHook) field2String(field zapcore.Field) string {
switch field.Type {
case zapcore.StringType:
return field.String
case zapcore.Int64Type, zapcore.Int32Type, zapcore.Uint32Type, zapcore.Uint64Type:
return fmt.Sprintf("%v", field.Integer)
case zapcore.Float64Type:
return fmt.Sprintf("%v", math.Float64frombits(uint64(field.Integer)))
case zapcore.StringerType:
return field.Interface.(fmt.Stringer).String()
}
return "not support"
}

func (h *logHook) Check(e zapcore.Entry, ce *zapcore.CheckedEntry) *zapcore.CheckedEntry {
if h.Enabled(e.Level) {
return ce.AddCore(e, h)
}
return ce
}
Copy link
Contributor

Choose a reason for hiding this comment

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

You can move this block to main_test.go

@tisonkun
Copy link
Contributor

tisonkun commented Dec 7, 2021

@feitian124 @time-and-fate @rebelice any updates?

@feitian124
Copy link
Contributor Author

feitian124 commented Dec 7, 2021

@tisonkun working on it. try add parallal run following original suite.

@ti-chi-bot
Copy link
Member

@feitian124: PR needs rebase.

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.

@ti-chi-bot ti-chi-bot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Dec 15, 2021
@tisonkun
Copy link
Contributor

@feitian124 I think in a previous discussion #30869 we decided to run all tests in serial. You can update the code and let's move forward.

This reverts commit 3bf6a73.
@tisonkun
Copy link
Contributor

@feitian124 are you still working on this PR?

@feitian124
Copy link
Contributor Author

feitian124 commented Jan 24, 2022

i was busy on some personal affairs, i am a father now。
will arrange sometime and finish it in a few days。

@tisonkun tisonkun added the type/enhancement The issue or PR belongs to an enhancement. label Feb 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. 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. type/enhancement The issue or PR belongs to an enhancement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

migrate test-infra to testify for statistics/handle/update_test.go
3 participants