From 131a9e6fbb0d35544ab9baa5f333d7852a0fea34 Mon Sep 17 00:00:00 2001 From: Antonio Murdaca Date: Wed, 15 Apr 2015 21:14:54 +0200 Subject: [PATCH] Fix TestInitializeCannotStatPathFileNameTooLong Signed-off-by: Antonio Murdaca Upstream-commit: 7afb2347415a8e92020c037bacf5d11467c78e9b Component: engine --- components/engine/volumes/volume_test.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/components/engine/volumes/volume_test.go b/components/engine/volumes/volume_test.go index caf38c8bb4..b30549d379 100644 --- a/components/engine/volumes/volume_test.go +++ b/components/engine/volumes/volume_test.go @@ -1,7 +1,7 @@ package volumes import ( - "strings" + "os" "testing" "github.com/docker/docker/pkg/stringutils" @@ -33,8 +33,8 @@ func TestInitializeCannotMkdirOnNonExistentPath(t *testing.T) { t.Fatal("Expected not to initialize volume with a non existent path") } - if !strings.Contains(err.Error(), "mkdir : no such file or directory") { - t.Fatalf("Expected to get mkdir no such file or directory, got %s", err) + if !os.IsNotExist(err) { + t.Fatalf("Expected to get ErrNotExist error, got %s", err) } } @@ -49,7 +49,7 @@ func TestInitializeCannotStatPathFileNameTooLong(t *testing.T) { t.Fatal("Expected not to initialize volume with a non existent path") } - if !strings.Contains(err.Error(), "file name too long") { - t.Fatalf("Expected to get ENAMETOOLONG error, got %s", err) + if os.IsNotExist(err) { + t.Fatal("Expected to not get ErrNotExist") } }