diff options
author | Máximo Cuadros <mcuadros@gmail.com> | 2019-03-04 10:48:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-03-04 10:48:28 +0100 |
commit | af1e3817a80cccb560b25b0fd3343894754020ba (patch) | |
tree | 451661799b2619458b36359a79c7ee58f5d8a715 /remote_test.go | |
parent | 0106daba16494c33d330168e38c8a610b7a9b32c (diff) | |
parent | fae29fbd5895363ef5464cc12029db85a1a24529 (diff) | |
download | go-git-af1e3817a80cccb560b25b0fd3343894754020ba.tar.gz |
Merge pull request #1080 from jfontan/fix/blocked-goroutine-remote-push
git: fix goroutine block while pushing a remote
Diffstat (limited to 'remote_test.go')
-rw-r--r-- | remote_test.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/remote_test.go b/remote_test.go index 28b0a3a..58a0598 100644 --- a/remote_test.go +++ b/remote_test.go @@ -6,6 +6,8 @@ import ( "io" "io/ioutil" "os" + "runtime" + "time" "gopkg.in/src-d/go-git.v4/config" "gopkg.in/src-d/go-git.v4/plumbing" @@ -448,10 +450,17 @@ func (s *RemoteSuite) TestPushContext(c *C) { ctx, cancel := context.WithCancel(context.Background()) cancel() + numGoroutines := runtime.NumGoroutine() + err = r.PushContext(ctx, &PushOptions{ RefSpecs: []config.RefSpec{"refs/tags/*:refs/tags/*"}, }) c.Assert(err, NotNil) + + // let the goroutine from pushHashes finish and check that the number of + // goroutines is the same as before + time.Sleep(100 * time.Millisecond) + c.Assert(runtime.NumGoroutine(), Equals, numGoroutines) } func (s *RemoteSuite) TestPushTags(c *C) { |