MCPcopy
hub / github.com/go-git/go-git / TestPushContextCanceled

Method TestPushContextCanceled

remote_test.go:645–672  ·  view source on GitHub ↗
(c *C)

Source from the content-addressed store, hash-verified

643}
644
645func (s *RemoteSuite) TestPushContextCanceled(c *C) {
646 url := c.MkDir()
647
648 _, err := PlainInit(url, true)
649 c.Assert(err, IsNil)
650
651 fs := fixtures.ByURL("https://github.com/git-fixtures/tags.git").One().DotGit()
652 sto := filesystem.NewStorage(fs, cache.NewObjectLRUDefault())
653
654 r := NewRemote(sto, &config.RemoteConfig{
655 Name: DefaultRemoteName,
656 URLs: []string{url},
657 })
658
659 ctx, cancel := context.WithCancel(context.Background())
660 cancel()
661
662 numGoroutines := runtime.NumGoroutine()
663
664 err = r.PushContext(ctx, &PushOptions{
665 RefSpecs: []config.RefSpec{"refs/tags/*:refs/tags/*"},
666 })
667 c.Assert(err, Equals, context.Canceled)
668
669 eventually(c, func() bool {
670 return runtime.NumGoroutine() <= numGoroutines
671 })
672}
673
674func (s *RemoteSuite) TestPushTags(c *C) {
675 url := c.MkDir()

Callers

nothing calls this directly

Calls 6

PushContextMethod · 0.95
NewStorageFunction · 0.92
NewObjectLRUDefaultFunction · 0.92
PlainInitFunction · 0.85
NewRemoteFunction · 0.85
eventuallyFunction · 0.85

Tested by

no test coverage detected