func CheckErrorCases()

in pkg/testutil/errors.go [23:32]


func CheckErrorCases(err error, expErrSubstr string) error {
	if err == nil && expErrSubstr != "" {
		return fmt.Errorf("got no error but expected error containing %q", expErrSubstr)
	} else if err != nil && expErrSubstr == "" {
		return fmt.Errorf("got error %q but expected no error", err.Error())
	} else if err != nil && !strings.Contains(err.Error(), expErrSubstr) {
		return fmt.Errorf("Got error %q but expected it to contain %q", err.Error(), expErrSubstr)
	}
	return nil
}