diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2016-09-07 02:04:43 +0200 |
---|---|---|
committer | Máximo Cuadros <mcuadros@gmail.com> | 2016-09-07 02:04:43 +0200 |
commit | 56adb5be3ad26a0045ea6c6a6d24dafdff15ba1c (patch) | |
tree | bd8ecbb6674f01f03f97fb15083bed0a3e8e021d /common_test.go | |
parent | 98a22e72a808aa0d5dd62339817404fd9e1c4db6 (diff) | |
download | go-git-56adb5be3ad26a0045ea6c6a6d24dafdff15ba1c.tar.gz |
format: packfile new interface
Diffstat (limited to 'common_test.go')
-rw-r--r-- | common_test.go | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/common_test.go b/common_test.go index f054f23..5670826 100644 --- a/common_test.go +++ b/common_test.go @@ -1,10 +1,8 @@ package git import ( - "bytes" "errors" "io" - "io/ioutil" "os" "testing" @@ -23,10 +21,17 @@ type BaseSuite struct { } func (s *BaseSuite) SetUpSuite(c *C) { + s.installMockProtocol(c) + s.buildRepository(c) +} + +func (s *BaseSuite) installMockProtocol(c *C) { clients.InstallProtocol("mock", func(end common.Endpoint) common.GitUploadPackService { return &MockGitUploadPackService{endpoint: end} }) +} +func (s *BaseSuite) buildRepository(c *C) { s.Repository = NewMemoryRepository() err := s.Repository.Clone(&CloneOptions{URL: RepositoryFixture}) c.Assert(err, IsNil) @@ -117,14 +122,9 @@ func unpackFixtures(c *C, fixtures ...[]packedFixture) map[string]*Repository { f, err := os.Open(fixture.packfile) c.Assert(err, IsNil, comment) - // increase memory consumption to speed up tests - data, err := ioutil.ReadAll(f) - c.Assert(err, IsNil) - memStream := bytes.NewReader(data) - r := packfile.NewStream(memStream) - + r := packfile.NewScanner(f) d := packfile.NewDecoder(r, repos[fixture.url].s.ObjectStorage()) - err = d.Decode() + _, err = d.Decode() c.Assert(err, IsNil, comment) c.Assert(f.Close(), IsNil, comment) |