aboutsummaryrefslogtreecommitdiffstats
path: root/storage/transactional/storage_test.go
diff options
context:
space:
mode:
authorMáximo Cuadros <mcuadros@gmail.com>2019-03-22 19:25:44 +0100
committerGitHub <noreply@github.com>2019-03-22 19:25:44 +0100
commit79081164bccd82fb12c7bfd058554812113eb7a4 (patch)
tree0f5edcd87e46e9de327294e9cd63743209ee0a90 /storage/transactional/storage_test.go
parente704ed55d364c1e5ceefbf47c4280c1904d6b1ca (diff)
parentb40af0bc1b6da634581226a229b48b1ccea8a881 (diff)
downloadgo-git-79081164bccd82fb12c7bfd058554812113eb7a4.tar.gz
Merge pull request #1093 from jfontan/transactional-packfilewriter-interface
transactional: implement storer.PackfileWriter
Diffstat (limited to 'storage/transactional/storage_test.go')
-rw-r--r--storage/transactional/storage_test.go33
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)
+}