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

connectivity: Add GetTestOrDie() #2096

Merged
merged 1 commit into from
Nov 9, 2023
Merged

connectivity: Add GetTestOrDie() #2096

merged 1 commit into from
Nov 9, 2023

Conversation

michi-covalent
Copy link
Contributor

Add a convenient function GetTestOrDie(). There isn't much you can do if GetTest() fails anyways.

Add a convenient function GetTestOrDie(). There isn't much you can do if
GetTest() fails anyways.

Signed-off-by: Michi Mutsuzaki <[email protected]>
@christarazi christarazi merged commit 89c7ff0 into main Nov 9, 2023
24 of 37 checks passed
@christarazi christarazi deleted the pr/michi/gettestordie branch November 9, 2023 06:37
@@ -293,6 +293,16 @@ func (ct *ConnectivityTest) GetTest(name string) (*Test, error) {
panic("missing test descriptor for a registered name")
}

// GetTestOrDie returns the test scope for test named "name" if found,
// or panics otherwise.
func (ct *ConnectivityTest) GetTestOrDie(name string) *Test {
Copy link
Member

Choose a reason for hiding this comment

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

nit: the upstream convention for functions that panic on failure is usually MustFoo (see e.g. netip.MustParseAddr), so this could be named MustGetTest instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#2098

michi-covalent added a commit that referenced this pull request Nov 9, 2023
Fixes: 89c7ff0 ("connectivity: Add GetTestOrDie()")

Ref: #2096 (review)

Signed-off-by: Michi Mutsuzaki <[email protected]>
tklauser pushed a commit that referenced this pull request Nov 9, 2023
Fixes: 89c7ff0 ("connectivity: Add GetTestOrDie()")

Ref: #2096 (review)

Signed-off-by: Michi Mutsuzaki <[email protected]>
michi-covalent added a commit to cilium/cilium that referenced this pull request Jul 16, 2024
Fixes: 89c7ff04254f ("connectivity: Add GetTestOrDie()")

Ref: cilium/cilium-cli#2096 (review)

Signed-off-by: Michi Mutsuzaki <[email protected]>
michi-covalent added a commit to cilium/cilium that referenced this pull request Aug 5, 2024
[ cherry-picked from cilium/cilium-cli repository ]

Fixes: 89c7ff04254f ("connectivity: Add GetTestOrDie()")

Ref: cilium/cilium-cli#2096 (review)

Signed-off-by: Michi Mutsuzaki <[email protected]>
github-merge-queue bot pushed a commit to cilium/cilium that referenced this pull request Aug 16, 2024
[ cherry-picked from cilium/cilium-cli repository ]

Fixes: 89c7ff04254f ("connectivity: Add GetTestOrDie()")

Ref: cilium/cilium-cli#2096 (review)

Signed-off-by: Michi Mutsuzaki <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants