Skip to content

Commit

Permalink
connectivity: Add GetTestOrDie()
Browse files Browse the repository at this point in the history
Add a convenient function GetTestOrDie(). There isn't much you can do if
GetTest() fails anyways.

Signed-off-by: Michi Mutsuzaki <[email protected]>
  • Loading branch information
michi-covalent committed Nov 8, 2023
1 parent 3490b39 commit 302b672
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions connectivity/check/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
test, err := ct.GetTest(name)
if err != nil {
panic(err)
}
return test
}

// SetupAndValidate sets up and validates the connectivity test infrastructure
// such as the client pods and validates the deployment of them along with
// Cilium. This must be run before Run() is called.
Expand Down

0 comments on commit 302b672

Please sign in to comment.