-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Use the logger for logging test errors and skips. - Cleanup validation test suite Signed-off-by: Nir Soffer <nsoffer@redhat.com>
- Loading branch information
Showing
4 changed files
with
94 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// SPDX-FileCopyrightText: The RamenDR authors | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
package util | ||
|
||
import ( | ||
"fmt" | ||
"testing" | ||
) | ||
|
||
// Fatal logs an error and fails the test. | ||
func Fatal(t *testing.T, msg string, err error) { | ||
t.Helper() | ||
Ctx.Log.Error(err, msg) | ||
t.FailNow() | ||
} | ||
|
||
// FailNow fails the tests silently. Use for parent tests. | ||
func FailNow(t *testing.T) { | ||
t.Helper() | ||
t.FailNow() | ||
} | ||
|
||
// Skipf logs formmatted message the skips the test. | ||
func Skipf(t *testing.T, format string, args ...any) { | ||
t.Helper() | ||
Skip(t, fmt.Sprintf(format, args...)) | ||
} | ||
|
||
// Skip log msg and skips the test. | ||
func Skip(t *testing.T, msg string) { | ||
t.Helper() | ||
Ctx.Log.Info(msg) | ||
t.SkipNow() | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters