From 4de5e92124bbcc2a1d49779c693eedd0dd998ce6 Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Sat, 1 Feb 2025 19:48:22 +0100 Subject: [PATCH] internal/test: remove uses of pkg/errors in tests While there may be reasons to keep pkg/errors in production code, we don't need them for these tests. Signed-off-by: Sebastiaan van Stijn --- internal/test/environment/testenv.go | 2 +- internal/test/output/output.go | 11 +++++------ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/internal/test/environment/testenv.go b/internal/test/environment/testenv.go index 7fe6880244..9c5d06db34 100644 --- a/internal/test/environment/testenv.go +++ b/internal/test/environment/testenv.go @@ -1,6 +1,7 @@ package environment import ( + "errors" "fmt" "os" "strings" @@ -8,7 +9,6 @@ import ( "time" "github.com/docker/docker/client" - "github.com/pkg/errors" "gotest.tools/v3/icmd" "gotest.tools/v3/poll" "gotest.tools/v3/skip" diff --git a/internal/test/output/output.go b/internal/test/output/output.go index 42f958790f..43eafa29e0 100644 --- a/internal/test/output/output.go +++ b/internal/test/output/output.go @@ -1,10 +1,9 @@ package output import ( + "fmt" "strings" "testing" - - "github.com/pkg/errors" ) // Assert checks output lines at specified locations @@ -30,7 +29,7 @@ func Prefix(expected string) func(string) error { if strings.HasPrefix(actual, expected) { return nil } - return errors.Errorf("expected %q to start with %q", actual, expected) + return fmt.Errorf("expected %q to start with %q", actual, expected) } } @@ -40,7 +39,7 @@ func Suffix(expected string) func(string) error { if strings.HasSuffix(actual, expected) { return nil } - return errors.Errorf("expected %q to end with %q", actual, expected) + return fmt.Errorf("expected %q to end with %q", actual, expected) } } @@ -50,7 +49,7 @@ func Contains(expected string) func(string) error { if strings.Contains(actual, expected) { return nil } - return errors.Errorf("expected %q to contain %q", actual, expected) + return fmt.Errorf("expected %q to contain %q", actual, expected) } } @@ -60,6 +59,6 @@ func Equals(expected string) func(string) error { if expected == actual { return nil } - return errors.Errorf("got %q, expected %q", actual, expected) + return fmt.Errorf("got %q, expected %q", actual, expected) } }