From cb25cc65bf6ff07628bde33013657a31bd41ee60 Mon Sep 17 00:00:00 2001 From: Brian Bland Date: Wed, 10 Dec 2014 10:55:33 -0800 Subject: [PATCH] Fixes storagedriver Stat test Checks Stat on the directory before creating the file to make sure that it does not exist Properly cleans up after the test. --- storagedriver/testsuites/testsuites.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/storagedriver/testsuites/testsuites.go b/storagedriver/testsuites/testsuites.go index bbdc6a1c4..d649a1732 100644 --- a/storagedriver/testsuites/testsuites.go +++ b/storagedriver/testsuites/testsuites.go @@ -598,10 +598,15 @@ func (suite *DriverSuite) TestStatCall(c *check.C) { fileName := randomFilename(32) filePath := path.Join(dirPath, fileName) - defer suite.StorageDriver.Delete(dirPath) + defer suite.StorageDriver.Delete(firstPart(dirPath)) // Call on non-existent file/dir, check error. - fi, err := suite.StorageDriver.Stat(filePath) + fi, err := suite.StorageDriver.Stat(dirPath) + c.Assert(err, check.NotNil) + c.Assert(err, check.FitsTypeOf, storagedriver.PathNotFoundError{}) + c.Assert(fi, check.IsNil) + + fi, err = suite.StorageDriver.Stat(filePath) c.Assert(err, check.NotNil) c.Assert(err, check.FitsTypeOf, storagedriver.PathNotFoundError{}) c.Assert(fi, check.IsNil)