aboutsummaryrefslogtreecommitdiffstats
path: root/storage/filesystem/object_test.go
diff options
context:
space:
mode:
authorJavi Fontan <jfontan@gmail.com>2018-09-06 19:09:02 +0200
committerJavi Fontan <jfontan@gmail.com>2018-09-06 19:13:42 +0200
commit8176f084d861891d1846a2d46bf669d0d3463ebd (patch)
tree22341a6315f5a0df6f1b0a5821b6c319da28d519 /storage/filesystem/object_test.go
parent9013dde72d0387a74b728ee336019728ba159d1c (diff)
downloadgo-git-8176f084d861891d1846a2d46bf669d0d3463ebd.tar.gz
storage/filesystem: compare files using offset in test
Using equals to compare files it uses diff to do so. This can potentially consume lots of ram. Changed the comparison to use file offsets. If the descriptor is reused the offset is maintained. Signed-off-by: Javi Fontan <jfontan@gmail.com>
Diffstat (limited to 'storage/filesystem/object_test.go')
-rw-r--r--storage/filesystem/object_test.go8
1 files changed, 7 insertions, 1 deletions
diff --git a/storage/filesystem/object_test.go b/storage/filesystem/object_test.go
index 6feb6ae..4a921a9 100644
--- a/storage/filesystem/object_test.go
+++ b/storage/filesystem/object_test.go
@@ -2,6 +2,7 @@ package filesystem
import (
"io/ioutil"
+ "os"
"testing"
"gopkg.in/src-d/go-git.v4/plumbing"
@@ -66,12 +67,17 @@ func (s *FsSuite) TestGetFromPackfileKeepDescriptors(c *C) {
pack1, err := dg.ObjectPack(packfiles[0])
c.Assert(err, IsNil)
+ pack1.Seek(42, os.SEEK_SET)
+
err = o.Close()
c.Assert(err, IsNil)
pack2, err := dg.ObjectPack(packfiles[0])
c.Assert(err, IsNil)
- c.Assert(pack1, Not(Equals), pack2)
+
+ offset, err := pack2.Seek(0, os.SEEK_CUR)
+ c.Assert(err, IsNil)
+ c.Assert(offset, Equals, int64(0))
err = o.Close()
c.Assert(err, IsNil)