Skip to content
This repository was archived by the owner on Sep 11, 2020. It is now read-only.

Commit 659ec44

Browse files
committed
storage/dotgit: add ExclusiveAccess tests in dotgit
This functionality was already tested in storage/filesystem. The coverage tool only takes into account files from the same package of the test. Signed-off-by: Javi Fontan <jfontan@gmail.com>
1 parent 874f669 commit 659ec44

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

storage/filesystem/dotgit/dotgit_test.go

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import (
99
"strings"
1010
"testing"
1111

12+
"gopkg.in/src-d/go-billy.v4"
1213
"gopkg.in/src-d/go-git.v4/plumbing"
1314

1415
. "gopkg.in/check.v1"
@@ -424,6 +425,18 @@ func (s *SuiteDotGit) TestObjectPacks(c *C) {
424425
fs := f.DotGit()
425426
dir := New(fs)
426427

428+
testObjectPacks(c, fs, dir, f)
429+
}
430+
431+
func (s *SuiteDotGit) TestObjectPacksExclusive(c *C) {
432+
f := fixtures.Basic().ByTag(".git").One()
433+
fs := f.DotGit()
434+
dir := NewWithOptions(fs, Options{ExclusiveAccess: true})
435+
436+
testObjectPacks(c, fs, dir, f)
437+
}
438+
439+
func testObjectPacks(c *C, fs billy.Filesystem, dir *DotGit, f *fixtures.Fixture) {
427440
hashes, err := dir.ObjectPacks()
428441
c.Assert(err, IsNil)
429442
c.Assert(hashes, HasLen, 1)
@@ -506,6 +519,17 @@ func (s *SuiteDotGit) TestObjects(c *C) {
506519
fs := fixtures.ByTag(".git").ByTag("unpacked").One().DotGit()
507520
dir := New(fs)
508521

522+
testObjects(c, fs, dir)
523+
}
524+
525+
func (s *SuiteDotGit) TestObjectsExclusive(c *C) {
526+
fs := fixtures.ByTag(".git").ByTag("unpacked").One().DotGit()
527+
dir := NewWithOptions(fs, Options{ExclusiveAccess: true})
528+
529+
testObjects(c, fs, dir)
530+
}
531+
532+
func testObjects(c *C, fs billy.Filesystem, dir *DotGit) {
509533
hashes, err := dir.Objects()
510534
c.Assert(err, IsNil)
511535
c.Assert(hashes, HasLen, 187)

0 commit comments

Comments
 (0)