From 006f408e91b4d494b144b773d5e582ced8c2f5cd Mon Sep 17 00:00:00 2001 From: Fabian Holler Date: Tue, 9 Jan 2024 11:29:22 +0100 Subject: [PATCH] fixup! tests: use os.IsNotExist instead of checking error string --- pkg/baur/inputresolver_test.go | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/pkg/baur/inputresolver_test.go b/pkg/baur/inputresolver_test.go index 344a10c4..5cb2710e 100644 --- a/pkg/baur/inputresolver_test.go +++ b/pkg/baur/inputresolver_test.go @@ -2,6 +2,7 @@ package baur import ( "context" + "errors" "fmt" "os" "path/filepath" @@ -631,7 +632,7 @@ func TestResolveSymlink(t *testing.T) { testdir: "directory_broken", inputPath: "**", validateFn: func(t *testing.T, err error, result []Input) { - require.Truef(t, os.IsNotExist(err), "expected not exist os error, got: %s", err) + require.Truef(t, os.IsNotExist(errors.Unwrap(err)), "expected not exist os error, got: %s", err) require.Empty(t, result) }, }, @@ -639,7 +640,7 @@ func TestResolveSymlink(t *testing.T) { testdir: "file_broken", inputPath: "symlink", validateFn: func(t *testing.T, err error, result []Input) { - require.Truef(t, os.IsNotExist(err), "expected not exist os error, got: %s", err) + require.Truef(t, os.IsNotExist(errors.Unwrap(err)), "expected not exist os error, got: %s", err) require.Empty(t, result) }, }, @@ -647,7 +648,7 @@ func TestResolveSymlink(t *testing.T) { testdir: "file_broken", inputPath: "**", validateFn: func(t *testing.T, err error, result []Input) { - require.Truef(t, os.IsNotExist(err), "expected not exist os error, got: %s", err) + require.Truef(t, os.IsNotExist(errors.Unwrap(err)), "expected not exist os error, got: %s", err) require.Empty(t, result) }, }, @@ -698,7 +699,7 @@ func TestResolveSymlink(t *testing.T) { testdir: "symlinks", inputPath: "directory_containing_broken_symlin**/**", validateFn: func(t *testing.T, err error, _ []Input) { - require.Truef(t, os.IsNotExist(err), "expected not exist os error, got: %s", err) + require.Truef(t, os.IsNotExist(errors.Unwrap(err)), "expected not exist os error, got: %s", err) }, }, }