-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
Conversation
[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 The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
13ea37b
to
6ec1b66
Compare
/run-check_dev_2 |
1 similar comment
/run-check_dev_2 |
statistics/handle/handle_test.go
Outdated
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 | ||
} |
There was a problem hiding this comment.
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
@feitian124 @time-and-fate @rebelice any updates? |
This reverts commit 99c07f8373b94d4dd64e413e1df494d2b3fd5d4f.
@tisonkun working on it. try add parallal run following original suite. |
6ec1b66
to
329e277
Compare
@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. |
@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.
@feitian124 are you still working on this PR? |
i was busy on some personal affairs, i am a father now。 |
What problem does this PR solve?
Issue Number: close #28127
Release note