diff options
author | Javi Fontan <jfontan@gmail.com> | 2019-03-21 16:48:56 +0100 |
---|---|---|
committer | Javi Fontan <jfontan@gmail.com> | 2019-03-21 17:29:38 +0100 |
commit | b40af0bc1b6da634581226a229b48b1ccea8a881 (patch) | |
tree | 70a356c8ca596994c6cbabae0580335b33302d1f /storage/transactional/storage_test.go | |
parent | 948b0c930bf1b173b172e5f28aa71da454c3a093 (diff) | |
download | go-git-b40af0bc1b6da634581226a229b48b1ccea8a881.tar.gz |
transactional: implement storer.PackfileWriter
Signed-off-by: Javi Fontan <jfontan@gmail.com>
Diffstat (limited to 'storage/transactional/storage_test.go')
-rw-r--r-- | storage/transactional/storage_test.go | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/storage/transactional/storage_test.go b/storage/transactional/storage_test.go index 6aaea0d..63ebfb1 100644 --- a/storage/transactional/storage_test.go +++ b/storage/transactional/storage_test.go @@ -4,7 +4,12 @@ import ( "testing" . "gopkg.in/check.v1" + "gopkg.in/src-d/go-billy.v4/memfs" "gopkg.in/src-d/go-git.v4/plumbing" + "gopkg.in/src-d/go-git.v4/plumbing/cache" + "gopkg.in/src-d/go-git.v4/plumbing/storer" + "gopkg.in/src-d/go-git.v4/storage" + "gopkg.in/src-d/go-git.v4/storage/filesystem" "gopkg.in/src-d/go-git.v4/storage/memory" "gopkg.in/src-d/go-git.v4/storage/test" ) @@ -13,13 +18,25 @@ func Test(t *testing.T) { TestingT(t) } type StorageSuite struct { test.BaseStorageSuite + temporal func() storage.Storer } -var _ = Suite(&StorageSuite{}) +var _ = Suite(&StorageSuite{ + temporal: func() storage.Storer { + return memory.NewStorage() + }, +}) + +var _ = Suite(&StorageSuite{ + temporal: func() storage.Storer { + fs := memfs.New() + return filesystem.NewStorage(fs, cache.NewObjectLRUDefault()) + }, +}) func (s *StorageSuite) SetUpTest(c *C) { base := memory.NewStorage() - temporal := memory.NewStorage() + temporal := s.temporal() s.BaseStorageSuite = test.NewBaseStorageSuite(NewStorage(base, temporal)) s.BaseStorageSuite.SetUpTest(c) @@ -27,7 +44,7 @@ func (s *StorageSuite) SetUpTest(c *C) { func (s *StorageSuite) TestCommit(c *C) { base := memory.NewStorage() - temporal := memory.NewStorage() + temporal := s.temporal() st := NewStorage(base, temporal) commit := base.NewEncodedObject() @@ -50,3 +67,13 @@ func (s *StorageSuite) TestCommit(c *C) { c.Assert(err, IsNil) c.Assert(obj.Hash(), Equals, commit.Hash()) } + +func (s *StorageSuite) TestTransactionalPackfileWriter(c *C) { + base := memory.NewStorage() + temporal := s.temporal() + st := NewStorage(base, temporal) + + _, tmpOK := temporal.(storer.PackfileWriter) + _, ok := st.(storer.PackfileWriter) + c.Assert(ok, Equals, tmpOK) +} |