aboutsummaryrefslogtreecommitdiffstats
path: root/storage/filesystem/object_test.go
diff options
context:
space:
mode:
authorSantiago M. Mola <santi@mola.io>2016-08-29 22:47:13 +0200
committerMáximo Cuadros <mcuadros@gmail.com>2016-08-29 22:47:13 +0200
commite4246138cb9ffb819c052ba17a9fbdf915427291 (patch)
treebd938368afe0ffd7c9e1df16256e39e17d8184b5 /storage/filesystem/object_test.go
parentdd4af03ad368cc50dd08912010f5b667bd7569cd (diff)
downloadgo-git-e4246138cb9ffb819c052ba17a9fbdf915427291.tar.gz
storage: Add object type hint parameter to ObjectStorage.Get. (#69)
Some storage backends can optimize object lookup if they get the object type that is expected. So we the signature of the Get method is now Get(Hash, ObjectType). Added generic tests for storage backends.
Diffstat (limited to 'storage/filesystem/object_test.go')
-rw-r--r--storage/filesystem/object_test.go10
1 files changed, 6 insertions, 4 deletions
diff --git a/storage/filesystem/object_test.go b/storage/filesystem/object_test.go
index 692a69b..956fdeb 100644
--- a/storage/filesystem/object_test.go
+++ b/storage/filesystem/object_test.go
@@ -64,9 +64,11 @@ func (s *FsSuite) TearDownSuite(c *C) {
func (s *FsSuite) TestHashNotFound(c *C) {
sto := s.newObjectStorage(c, "binary-relations")
-
- _, err := sto.Get(core.ZeroHash)
- c.Assert(err, Equals, core.ErrObjectNotFound)
+ types := []core.ObjectType{core.AnyObject, core.TagObject, core.CommitObject, core.BlobObject, core.TreeObject}
+ for t := range types {
+ _, err := sto.Get(core.ZeroHash, core.ObjectType(t))
+ c.Assert(err, Equals, core.ErrObjectNotFound)
+ }
}
func (s *FsSuite) newObjectStorage(c *C, fixtureName string) core.ObjectStorage {
@@ -156,7 +158,7 @@ func equalsStorages(a, b core.ObjectStorage) (bool, string, error) {
break
}
- bo, err := b.Get(ao.Hash())
+ bo, err := b.Get(ao.Hash(), core.AnyObject)
if err != nil {
return false, "", fmt.Errorf("getting object with hash %s: %s",
ao.Hash(), err)