diff --git a/go.mod b/go.mod index 77739d459..d35501506 100644 --- a/go.mod +++ b/go.mod @@ -27,7 +27,7 @@ require ( github.com/onsi/gomega v1.18.1 github.com/opencontainers/image-spec v1.0.3-0.20220303224323-02efb9a75ee1 github.com/pivotal-cf-experimental/gomegamatchers v0.0.0-20180326192815-e36bfcc98c3a - github.com/pivotal-cf/go-pivnet/v2 v2.0.11 + github.com/pivotal-cf/go-pivnet/v7 v7.0.2 github.com/pivotal-cf/jhanda v0.0.0-20200619200912-8de8eb943a43 github.com/pivotal-cf/om v0.0.0-20211027143906-30b10602e528 github.com/pkg/errors v0.9.1 diff --git a/go.sum b/go.sum index 9a089a330..1cf1c9df3 100644 --- a/go.sum +++ b/go.sum @@ -616,9 +616,9 @@ github.com/pierrec/lz4 v2.6.0+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi github.com/pivotal-cf-experimental/gomegamatchers v0.0.0-20180326192815-e36bfcc98c3a h1:K20a2viyp6kZgY41ESLne0eOXyY9DarmwA4q6zQ686w= github.com/pivotal-cf-experimental/gomegamatchers v0.0.0-20180326192815-e36bfcc98c3a/go.mod h1:HdFegZwXOoRNyrqaOX6FC1zMkbA2k1/ktb2anj1E0K8= github.com/pivotal-cf/go-pivnet v1.0.3/go.mod h1:rvEzWli4NJQhX7Z3z0DiEQXsPwC+uE//eIKcpl7S1as= -github.com/pivotal-cf/go-pivnet/v2 v2.0.11 h1:6tzC4zOr7acFPevfP32+8rEU567JlDobqiIejFf8aOc= -github.com/pivotal-cf/go-pivnet/v2 v2.0.11/go.mod h1:Ormn4YO2MooU40LNFwECoLd8XZFwbRcysET+OAn7FLg= github.com/pivotal-cf/go-pivnet/v6 v6.0.2/go.mod h1:ymI4gZvp8lf3GNaf1Re+JRV18zU0w8TLBDQB/t8SaFs= +github.com/pivotal-cf/go-pivnet/v7 v7.0.2 h1:8IYUIXmFEJpuTSIuOM5K4z0tJLPULDPpKJfn+wWLhqk= +github.com/pivotal-cf/go-pivnet/v7 v7.0.2/go.mod h1:h868WmuLUuavwNHoC6FyGI3hK/6rP3/HCmM8sYLuC8c= github.com/pivotal-cf/jhanda v0.0.0-20200619200912-8de8eb943a43 h1:SYEUxVbqz3U7pJP/tlaXaD08w0rZVuPvCFRodnw/TLY= github.com/pivotal-cf/jhanda v0.0.0-20200619200912-8de8eb943a43/go.mod h1:UXciri1Yqno0IdXxEzwMF91nnwYMPoN95goHWxVtWq8= github.com/pivotal-cf/om v0.0.0-20211027143906-30b10602e528 h1:XYJJ3cozlyyEs9IhoQLA2ZE9GpT4qrtM8V9FhXF4PqY= diff --git a/internal/commands/fakes/pivnet_product_files_service.go b/internal/commands/fakes/pivnet_product_files_service.go index dd7484452..c44233ca9 100644 --- a/internal/commands/fakes/pivnet_product_files_service.go +++ b/internal/commands/fakes/pivnet_product_files_service.go @@ -4,7 +4,7 @@ package fakes import ( "sync" - pivnet "github.com/pivotal-cf/go-pivnet/v2" + pivnet "github.com/pivotal-cf/go-pivnet/v7" "github.com/pivotal-cf/kiln/internal/commands" ) diff --git a/internal/commands/fakes/pivnet_release_dependencies_service.go b/internal/commands/fakes/pivnet_release_dependencies_service.go index 43840debe..717327df1 100644 --- a/internal/commands/fakes/pivnet_release_dependencies_service.go +++ b/internal/commands/fakes/pivnet_release_dependencies_service.go @@ -4,7 +4,7 @@ package fakes import ( "sync" - pivnet "github.com/pivotal-cf/go-pivnet/v2" + pivnet "github.com/pivotal-cf/go-pivnet/v7" "github.com/pivotal-cf/kiln/internal/commands" ) diff --git a/internal/commands/fakes/pivnet_release_upgrade_paths_service.go b/internal/commands/fakes/pivnet_release_upgrade_paths_service.go index 0670c2d1f..20014edf1 100644 --- a/internal/commands/fakes/pivnet_release_upgrade_paths_service.go +++ b/internal/commands/fakes/pivnet_release_upgrade_paths_service.go @@ -4,7 +4,7 @@ package fakes import ( "sync" - pivnet "github.com/pivotal-cf/go-pivnet/v2" + pivnet "github.com/pivotal-cf/go-pivnet/v7" "github.com/pivotal-cf/kiln/internal/commands" ) diff --git a/internal/commands/fakes/pivnet_releases_service.go b/internal/commands/fakes/pivnet_releases_service.go index 563562a5a..dcbc331d1 100644 --- a/internal/commands/fakes/pivnet_releases_service.go +++ b/internal/commands/fakes/pivnet_releases_service.go @@ -4,15 +4,16 @@ package fakes import ( "sync" - pivnet "github.com/pivotal-cf/go-pivnet/v2" + pivnet "github.com/pivotal-cf/go-pivnet/v7" "github.com/pivotal-cf/kiln/internal/commands" ) type PivnetReleasesService struct { - ListStub func(string) ([]pivnet.Release, error) + ListStub func(string, ...pivnet.QueryParameter) ([]pivnet.Release, error) listMutex sync.RWMutex listArgsForCall []struct { arg1 string + arg2 []pivnet.QueryParameter } listReturns struct { result1 []pivnet.Release @@ -40,18 +41,19 @@ type PivnetReleasesService struct { invocationsMutex sync.RWMutex } -func (fake *PivnetReleasesService) List(arg1 string) ([]pivnet.Release, error) { +func (fake *PivnetReleasesService) List(arg1 string, arg2 ...pivnet.QueryParameter) ([]pivnet.Release, error) { fake.listMutex.Lock() ret, specificReturn := fake.listReturnsOnCall[len(fake.listArgsForCall)] fake.listArgsForCall = append(fake.listArgsForCall, struct { arg1 string - }{arg1}) + arg2 []pivnet.QueryParameter + }{arg1, arg2}) stub := fake.ListStub fakeReturns := fake.listReturns - fake.recordInvocation("List", []interface{}{arg1}) + fake.recordInvocation("List", []interface{}{arg1, arg2}) fake.listMutex.Unlock() if stub != nil { - return stub(arg1) + return stub(arg1, arg2...) } if specificReturn { return ret.result1, ret.result2 @@ -65,17 +67,17 @@ func (fake *PivnetReleasesService) ListCallCount() int { return len(fake.listArgsForCall) } -func (fake *PivnetReleasesService) ListCalls(stub func(string) ([]pivnet.Release, error)) { +func (fake *PivnetReleasesService) ListCalls(stub func(string, ...pivnet.QueryParameter) ([]pivnet.Release, error)) { fake.listMutex.Lock() defer fake.listMutex.Unlock() fake.ListStub = stub } -func (fake *PivnetReleasesService) ListArgsForCall(i int) string { +func (fake *PivnetReleasesService) ListArgsForCall(i int) (string, []pivnet.QueryParameter) { fake.listMutex.RLock() defer fake.listMutex.RUnlock() argsForCall := fake.listArgsForCall[i] - return argsForCall.arg1 + return argsForCall.arg1, argsForCall.arg2 } func (fake *PivnetReleasesService) ListReturns(result1 []pivnet.Release, result2 error) { diff --git a/internal/commands/fakes/pivnet_user_groups_service.go b/internal/commands/fakes/pivnet_user_groups_service.go index f2995946e..0d0979c9d 100644 --- a/internal/commands/fakes/pivnet_user_groups_service.go +++ b/internal/commands/fakes/pivnet_user_groups_service.go @@ -4,7 +4,7 @@ package fakes import ( "sync" - pivnet "github.com/pivotal-cf/go-pivnet/v2" + pivnet "github.com/pivotal-cf/go-pivnet/v7" "github.com/pivotal-cf/kiln/internal/commands" ) diff --git a/internal/commands/publish.go b/internal/commands/publish.go index 6a61358a5..0ed17d739 100644 --- a/internal/commands/publish.go +++ b/internal/commands/publish.go @@ -13,8 +13,8 @@ import ( "github.com/Masterminds/semver" "github.com/go-git/go-billy/v5" - "github.com/pivotal-cf/go-pivnet/v2" - "github.com/pivotal-cf/go-pivnet/v2/logshim" + "github.com/pivotal-cf/go-pivnet/v7" + "github.com/pivotal-cf/go-pivnet/v7/logshim" "github.com/pivotal-cf/jhanda" "gopkg.in/yaml.v2" @@ -28,7 +28,7 @@ const ( //counterfeiter:generate -o ./fakes/pivnet_releases_service.go --fake-name PivnetReleasesService . PivnetReleasesService type PivnetReleasesService interface { - List(productSlug string) ([]pivnet.Release, error) + List(productSlug string, _ ...pivnet.QueryParameter) ([]pivnet.Release, error) Update(productSlug string, release pivnet.Release) (pivnet.Release, error) } diff --git a/internal/commands/publish_test.go b/internal/commands/publish_test.go index 85bb5d2c8..a02078a6d 100644 --- a/internal/commands/publish_test.go +++ b/internal/commands/publish_test.go @@ -13,7 +13,7 @@ import ( "github.com/Masterminds/semver" "github.com/go-git/go-billy/v5" "github.com/go-git/go-billy/v5/memfs" - "github.com/pivotal-cf/go-pivnet/v2" + "github.com/pivotal-cf/go-pivnet/v7" "github.com/pivotal-cf/kiln/internal/commands" commandsFakes "github.com/pivotal-cf/kiln/internal/commands/fakes" @@ -394,11 +394,11 @@ pre_ga_user_groups: Context("during the ga window", func() { const ( - version20OslFileID = 42 - version21OslFileID = 43 + version20OslFileID = 42 + version21OslFileID = 43 version21OsmPartOneFileId = 44 version21OsmPartTwoFileId = 45 - version20OsmFileId = 46 + version20OsmFileId = 46 ) var ( args []string diff --git a/pkg/notes/fakes/historic_kilnfile.go b/pkg/notes/fakes/historic_kilnfile.go new file mode 100644 index 000000000..8a05a0452 --- /dev/null +++ b/pkg/notes/fakes/historic_kilnfile.go @@ -0,0 +1,124 @@ +// Code generated by counterfeiter. DO NOT EDIT. +package fakes + +import ( + "sync" + + "github.com/go-git/go-git/v5/plumbing" + "github.com/go-git/go-git/v5/plumbing/storer" + "github.com/pivotal-cf/kiln/pkg/cargo" +) + +type HistoricKilnfile struct { + Stub func(storer.EncodedObjectStorer, plumbing.Hash, string) (cargo.Kilnfile, cargo.KilnfileLock, error) + mutex sync.RWMutex + argsForCall []struct { + arg1 storer.EncodedObjectStorer + arg2 plumbing.Hash + arg3 string + } + returns struct { + result1 cargo.Kilnfile + result2 cargo.KilnfileLock + result3 error + } + returnsOnCall map[int]struct { + result1 cargo.Kilnfile + result2 cargo.KilnfileLock + result3 error + } + invocations map[string][][]interface{} + invocationsMutex sync.RWMutex +} + +func (fake *HistoricKilnfile) Spy(arg1 storer.EncodedObjectStorer, arg2 plumbing.Hash, arg3 string) (cargo.Kilnfile, cargo.KilnfileLock, error) { + fake.mutex.Lock() + ret, specificReturn := fake.returnsOnCall[len(fake.argsForCall)] + fake.argsForCall = append(fake.argsForCall, struct { + arg1 storer.EncodedObjectStorer + arg2 plumbing.Hash + arg3 string + }{arg1, arg2, arg3}) + stub := fake.Stub + returns := fake.returns + fake.recordInvocation("historicKilnfile", []interface{}{arg1, arg2, arg3}) + fake.mutex.Unlock() + if stub != nil { + return stub(arg1, arg2, arg3) + } + if specificReturn { + return ret.result1, ret.result2, ret.result3 + } + return returns.result1, returns.result2, returns.result3 +} + +func (fake *HistoricKilnfile) CallCount() int { + fake.mutex.RLock() + defer fake.mutex.RUnlock() + return len(fake.argsForCall) +} + +func (fake *HistoricKilnfile) Calls(stub func(storer.EncodedObjectStorer, plumbing.Hash, string) (cargo.Kilnfile, cargo.KilnfileLock, error)) { + fake.mutex.Lock() + defer fake.mutex.Unlock() + fake.Stub = stub +} + +func (fake *HistoricKilnfile) ArgsForCall(i int) (storer.EncodedObjectStorer, plumbing.Hash, string) { + fake.mutex.RLock() + defer fake.mutex.RUnlock() + return fake.argsForCall[i].arg1, fake.argsForCall[i].arg2, fake.argsForCall[i].arg3 +} + +func (fake *HistoricKilnfile) Returns(result1 cargo.Kilnfile, result2 cargo.KilnfileLock, result3 error) { + fake.mutex.Lock() + defer fake.mutex.Unlock() + fake.Stub = nil + fake.returns = struct { + result1 cargo.Kilnfile + result2 cargo.KilnfileLock + result3 error + }{result1, result2, result3} +} + +func (fake *HistoricKilnfile) ReturnsOnCall(i int, result1 cargo.Kilnfile, result2 cargo.KilnfileLock, result3 error) { + fake.mutex.Lock() + defer fake.mutex.Unlock() + fake.Stub = nil + if fake.returnsOnCall == nil { + fake.returnsOnCall = make(map[int]struct { + result1 cargo.Kilnfile + result2 cargo.KilnfileLock + result3 error + }) + } + fake.returnsOnCall[i] = struct { + result1 cargo.Kilnfile + result2 cargo.KilnfileLock + result3 error + }{result1, result2, result3} +} + +func (fake *HistoricKilnfile) Invocations() map[string][][]interface{} { + fake.invocationsMutex.RLock() + defer fake.invocationsMutex.RUnlock() + fake.mutex.RLock() + defer fake.mutex.RUnlock() + copiedInvocations := map[string][][]interface{}{} + for key, value := range fake.invocations { + copiedInvocations[key] = value + } + return copiedInvocations +} + +func (fake *HistoricKilnfile) recordInvocation(key string, args []interface{}) { + fake.invocationsMutex.Lock() + defer fake.invocationsMutex.Unlock() + if fake.invocations == nil { + fake.invocations = map[string][][]interface{}{} + } + if fake.invocations[key] == nil { + fake.invocations[key] = [][]interface{}{} + } + fake.invocations[key] = append(fake.invocations[key], args) +} diff --git a/pkg/notes/fakes/historic_version.go b/pkg/notes/fakes/historic_version.go new file mode 100644 index 000000000..b3d47fb2e --- /dev/null +++ b/pkg/notes/fakes/historic_version.go @@ -0,0 +1,118 @@ +// Code generated by counterfeiter. DO NOT EDIT. +package fakes + +import ( + "sync" + + "github.com/go-git/go-git/v5/plumbing" + "github.com/go-git/go-git/v5/plumbing/storer" +) + +type HistoricVersion struct { + Stub func(storer.EncodedObjectStorer, plumbing.Hash, string) (string, error) + mutex sync.RWMutex + argsForCall []struct { + arg1 storer.EncodedObjectStorer + arg2 plumbing.Hash + arg3 string + } + returns struct { + result1 string + result2 error + } + returnsOnCall map[int]struct { + result1 string + result2 error + } + invocations map[string][][]interface{} + invocationsMutex sync.RWMutex +} + +func (fake *HistoricVersion) Spy(arg1 storer.EncodedObjectStorer, arg2 plumbing.Hash, arg3 string) (string, error) { + fake.mutex.Lock() + ret, specificReturn := fake.returnsOnCall[len(fake.argsForCall)] + fake.argsForCall = append(fake.argsForCall, struct { + arg1 storer.EncodedObjectStorer + arg2 plumbing.Hash + arg3 string + }{arg1, arg2, arg3}) + stub := fake.Stub + returns := fake.returns + fake.recordInvocation("historicVersion", []interface{}{arg1, arg2, arg3}) + fake.mutex.Unlock() + if stub != nil { + return stub(arg1, arg2, arg3) + } + if specificReturn { + return ret.result1, ret.result2 + } + return returns.result1, returns.result2 +} + +func (fake *HistoricVersion) CallCount() int { + fake.mutex.RLock() + defer fake.mutex.RUnlock() + return len(fake.argsForCall) +} + +func (fake *HistoricVersion) Calls(stub func(storer.EncodedObjectStorer, plumbing.Hash, string) (string, error)) { + fake.mutex.Lock() + defer fake.mutex.Unlock() + fake.Stub = stub +} + +func (fake *HistoricVersion) ArgsForCall(i int) (storer.EncodedObjectStorer, plumbing.Hash, string) { + fake.mutex.RLock() + defer fake.mutex.RUnlock() + return fake.argsForCall[i].arg1, fake.argsForCall[i].arg2, fake.argsForCall[i].arg3 +} + +func (fake *HistoricVersion) Returns(result1 string, result2 error) { + fake.mutex.Lock() + defer fake.mutex.Unlock() + fake.Stub = nil + fake.returns = struct { + result1 string + result2 error + }{result1, result2} +} + +func (fake *HistoricVersion) ReturnsOnCall(i int, result1 string, result2 error) { + fake.mutex.Lock() + defer fake.mutex.Unlock() + fake.Stub = nil + if fake.returnsOnCall == nil { + fake.returnsOnCall = make(map[int]struct { + result1 string + result2 error + }) + } + fake.returnsOnCall[i] = struct { + result1 string + result2 error + }{result1, result2} +} + +func (fake *HistoricVersion) Invocations() map[string][][]interface{} { + fake.invocationsMutex.RLock() + defer fake.invocationsMutex.RUnlock() + fake.mutex.RLock() + defer fake.mutex.RUnlock() + copiedInvocations := map[string][][]interface{}{} + for key, value := range fake.invocations { + copiedInvocations[key] = value + } + return copiedInvocations +} + +func (fake *HistoricVersion) recordInvocation(key string, args []interface{}) { + fake.invocationsMutex.Lock() + defer fake.invocationsMutex.Unlock() + if fake.invocations == nil { + fake.invocations = map[string][][]interface{}{} + } + if fake.invocations[key] == nil { + fake.invocations[key] = [][]interface{}{} + } + fake.invocations[key] = append(fake.invocations[key], args) +} diff --git a/pkg/notes/fakes/issue_getter.go b/pkg/notes/fakes/issue_getter.go new file mode 100644 index 000000000..3dbaa90cc --- /dev/null +++ b/pkg/notes/fakes/issue_getter.go @@ -0,0 +1,126 @@ +// Code generated by counterfeiter. DO NOT EDIT. +package fakes + +import ( + "context" + "sync" + + "github.com/google/go-github/v40/github" +) + +type IssueGetter struct { + GetStub func(context.Context, string, string, int) (*github.Issue, *github.Response, error) + getMutex sync.RWMutex + getArgsForCall []struct { + arg1 context.Context + arg2 string + arg3 string + arg4 int + } + getReturns struct { + result1 *github.Issue + result2 *github.Response + result3 error + } + getReturnsOnCall map[int]struct { + result1 *github.Issue + result2 *github.Response + result3 error + } + invocations map[string][][]interface{} + invocationsMutex sync.RWMutex +} + +func (fake *IssueGetter) Get(arg1 context.Context, arg2 string, arg3 string, arg4 int) (*github.Issue, *github.Response, error) { + fake.getMutex.Lock() + ret, specificReturn := fake.getReturnsOnCall[len(fake.getArgsForCall)] + fake.getArgsForCall = append(fake.getArgsForCall, struct { + arg1 context.Context + arg2 string + arg3 string + arg4 int + }{arg1, arg2, arg3, arg4}) + stub := fake.GetStub + fakeReturns := fake.getReturns + fake.recordInvocation("Get", []interface{}{arg1, arg2, arg3, arg4}) + fake.getMutex.Unlock() + if stub != nil { + return stub(arg1, arg2, arg3, arg4) + } + if specificReturn { + return ret.result1, ret.result2, ret.result3 + } + return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 +} + +func (fake *IssueGetter) GetCallCount() int { + fake.getMutex.RLock() + defer fake.getMutex.RUnlock() + return len(fake.getArgsForCall) +} + +func (fake *IssueGetter) GetCalls(stub func(context.Context, string, string, int) (*github.Issue, *github.Response, error)) { + fake.getMutex.Lock() + defer fake.getMutex.Unlock() + fake.GetStub = stub +} + +func (fake *IssueGetter) GetArgsForCall(i int) (context.Context, string, string, int) { + fake.getMutex.RLock() + defer fake.getMutex.RUnlock() + argsForCall := fake.getArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4 +} + +func (fake *IssueGetter) GetReturns(result1 *github.Issue, result2 *github.Response, result3 error) { + fake.getMutex.Lock() + defer fake.getMutex.Unlock() + fake.GetStub = nil + fake.getReturns = struct { + result1 *github.Issue + result2 *github.Response + result3 error + }{result1, result2, result3} +} + +func (fake *IssueGetter) GetReturnsOnCall(i int, result1 *github.Issue, result2 *github.Response, result3 error) { + fake.getMutex.Lock() + defer fake.getMutex.Unlock() + fake.GetStub = nil + if fake.getReturnsOnCall == nil { + fake.getReturnsOnCall = make(map[int]struct { + result1 *github.Issue + result2 *github.Response + result3 error + }) + } + fake.getReturnsOnCall[i] = struct { + result1 *github.Issue + result2 *github.Response + result3 error + }{result1, result2, result3} +} + +func (fake *IssueGetter) Invocations() map[string][][]interface{} { + fake.invocationsMutex.RLock() + defer fake.invocationsMutex.RUnlock() + fake.getMutex.RLock() + defer fake.getMutex.RUnlock() + copiedInvocations := map[string][][]interface{}{} + for key, value := range fake.invocations { + copiedInvocations[key] = value + } + return copiedInvocations +} + +func (fake *IssueGetter) recordInvocation(key string, args []interface{}) { + fake.invocationsMutex.Lock() + defer fake.invocationsMutex.Unlock() + if fake.invocations == nil { + fake.invocations = map[string][][]interface{}{} + } + if fake.invocations[key] == nil { + fake.invocations[key] = [][]interface{}{} + } + fake.invocations[key] = append(fake.invocations[key], args) +} diff --git a/pkg/notes/fakes/issues_by_repo_lister.go b/pkg/notes/fakes/issues_by_repo_lister.go new file mode 100644 index 000000000..f63c2368d --- /dev/null +++ b/pkg/notes/fakes/issues_by_repo_lister.go @@ -0,0 +1,126 @@ +// Code generated by counterfeiter. DO NOT EDIT. +package fakes + +import ( + "context" + "sync" + + "github.com/google/go-github/v40/github" +) + +type IssuesByRepoLister struct { + ListByRepoStub func(context.Context, string, string, *github.IssueListByRepoOptions) ([]*github.Issue, *github.Response, error) + listByRepoMutex sync.RWMutex + listByRepoArgsForCall []struct { + arg1 context.Context + arg2 string + arg3 string + arg4 *github.IssueListByRepoOptions + } + listByRepoReturns struct { + result1 []*github.Issue + result2 *github.Response + result3 error + } + listByRepoReturnsOnCall map[int]struct { + result1 []*github.Issue + result2 *github.Response + result3 error + } + invocations map[string][][]interface{} + invocationsMutex sync.RWMutex +} + +func (fake *IssuesByRepoLister) ListByRepo(arg1 context.Context, arg2 string, arg3 string, arg4 *github.IssueListByRepoOptions) ([]*github.Issue, *github.Response, error) { + fake.listByRepoMutex.Lock() + ret, specificReturn := fake.listByRepoReturnsOnCall[len(fake.listByRepoArgsForCall)] + fake.listByRepoArgsForCall = append(fake.listByRepoArgsForCall, struct { + arg1 context.Context + arg2 string + arg3 string + arg4 *github.IssueListByRepoOptions + }{arg1, arg2, arg3, arg4}) + stub := fake.ListByRepoStub + fakeReturns := fake.listByRepoReturns + fake.recordInvocation("ListByRepo", []interface{}{arg1, arg2, arg3, arg4}) + fake.listByRepoMutex.Unlock() + if stub != nil { + return stub(arg1, arg2, arg3, arg4) + } + if specificReturn { + return ret.result1, ret.result2, ret.result3 + } + return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 +} + +func (fake *IssuesByRepoLister) ListByRepoCallCount() int { + fake.listByRepoMutex.RLock() + defer fake.listByRepoMutex.RUnlock() + return len(fake.listByRepoArgsForCall) +} + +func (fake *IssuesByRepoLister) ListByRepoCalls(stub func(context.Context, string, string, *github.IssueListByRepoOptions) ([]*github.Issue, *github.Response, error)) { + fake.listByRepoMutex.Lock() + defer fake.listByRepoMutex.Unlock() + fake.ListByRepoStub = stub +} + +func (fake *IssuesByRepoLister) ListByRepoArgsForCall(i int) (context.Context, string, string, *github.IssueListByRepoOptions) { + fake.listByRepoMutex.RLock() + defer fake.listByRepoMutex.RUnlock() + argsForCall := fake.listByRepoArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4 +} + +func (fake *IssuesByRepoLister) ListByRepoReturns(result1 []*github.Issue, result2 *github.Response, result3 error) { + fake.listByRepoMutex.Lock() + defer fake.listByRepoMutex.Unlock() + fake.ListByRepoStub = nil + fake.listByRepoReturns = struct { + result1 []*github.Issue + result2 *github.Response + result3 error + }{result1, result2, result3} +} + +func (fake *IssuesByRepoLister) ListByRepoReturnsOnCall(i int, result1 []*github.Issue, result2 *github.Response, result3 error) { + fake.listByRepoMutex.Lock() + defer fake.listByRepoMutex.Unlock() + fake.ListByRepoStub = nil + if fake.listByRepoReturnsOnCall == nil { + fake.listByRepoReturnsOnCall = make(map[int]struct { + result1 []*github.Issue + result2 *github.Response + result3 error + }) + } + fake.listByRepoReturnsOnCall[i] = struct { + result1 []*github.Issue + result2 *github.Response + result3 error + }{result1, result2, result3} +} + +func (fake *IssuesByRepoLister) Invocations() map[string][][]interface{} { + fake.invocationsMutex.RLock() + defer fake.invocationsMutex.RUnlock() + fake.listByRepoMutex.RLock() + defer fake.listByRepoMutex.RUnlock() + copiedInvocations := map[string][][]interface{}{} + for key, value := range fake.invocations { + copiedInvocations[key] = value + } + return copiedInvocations +} + +func (fake *IssuesByRepoLister) recordInvocation(key string, args []interface{}) { + fake.invocationsMutex.Lock() + defer fake.invocationsMutex.Unlock() + if fake.invocations == nil { + fake.invocations = map[string][][]interface{}{} + } + if fake.invocations[key] == nil { + fake.invocations[key] = [][]interface{}{} + } + fake.invocations[key] = append(fake.invocations[key], args) +} diff --git a/pkg/notes/fakes/issues_service.go b/pkg/notes/fakes/issues_service.go new file mode 100644 index 000000000..fb4af88f0 --- /dev/null +++ b/pkg/notes/fakes/issues_service.go @@ -0,0 +1,306 @@ +// Code generated by counterfeiter. DO NOT EDIT. +package fakes + +import ( + "context" + "sync" + + "github.com/google/go-github/v40/github" +) + +type IssuesService struct { + GetStub func(context.Context, string, string, int) (*github.Issue, *github.Response, error) + getMutex sync.RWMutex + getArgsForCall []struct { + arg1 context.Context + arg2 string + arg3 string + arg4 int + } + getReturns struct { + result1 *github.Issue + result2 *github.Response + result3 error + } + getReturnsOnCall map[int]struct { + result1 *github.Issue + result2 *github.Response + result3 error + } + ListByRepoStub func(context.Context, string, string, *github.IssueListByRepoOptions) ([]*github.Issue, *github.Response, error) + listByRepoMutex sync.RWMutex + listByRepoArgsForCall []struct { + arg1 context.Context + arg2 string + arg3 string + arg4 *github.IssueListByRepoOptions + } + listByRepoReturns struct { + result1 []*github.Issue + result2 *github.Response + result3 error + } + listByRepoReturnsOnCall map[int]struct { + result1 []*github.Issue + result2 *github.Response + result3 error + } + ListMilestonesStub func(context.Context, string, string, *github.MilestoneListOptions) ([]*github.Milestone, *github.Response, error) + listMilestonesMutex sync.RWMutex + listMilestonesArgsForCall []struct { + arg1 context.Context + arg2 string + arg3 string + arg4 *github.MilestoneListOptions + } + listMilestonesReturns struct { + result1 []*github.Milestone + result2 *github.Response + result3 error + } + listMilestonesReturnsOnCall map[int]struct { + result1 []*github.Milestone + result2 *github.Response + result3 error + } + invocations map[string][][]interface{} + invocationsMutex sync.RWMutex +} + +func (fake *IssuesService) Get(arg1 context.Context, arg2 string, arg3 string, arg4 int) (*github.Issue, *github.Response, error) { + fake.getMutex.Lock() + ret, specificReturn := fake.getReturnsOnCall[len(fake.getArgsForCall)] + fake.getArgsForCall = append(fake.getArgsForCall, struct { + arg1 context.Context + arg2 string + arg3 string + arg4 int + }{arg1, arg2, arg3, arg4}) + stub := fake.GetStub + fakeReturns := fake.getReturns + fake.recordInvocation("Get", []interface{}{arg1, arg2, arg3, arg4}) + fake.getMutex.Unlock() + if stub != nil { + return stub(arg1, arg2, arg3, arg4) + } + if specificReturn { + return ret.result1, ret.result2, ret.result3 + } + return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 +} + +func (fake *IssuesService) GetCallCount() int { + fake.getMutex.RLock() + defer fake.getMutex.RUnlock() + return len(fake.getArgsForCall) +} + +func (fake *IssuesService) GetCalls(stub func(context.Context, string, string, int) (*github.Issue, *github.Response, error)) { + fake.getMutex.Lock() + defer fake.getMutex.Unlock() + fake.GetStub = stub +} + +func (fake *IssuesService) GetArgsForCall(i int) (context.Context, string, string, int) { + fake.getMutex.RLock() + defer fake.getMutex.RUnlock() + argsForCall := fake.getArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4 +} + +func (fake *IssuesService) GetReturns(result1 *github.Issue, result2 *github.Response, result3 error) { + fake.getMutex.Lock() + defer fake.getMutex.Unlock() + fake.GetStub = nil + fake.getReturns = struct { + result1 *github.Issue + result2 *github.Response + result3 error + }{result1, result2, result3} +} + +func (fake *IssuesService) GetReturnsOnCall(i int, result1 *github.Issue, result2 *github.Response, result3 error) { + fake.getMutex.Lock() + defer fake.getMutex.Unlock() + fake.GetStub = nil + if fake.getReturnsOnCall == nil { + fake.getReturnsOnCall = make(map[int]struct { + result1 *github.Issue + result2 *github.Response + result3 error + }) + } + fake.getReturnsOnCall[i] = struct { + result1 *github.Issue + result2 *github.Response + result3 error + }{result1, result2, result3} +} + +func (fake *IssuesService) ListByRepo(arg1 context.Context, arg2 string, arg3 string, arg4 *github.IssueListByRepoOptions) ([]*github.Issue, *github.Response, error) { + fake.listByRepoMutex.Lock() + ret, specificReturn := fake.listByRepoReturnsOnCall[len(fake.listByRepoArgsForCall)] + fake.listByRepoArgsForCall = append(fake.listByRepoArgsForCall, struct { + arg1 context.Context + arg2 string + arg3 string + arg4 *github.IssueListByRepoOptions + }{arg1, arg2, arg3, arg4}) + stub := fake.ListByRepoStub + fakeReturns := fake.listByRepoReturns + fake.recordInvocation("ListByRepo", []interface{}{arg1, arg2, arg3, arg4}) + fake.listByRepoMutex.Unlock() + if stub != nil { + return stub(arg1, arg2, arg3, arg4) + } + if specificReturn { + return ret.result1, ret.result2, ret.result3 + } + return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 +} + +func (fake *IssuesService) ListByRepoCallCount() int { + fake.listByRepoMutex.RLock() + defer fake.listByRepoMutex.RUnlock() + return len(fake.listByRepoArgsForCall) +} + +func (fake *IssuesService) ListByRepoCalls(stub func(context.Context, string, string, *github.IssueListByRepoOptions) ([]*github.Issue, *github.Response, error)) { + fake.listByRepoMutex.Lock() + defer fake.listByRepoMutex.Unlock() + fake.ListByRepoStub = stub +} + +func (fake *IssuesService) ListByRepoArgsForCall(i int) (context.Context, string, string, *github.IssueListByRepoOptions) { + fake.listByRepoMutex.RLock() + defer fake.listByRepoMutex.RUnlock() + argsForCall := fake.listByRepoArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4 +} + +func (fake *IssuesService) ListByRepoReturns(result1 []*github.Issue, result2 *github.Response, result3 error) { + fake.listByRepoMutex.Lock() + defer fake.listByRepoMutex.Unlock() + fake.ListByRepoStub = nil + fake.listByRepoReturns = struct { + result1 []*github.Issue + result2 *github.Response + result3 error + }{result1, result2, result3} +} + +func (fake *IssuesService) ListByRepoReturnsOnCall(i int, result1 []*github.Issue, result2 *github.Response, result3 error) { + fake.listByRepoMutex.Lock() + defer fake.listByRepoMutex.Unlock() + fake.ListByRepoStub = nil + if fake.listByRepoReturnsOnCall == nil { + fake.listByRepoReturnsOnCall = make(map[int]struct { + result1 []*github.Issue + result2 *github.Response + result3 error + }) + } + fake.listByRepoReturnsOnCall[i] = struct { + result1 []*github.Issue + result2 *github.Response + result3 error + }{result1, result2, result3} +} + +func (fake *IssuesService) ListMilestones(arg1 context.Context, arg2 string, arg3 string, arg4 *github.MilestoneListOptions) ([]*github.Milestone, *github.Response, error) { + fake.listMilestonesMutex.Lock() + ret, specificReturn := fake.listMilestonesReturnsOnCall[len(fake.listMilestonesArgsForCall)] + fake.listMilestonesArgsForCall = append(fake.listMilestonesArgsForCall, struct { + arg1 context.Context + arg2 string + arg3 string + arg4 *github.MilestoneListOptions + }{arg1, arg2, arg3, arg4}) + stub := fake.ListMilestonesStub + fakeReturns := fake.listMilestonesReturns + fake.recordInvocation("ListMilestones", []interface{}{arg1, arg2, arg3, arg4}) + fake.listMilestonesMutex.Unlock() + if stub != nil { + return stub(arg1, arg2, arg3, arg4) + } + if specificReturn { + return ret.result1, ret.result2, ret.result3 + } + return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 +} + +func (fake *IssuesService) ListMilestonesCallCount() int { + fake.listMilestonesMutex.RLock() + defer fake.listMilestonesMutex.RUnlock() + return len(fake.listMilestonesArgsForCall) +} + +func (fake *IssuesService) ListMilestonesCalls(stub func(context.Context, string, string, *github.MilestoneListOptions) ([]*github.Milestone, *github.Response, error)) { + fake.listMilestonesMutex.Lock() + defer fake.listMilestonesMutex.Unlock() + fake.ListMilestonesStub = stub +} + +func (fake *IssuesService) ListMilestonesArgsForCall(i int) (context.Context, string, string, *github.MilestoneListOptions) { + fake.listMilestonesMutex.RLock() + defer fake.listMilestonesMutex.RUnlock() + argsForCall := fake.listMilestonesArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4 +} + +func (fake *IssuesService) ListMilestonesReturns(result1 []*github.Milestone, result2 *github.Response, result3 error) { + fake.listMilestonesMutex.Lock() + defer fake.listMilestonesMutex.Unlock() + fake.ListMilestonesStub = nil + fake.listMilestonesReturns = struct { + result1 []*github.Milestone + result2 *github.Response + result3 error + }{result1, result2, result3} +} + +func (fake *IssuesService) ListMilestonesReturnsOnCall(i int, result1 []*github.Milestone, result2 *github.Response, result3 error) { + fake.listMilestonesMutex.Lock() + defer fake.listMilestonesMutex.Unlock() + fake.ListMilestonesStub = nil + if fake.listMilestonesReturnsOnCall == nil { + fake.listMilestonesReturnsOnCall = make(map[int]struct { + result1 []*github.Milestone + result2 *github.Response + result3 error + }) + } + fake.listMilestonesReturnsOnCall[i] = struct { + result1 []*github.Milestone + result2 *github.Response + result3 error + }{result1, result2, result3} +} + +func (fake *IssuesService) Invocations() map[string][][]interface{} { + fake.invocationsMutex.RLock() + defer fake.invocationsMutex.RUnlock() + fake.getMutex.RLock() + defer fake.getMutex.RUnlock() + fake.listByRepoMutex.RLock() + defer fake.listByRepoMutex.RUnlock() + fake.listMilestonesMutex.RLock() + defer fake.listMilestonesMutex.RUnlock() + copiedInvocations := map[string][][]interface{}{} + for key, value := range fake.invocations { + copiedInvocations[key] = value + } + return copiedInvocations +} + +func (fake *IssuesService) recordInvocation(key string, args []interface{}) { + fake.invocationsMutex.Lock() + defer fake.invocationsMutex.Unlock() + if fake.invocations == nil { + fake.invocations = map[string][][]interface{}{} + } + if fake.invocations[key] == nil { + fake.invocations[key] = [][]interface{}{} + } + fake.invocations[key] = append(fake.invocations[key], args) +} diff --git a/pkg/notes/fakes/milestone_lister.go b/pkg/notes/fakes/milestone_lister.go new file mode 100644 index 000000000..02d2c029d --- /dev/null +++ b/pkg/notes/fakes/milestone_lister.go @@ -0,0 +1,126 @@ +// Code generated by counterfeiter. DO NOT EDIT. +package fakes + +import ( + "context" + "sync" + + "github.com/google/go-github/v40/github" +) + +type MilestoneLister struct { + ListMilestonesStub func(context.Context, string, string, *github.MilestoneListOptions) ([]*github.Milestone, *github.Response, error) + listMilestonesMutex sync.RWMutex + listMilestonesArgsForCall []struct { + arg1 context.Context + arg2 string + arg3 string + arg4 *github.MilestoneListOptions + } + listMilestonesReturns struct { + result1 []*github.Milestone + result2 *github.Response + result3 error + } + listMilestonesReturnsOnCall map[int]struct { + result1 []*github.Milestone + result2 *github.Response + result3 error + } + invocations map[string][][]interface{} + invocationsMutex sync.RWMutex +} + +func (fake *MilestoneLister) ListMilestones(arg1 context.Context, arg2 string, arg3 string, arg4 *github.MilestoneListOptions) ([]*github.Milestone, *github.Response, error) { + fake.listMilestonesMutex.Lock() + ret, specificReturn := fake.listMilestonesReturnsOnCall[len(fake.listMilestonesArgsForCall)] + fake.listMilestonesArgsForCall = append(fake.listMilestonesArgsForCall, struct { + arg1 context.Context + arg2 string + arg3 string + arg4 *github.MilestoneListOptions + }{arg1, arg2, arg3, arg4}) + stub := fake.ListMilestonesStub + fakeReturns := fake.listMilestonesReturns + fake.recordInvocation("ListMilestones", []interface{}{arg1, arg2, arg3, arg4}) + fake.listMilestonesMutex.Unlock() + if stub != nil { + return stub(arg1, arg2, arg3, arg4) + } + if specificReturn { + return ret.result1, ret.result2, ret.result3 + } + return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 +} + +func (fake *MilestoneLister) ListMilestonesCallCount() int { + fake.listMilestonesMutex.RLock() + defer fake.listMilestonesMutex.RUnlock() + return len(fake.listMilestonesArgsForCall) +} + +func (fake *MilestoneLister) ListMilestonesCalls(stub func(context.Context, string, string, *github.MilestoneListOptions) ([]*github.Milestone, *github.Response, error)) { + fake.listMilestonesMutex.Lock() + defer fake.listMilestonesMutex.Unlock() + fake.ListMilestonesStub = stub +} + +func (fake *MilestoneLister) ListMilestonesArgsForCall(i int) (context.Context, string, string, *github.MilestoneListOptions) { + fake.listMilestonesMutex.RLock() + defer fake.listMilestonesMutex.RUnlock() + argsForCall := fake.listMilestonesArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4 +} + +func (fake *MilestoneLister) ListMilestonesReturns(result1 []*github.Milestone, result2 *github.Response, result3 error) { + fake.listMilestonesMutex.Lock() + defer fake.listMilestonesMutex.Unlock() + fake.ListMilestonesStub = nil + fake.listMilestonesReturns = struct { + result1 []*github.Milestone + result2 *github.Response + result3 error + }{result1, result2, result3} +} + +func (fake *MilestoneLister) ListMilestonesReturnsOnCall(i int, result1 []*github.Milestone, result2 *github.Response, result3 error) { + fake.listMilestonesMutex.Lock() + defer fake.listMilestonesMutex.Unlock() + fake.ListMilestonesStub = nil + if fake.listMilestonesReturnsOnCall == nil { + fake.listMilestonesReturnsOnCall = make(map[int]struct { + result1 []*github.Milestone + result2 *github.Response + result3 error + }) + } + fake.listMilestonesReturnsOnCall[i] = struct { + result1 []*github.Milestone + result2 *github.Response + result3 error + }{result1, result2, result3} +} + +func (fake *MilestoneLister) Invocations() map[string][][]interface{} { + fake.invocationsMutex.RLock() + defer fake.invocationsMutex.RUnlock() + fake.listMilestonesMutex.RLock() + defer fake.listMilestonesMutex.RUnlock() + copiedInvocations := map[string][][]interface{}{} + for key, value := range fake.invocations { + copiedInvocations[key] = value + } + return copiedInvocations +} + +func (fake *MilestoneLister) recordInvocation(key string, args []interface{}) { + fake.invocationsMutex.Lock() + defer fake.invocationsMutex.Unlock() + if fake.invocations == nil { + fake.invocations = map[string][][]interface{}{} + } + if fake.invocations[key] == nil { + fake.invocations[key] = [][]interface{}{} + } + fake.invocations[key] = append(fake.invocations[key], args) +} diff --git a/pkg/notes/fakes/releases_service.go b/pkg/notes/fakes/releases_service.go new file mode 100644 index 000000000..0d89fd752 --- /dev/null +++ b/pkg/notes/fakes/releases_service.go @@ -0,0 +1,129 @@ +// Code generated by counterfeiter. DO NOT EDIT. +package fakes + +import ( + "context" + "sync" + + "github.com/google/go-github/v40/github" + "github.com/pivotal-cf/kiln/pkg/cargo" +) + +type ReleaseService struct { + ListReleasesStub func(context.Context, string, string, *github.ListOptions) ([]*github.RepositoryRelease, *github.Response, error) + listReleasesMutex sync.RWMutex + listReleasesArgsForCall []struct { + arg1 context.Context + arg2 string + arg3 string + arg4 *github.ListOptions + } + listReleasesReturns struct { + result1 []*github.RepositoryRelease + result2 *github.Response + result3 error + } + listReleasesReturnsOnCall map[int]struct { + result1 []*github.RepositoryRelease + result2 *github.Response + result3 error + } + invocations map[string][][]interface{} + invocationsMutex sync.RWMutex +} + +func (fake *ReleaseService) ListReleases(arg1 context.Context, arg2 string, arg3 string, arg4 *github.ListOptions) ([]*github.RepositoryRelease, *github.Response, error) { + fake.listReleasesMutex.Lock() + ret, specificReturn := fake.listReleasesReturnsOnCall[len(fake.listReleasesArgsForCall)] + fake.listReleasesArgsForCall = append(fake.listReleasesArgsForCall, struct { + arg1 context.Context + arg2 string + arg3 string + arg4 *github.ListOptions + }{arg1, arg2, arg3, arg4}) + stub := fake.ListReleasesStub + fakeReturns := fake.listReleasesReturns + fake.recordInvocation("ListReleases", []interface{}{arg1, arg2, arg3, arg4}) + fake.listReleasesMutex.Unlock() + if stub != nil { + return stub(arg1, arg2, arg3, arg4) + } + if specificReturn { + return ret.result1, ret.result2, ret.result3 + } + return fakeReturns.result1, fakeReturns.result2, fakeReturns.result3 +} + +func (fake *ReleaseService) ListReleasesCallCount() int { + fake.listReleasesMutex.RLock() + defer fake.listReleasesMutex.RUnlock() + return len(fake.listReleasesArgsForCall) +} + +func (fake *ReleaseService) ListReleasesCalls(stub func(context.Context, string, string, *github.ListOptions) ([]*github.RepositoryRelease, *github.Response, error)) { + fake.listReleasesMutex.Lock() + defer fake.listReleasesMutex.Unlock() + fake.ListReleasesStub = stub +} + +func (fake *ReleaseService) ListReleasesArgsForCall(i int) (context.Context, string, string, *github.ListOptions) { + fake.listReleasesMutex.RLock() + defer fake.listReleasesMutex.RUnlock() + argsForCall := fake.listReleasesArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4 +} + +func (fake *ReleaseService) ListReleasesReturns(result1 []*github.RepositoryRelease, result2 *github.Response, result3 error) { + fake.listReleasesMutex.Lock() + defer fake.listReleasesMutex.Unlock() + fake.ListReleasesStub = nil + fake.listReleasesReturns = struct { + result1 []*github.RepositoryRelease + result2 *github.Response + result3 error + }{result1, result2, result3} +} + +func (fake *ReleaseService) ListReleasesReturnsOnCall(i int, result1 []*github.RepositoryRelease, result2 *github.Response, result3 error) { + fake.listReleasesMutex.Lock() + defer fake.listReleasesMutex.Unlock() + fake.ListReleasesStub = nil + if fake.listReleasesReturnsOnCall == nil { + fake.listReleasesReturnsOnCall = make(map[int]struct { + result1 []*github.RepositoryRelease + result2 *github.Response + result3 error + }) + } + fake.listReleasesReturnsOnCall[i] = struct { + result1 []*github.RepositoryRelease + result2 *github.Response + result3 error + }{result1, result2, result3} +} + +func (fake *ReleaseService) Invocations() map[string][][]interface{} { + fake.invocationsMutex.RLock() + defer fake.invocationsMutex.RUnlock() + fake.listReleasesMutex.RLock() + defer fake.listReleasesMutex.RUnlock() + copiedInvocations := map[string][][]interface{}{} + for key, value := range fake.invocations { + copiedInvocations[key] = value + } + return copiedInvocations +} + +func (fake *ReleaseService) recordInvocation(key string, args []interface{}) { + fake.invocationsMutex.Lock() + defer fake.invocationsMutex.Unlock() + if fake.invocations == nil { + fake.invocations = map[string][][]interface{}{} + } + if fake.invocations[key] == nil { + fake.invocations[key] = [][]interface{}{} + } + fake.invocations[key] = append(fake.invocations[key], args) +} + +var _ cargo.RepositoryReleaseLister = new(ReleaseService) diff --git a/pkg/notes/fakes/revision_resolver.go b/pkg/notes/fakes/revision_resolver.go new file mode 100644 index 000000000..68269f21a --- /dev/null +++ b/pkg/notes/fakes/revision_resolver.go @@ -0,0 +1,114 @@ +// Code generated by counterfeiter. DO NOT EDIT. +package fakes + +import ( + "sync" + + "github.com/go-git/go-git/v5/plumbing" +) + +type RevisionResolver struct { + ResolveRevisionStub func(plumbing.Revision) (*plumbing.Hash, error) + resolveRevisionMutex sync.RWMutex + resolveRevisionArgsForCall []struct { + arg1 plumbing.Revision + } + resolveRevisionReturns struct { + result1 *plumbing.Hash + result2 error + } + resolveRevisionReturnsOnCall map[int]struct { + result1 *plumbing.Hash + result2 error + } + invocations map[string][][]interface{} + invocationsMutex sync.RWMutex +} + +func (fake *RevisionResolver) ResolveRevision(arg1 plumbing.Revision) (*plumbing.Hash, error) { + fake.resolveRevisionMutex.Lock() + ret, specificReturn := fake.resolveRevisionReturnsOnCall[len(fake.resolveRevisionArgsForCall)] + fake.resolveRevisionArgsForCall = append(fake.resolveRevisionArgsForCall, struct { + arg1 plumbing.Revision + }{arg1}) + stub := fake.ResolveRevisionStub + fakeReturns := fake.resolveRevisionReturns + fake.recordInvocation("ResolveRevision", []interface{}{arg1}) + fake.resolveRevisionMutex.Unlock() + if stub != nil { + return stub(arg1) + } + if specificReturn { + return ret.result1, ret.result2 + } + return fakeReturns.result1, fakeReturns.result2 +} + +func (fake *RevisionResolver) ResolveRevisionCallCount() int { + fake.resolveRevisionMutex.RLock() + defer fake.resolveRevisionMutex.RUnlock() + return len(fake.resolveRevisionArgsForCall) +} + +func (fake *RevisionResolver) ResolveRevisionCalls(stub func(plumbing.Revision) (*plumbing.Hash, error)) { + fake.resolveRevisionMutex.Lock() + defer fake.resolveRevisionMutex.Unlock() + fake.ResolveRevisionStub = stub +} + +func (fake *RevisionResolver) ResolveRevisionArgsForCall(i int) plumbing.Revision { + fake.resolveRevisionMutex.RLock() + defer fake.resolveRevisionMutex.RUnlock() + argsForCall := fake.resolveRevisionArgsForCall[i] + return argsForCall.arg1 +} + +func (fake *RevisionResolver) ResolveRevisionReturns(result1 *plumbing.Hash, result2 error) { + fake.resolveRevisionMutex.Lock() + defer fake.resolveRevisionMutex.Unlock() + fake.ResolveRevisionStub = nil + fake.resolveRevisionReturns = struct { + result1 *plumbing.Hash + result2 error + }{result1, result2} +} + +func (fake *RevisionResolver) ResolveRevisionReturnsOnCall(i int, result1 *plumbing.Hash, result2 error) { + fake.resolveRevisionMutex.Lock() + defer fake.resolveRevisionMutex.Unlock() + fake.ResolveRevisionStub = nil + if fake.resolveRevisionReturnsOnCall == nil { + fake.resolveRevisionReturnsOnCall = make(map[int]struct { + result1 *plumbing.Hash + result2 error + }) + } + fake.resolveRevisionReturnsOnCall[i] = struct { + result1 *plumbing.Hash + result2 error + }{result1, result2} +} + +func (fake *RevisionResolver) Invocations() map[string][][]interface{} { + fake.invocationsMutex.RLock() + defer fake.invocationsMutex.RUnlock() + fake.resolveRevisionMutex.RLock() + defer fake.resolveRevisionMutex.RUnlock() + copiedInvocations := map[string][][]interface{}{} + for key, value := range fake.invocations { + copiedInvocations[key] = value + } + return copiedInvocations +} + +func (fake *RevisionResolver) recordInvocation(key string, args []interface{}) { + fake.invocationsMutex.Lock() + defer fake.invocationsMutex.Unlock() + if fake.invocations == nil { + fake.invocations = map[string][][]interface{}{} + } + if fake.invocations[key] == nil { + fake.invocations[key] = [][]interface{}{} + } + fake.invocations[key] = append(fake.invocations[key], args) +}