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.
This commit is contained in:
Brian Bland 2014-12-10 10:55:33 -08:00
parent 14a072cd5f
commit cb25cc65bf

View File

@ -598,10 +598,15 @@ func (suite *DriverSuite) TestStatCall(c *check.C) {
fileName := randomFilename(32) fileName := randomFilename(32)
filePath := path.Join(dirPath, fileName) filePath := path.Join(dirPath, fileName)
defer suite.StorageDriver.Delete(dirPath) defer suite.StorageDriver.Delete(firstPart(dirPath))
// Call on non-existent file/dir, check error. // 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.NotNil)
c.Assert(err, check.FitsTypeOf, storagedriver.PathNotFoundError{}) c.Assert(err, check.FitsTypeOf, storagedriver.PathNotFoundError{})
c.Assert(fi, check.IsNil) c.Assert(fi, check.IsNil)