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.
pull/4/head
Brian Bland 2014-12-10 10:55:33 -08:00
parent 14a072cd5f
commit cb25cc65bf
1 changed files with 7 additions and 2 deletions

View File

@ -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)