Skip to content

fix panic when containerd-stress density --count 0#7748

Merged
mxpv merged 1 commit intocontainerd:mainfrom
yanggangtony:containerd-stress
Dec 5, 2022
Merged

fix panic when containerd-stress density --count 0#7748
mxpv merged 1 commit intocontainerd:mainfrom
yanggangtony:containerd-stress

Conversation

@yanggangtony
Copy link
Copy Markdown
Contributor

@yanggangtony yanggangtony commented Dec 2, 2022

Signed-off-by: yanggang [email protected]

/kind bug

Fix panic , when user input --count 0 or <0 meaningless number.

before is :
image

fix after is:
企业微信截图_c3dd8f40-052d-4548-889d-5143eda7932d

@k8s-ci-robot
Copy link
Copy Markdown

Hi @yanggangtony. Thanks for your PR.

I'm waiting for a containerd member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

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.

Comment thread cmd/containerd-stress/density.go Outdated
count = cliContext.Int("count")
)
if count <= 0 {
logrus.Warnf("flag count:%v can not be less than 0", count)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No need to warn, just return error if the argument is invalid

@yanggangtony
Copy link
Copy Markdown
Contributor Author

@dmcgowan
HI, thanks for review.
updated.

Copy link
Copy Markdown
Member

@estesp estesp left a comment

Choose a reason for hiding this comment

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

LGTM

Comment thread cmd/containerd-stress/density.go Outdated
Comment on lines +54 to +58
if count <= 0 {
return nil
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
if count <= 0 {
return nil
}
if count < 1 {
return errors.New("count cannot be less than one")
}

Copy link
Copy Markdown
Contributor Author

@yanggangtony yanggangtony Dec 3, 2022

Choose a reason for hiding this comment

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

@samuelkarp
😄 , Thank you for dedicating your time to review it.
So , we need to notify user , he / she is wrong to fill the parameters..

@mxpv mxpv merged commit 6918432 into containerd:main Dec 5, 2022
@yanggangtony yanggangtony deleted the containerd-stress branch November 25, 2023 00:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

6 participants