From 56adb5be3ad26a0045ea6c6a6d24dafdff15ba1c Mon Sep 17 00:00:00 2001 From: Máximo Cuadros Date: Wed, 7 Sep 2016 02:04:43 +0200 Subject: format: packfile new interface --- common_test.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'common_test.go') 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) -- cgit