Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

fix(cli): ensure that the support bundle command does not panic on zero values#14392

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
johnstcn merged 4 commits intomainfromcj/support/dont-panic
Aug 22, 2024

Conversation

johnstcn
Copy link
Member

We try to write a cute little summary at the end of the bundle, but that could panic if some of the fields of the bundle were nil. Adds a test that essentially ensures nil values in a bundle, and ensures that it can be handled without losing our towels.

@johnstcnjohnstcn self-assigned thisAug 22, 2024
Copy link
Member

@mtojekmtojek left a comment

Choose a reason for hiding this comment

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

👍

Do you have an idea why the original code that panicked, didn't post any error/warning?

@johnstcn
Copy link
MemberAuthor

Do you have an idea why the original code that panicked, didn't post any error/warning?

Just a testing gap, to be honest.

Copy link
Contributor

@dannykoppingdannykopping left a comment

Choose a reason for hiding this comment

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

Minor suggestions, LGTM

assert.NoError(t, json.NewEncoder(w).Encode(resp))
default:
// Simply return a 200 OK for everything else.
w.WriteHeader(http.StatusOK)
Copy link
Contributor

Choose a reason for hiding this comment

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

Would a non-200 response also trigger this problem?

For example:

eg.Go(func()error {hr,err:=healthsdk.New(client).DebugHealth(ctx)iferr!=nil {returnxerrors.Errorf("fetch health report: %w",err)}d.HealthReport=&hrreturnnil})

I think it might be more idiomatic to have all calls fail rather than return empty values, although both are worthwhile testing.

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

That's a good point, I'll test against a range of status codes. 👍

Copy link
MemberAuthor

Choose a reason for hiding this comment

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

Updated!

johnstcnand others added2 commitsAugust 22, 2024 11:04
Co-authored-by: Danny Kopping <danny@coder.com>
Copy link
Contributor

@dannykoppingdannykopping left a comment

Choose a reason for hiding this comment

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

👍

@johnstcnjohnstcn merged commit82e6070 intomainAug 22, 2024
27 checks passed
@johnstcnjohnstcn deleted the cj/support/dont-panic branchAugust 22, 2024 10:15
@github-actionsgithub-actionsbot locked and limited conversation to collaboratorsAug 22, 2024
Sign up for freeto subscribe to this conversation on GitHub. Already have an account?Sign in.
Reviewers

@dannykoppingdannykoppingdannykopping approved these changes

@mtojekmtojekmtojek approved these changes

Assignees

@johnstcnjohnstcn

Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@johnstcn@dannykopping@mtojek

[8]ページ先頭

©2009-2025 Movatter.jp