From 207bded5b4507b2110b43dba30a683975b86e9f3 Mon Sep 17 00:00:00 2001 From: Sascha Grunert Date: Thu, 26 Nov 2020 10:41:57 +0100 Subject: [PATCH] Add update-mocks Makefile target The new `update-mocks` Make target allows us to generate the mocks with preserving the boilerplate header. Signed-off-by: Sascha Grunert --- Makefile | 13 +- pkg/anago/anagofakes/fake_release_client.go | 16 + pkg/anago/anagofakes/fake_release_impl.go | 16 + pkg/changelog/changelogfakes/fake_impl.go | 16 + pkg/kubepkg/kubepkgfakes/fake_impl.go | 37 +- pkg/mail/mailfakes/fake_apiclient.go | 7 +- pkg/mail/mailfakes/fake_send_client.go | 7 +- pkg/notes/notesfakes/fake_mo_diff.go | 7 +- pkg/object/objectfakes/fake_store.go | 778 ++++++++++++++++++ .../releasefakes/fake_archiver_impl.go | 16 + pkg/testgrid/testgridfakes/fake_client.go | 7 +- 11 files changed, 890 insertions(+), 30 deletions(-) create mode 100644 pkg/object/objectfakes/fake_store.go diff --git a/Makefile b/Makefile index 87d048a1751..4d5bf918d39 100644 --- a/Makefile +++ b/Makefile @@ -119,8 +119,8 @@ local-image-run: ## Run a locally build image to use the tools of this repositor ##@ Dependencies -.SILENT: update-deps update-deps-go -.PHONY: update-deps update-deps-go +.SILENT: update-deps update-deps-go update-mocks +.PHONY: update-deps update-deps-go update-mocks update-deps: update-deps-go ## Update all dependencies for this repo echo -e "${COLOR}Commit/PR the following changes:${NOCOLOR}" @@ -134,6 +134,15 @@ update-deps-go: ## Update all golang dependencies for this repo $(MAKE) test-go-unit ./hack/update-all.sh +update-mocks: ## Update all generated mocks + go generate ./... + for f in $(shell find . -name fake_*.go); do \ + cp hack/boilerplate/boilerplate.go.txt tmp ;\ + sed -i 's/YEAR/$(shell date +"%Y")/g' tmp ;\ + cat $$f >> tmp ;\ + mv tmp $$f ;\ + done + ##@ Helpers .PHONY: help diff --git a/pkg/anago/anagofakes/fake_release_client.go b/pkg/anago/anagofakes/fake_release_client.go index 8746b5e3e5f..c5b9a6db567 100644 --- a/pkg/anago/anagofakes/fake_release_client.go +++ b/pkg/anago/anagofakes/fake_release_client.go @@ -1,3 +1,19 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + // Code generated by counterfeiter. DO NOT EDIT. package anagofakes diff --git a/pkg/anago/anagofakes/fake_release_impl.go b/pkg/anago/anagofakes/fake_release_impl.go index 14eddb6dbd6..66c135c2654 100644 --- a/pkg/anago/anagofakes/fake_release_impl.go +++ b/pkg/anago/anagofakes/fake_release_impl.go @@ -1,3 +1,19 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + // Code generated by counterfeiter. DO NOT EDIT. package anagofakes diff --git a/pkg/changelog/changelogfakes/fake_impl.go b/pkg/changelog/changelogfakes/fake_impl.go index 8877977e372..574670fa94a 100644 --- a/pkg/changelog/changelogfakes/fake_impl.go +++ b/pkg/changelog/changelogfakes/fake_impl.go @@ -1,3 +1,19 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + // Code generated by counterfeiter. DO NOT EDIT. package changelogfakes diff --git a/pkg/kubepkg/kubepkgfakes/fake_impl.go b/pkg/kubepkg/kubepkgfakes/fake_impl.go index 456c03f52bc..1ffea806617 100644 --- a/pkg/kubepkg/kubepkgfakes/fake_impl.go +++ b/pkg/kubepkg/kubepkgfakes/fake_impl.go @@ -1,5 +1,5 @@ /* -Copyright 2019 The Kubernetes Authors. +Copyright 2020 The Kubernetes Authors. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. @@ -104,15 +104,16 @@ func (fake *FakeImpl) GetKubeVersion(arg1 release.VersionType) (string, error) { fake.getKubeVersionArgsForCall = append(fake.getKubeVersionArgsForCall, struct { arg1 release.VersionType }{arg1}) + stub := fake.GetKubeVersionStub + fakeReturns := fake.getKubeVersionReturns fake.recordInvocation("GetKubeVersion", []interface{}{arg1}) fake.getKubeVersionMutex.Unlock() - if fake.GetKubeVersionStub != nil { - return fake.GetKubeVersionStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.getKubeVersionReturns return fakeReturns.result1, fakeReturns.result2 } @@ -167,15 +168,16 @@ func (fake *FakeImpl) ReadFile(arg1 string) ([]byte, error) { fake.readFileArgsForCall = append(fake.readFileArgsForCall, struct { arg1 string }{arg1}) + stub := fake.ReadFileStub + fakeReturns := fake.readFileReturns fake.recordInvocation("ReadFile", []interface{}{arg1}) fake.readFileMutex.Unlock() - if fake.ReadFileStub != nil { - return fake.ReadFileStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.readFileReturns return fakeReturns.result1, fakeReturns.result2 } @@ -232,15 +234,16 @@ func (fake *FakeImpl) Releases(arg1 string, arg2 string, arg3 bool) ([]*github.R arg2 string arg3 bool }{arg1, arg2, arg3}) + stub := fake.ReleasesStub + fakeReturns := fake.releasesReturns fake.recordInvocation("Releases", []interface{}{arg1, arg2, arg3}) fake.releasesMutex.Unlock() - if fake.ReleasesStub != nil { - return fake.ReleasesStub(arg1, arg2, arg3) + if stub != nil { + return stub(arg1, arg2, arg3) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.releasesReturns return fakeReturns.result1, fakeReturns.result2 } @@ -297,15 +300,16 @@ func (fake *FakeImpl) RunSuccessWithWorkDir(arg1 string, arg2 string, arg3 ...st arg2 string arg3 []string }{arg1, arg2, arg3}) + stub := fake.RunSuccessWithWorkDirStub + fakeReturns := fake.runSuccessWithWorkDirReturns fake.recordInvocation("RunSuccessWithWorkDir", []interface{}{arg1, arg2, arg3}) fake.runSuccessWithWorkDirMutex.Unlock() - if fake.RunSuccessWithWorkDirStub != nil { - return fake.RunSuccessWithWorkDirStub(arg1, arg2, arg3...) + if stub != nil { + return stub(arg1, arg2, arg3...) } if specificReturn { return ret.result1 } - fakeReturns := fake.runSuccessWithWorkDirReturns return fakeReturns.result1 } @@ -364,15 +368,16 @@ func (fake *FakeImpl) WriteFile(arg1 string, arg2 []byte, arg3 os.FileMode) erro arg2 []byte arg3 os.FileMode }{arg1, arg2Copy, arg3}) + stub := fake.WriteFileStub + fakeReturns := fake.writeFileReturns fake.recordInvocation("WriteFile", []interface{}{arg1, arg2Copy, arg3}) fake.writeFileMutex.Unlock() - if fake.WriteFileStub != nil { - return fake.WriteFileStub(arg1, arg2, arg3) + if stub != nil { + return stub(arg1, arg2, arg3) } if specificReturn { return ret.result1 } - fakeReturns := fake.writeFileReturns return fakeReturns.result1 } diff --git a/pkg/mail/mailfakes/fake_apiclient.go b/pkg/mail/mailfakes/fake_apiclient.go index 7b529765652..f1fa6d9ea96 100644 --- a/pkg/mail/mailfakes/fake_apiclient.go +++ b/pkg/mail/mailfakes/fake_apiclient.go @@ -48,15 +48,16 @@ func (fake *FakeAPIClient) API(arg1 rest.Request) (*rest.Response, error) { fake.aPIArgsForCall = append(fake.aPIArgsForCall, struct { arg1 rest.Request }{arg1}) + stub := fake.APIStub + fakeReturns := fake.aPIReturns fake.recordInvocation("API", []interface{}{arg1}) fake.aPIMutex.Unlock() - if fake.APIStub != nil { - return fake.APIStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.aPIReturns return fakeReturns.result1, fakeReturns.result2 } diff --git a/pkg/mail/mailfakes/fake_send_client.go b/pkg/mail/mailfakes/fake_send_client.go index c2290626cc9..607df573f4b 100644 --- a/pkg/mail/mailfakes/fake_send_client.go +++ b/pkg/mail/mailfakes/fake_send_client.go @@ -49,15 +49,16 @@ func (fake *FakeSendClient) Send(arg1 *maila.SGMailV3) (*rest.Response, error) { fake.sendArgsForCall = append(fake.sendArgsForCall, struct { arg1 *maila.SGMailV3 }{arg1}) + stub := fake.SendStub + fakeReturns := fake.sendReturns fake.recordInvocation("Send", []interface{}{arg1}) fake.sendMutex.Unlock() - if fake.SendStub != nil { - return fake.SendStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.sendReturns return fakeReturns.result1, fakeReturns.result2 } diff --git a/pkg/notes/notesfakes/fake_mo_diff.go b/pkg/notes/notesfakes/fake_mo_diff.go index 9800f5fbb1c..3174e0c376d 100644 --- a/pkg/notes/notesfakes/fake_mo_diff.go +++ b/pkg/notes/notesfakes/fake_mo_diff.go @@ -48,15 +48,16 @@ func (fake *FakeMoDiff) Run(arg1 *modiff.Config) (string, error) { fake.runArgsForCall = append(fake.runArgsForCall, struct { arg1 *modiff.Config }{arg1}) + stub := fake.RunStub + fakeReturns := fake.runReturns fake.recordInvocation("Run", []interface{}{arg1}) fake.runMutex.Unlock() - if fake.RunStub != nil { - return fake.RunStub(arg1) + if stub != nil { + return stub(arg1) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.runReturns return fakeReturns.result1, fakeReturns.result2 } diff --git a/pkg/object/objectfakes/fake_store.go b/pkg/object/objectfakes/fake_store.go new file mode 100644 index 00000000000..6de825ea3bc --- /dev/null +++ b/pkg/object/objectfakes/fake_store.go @@ -0,0 +1,778 @@ +// Code generated by counterfeiter. DO NOT EDIT. +package objectfakes + +import ( + "sync" + + "k8s.io/release/pkg/object" +) + +type FakeStore struct { + CopyBucketToBucketStub func(string, string) error + copyBucketToBucketMutex sync.RWMutex + copyBucketToBucketArgsForCall []struct { + arg1 string + arg2 string + } + copyBucketToBucketReturns struct { + result1 error + } + copyBucketToBucketReturnsOnCall map[int]struct { + result1 error + } + CopyToLocalStub func(string, string) error + copyToLocalMutex sync.RWMutex + copyToLocalArgsForCall []struct { + arg1 string + arg2 string + } + copyToLocalReturns struct { + result1 error + } + copyToLocalReturnsOnCall map[int]struct { + result1 error + } + CopyToRemoteStub func(string, string) error + copyToRemoteMutex sync.RWMutex + copyToRemoteArgsForCall []struct { + arg1 string + arg2 string + } + copyToRemoteReturns struct { + result1 error + } + copyToRemoteReturnsOnCall map[int]struct { + result1 error + } + GetMarkerPathStub func(string, string) (string, error) + getMarkerPathMutex sync.RWMutex + getMarkerPathArgsForCall []struct { + arg1 string + arg2 string + } + getMarkerPathReturns struct { + result1 string + result2 error + } + getMarkerPathReturnsOnCall map[int]struct { + result1 string + result2 error + } + GetReleasePathStub func(string, string, string, bool) (string, error) + getReleasePathMutex sync.RWMutex + getReleasePathArgsForCall []struct { + arg1 string + arg2 string + arg3 string + arg4 bool + } + getReleasePathReturns struct { + result1 string + result2 error + } + getReleasePathReturnsOnCall map[int]struct { + result1 string + result2 error + } + IsPathNormalizedStub func(string) bool + isPathNormalizedMutex sync.RWMutex + isPathNormalizedArgsForCall []struct { + arg1 string + } + isPathNormalizedReturns struct { + result1 bool + } + isPathNormalizedReturnsOnCall map[int]struct { + result1 bool + } + NormalizePathStub func(...string) (string, error) + normalizePathMutex sync.RWMutex + normalizePathArgsForCall []struct { + arg1 []string + } + normalizePathReturns struct { + result1 string + result2 error + } + normalizePathReturnsOnCall map[int]struct { + result1 string + result2 error + } + PathExistsStub func(string) (bool, error) + pathExistsMutex sync.RWMutex + pathExistsArgsForCall []struct { + arg1 string + } + pathExistsReturns struct { + result1 bool + result2 error + } + pathExistsReturnsOnCall map[int]struct { + result1 bool + result2 error + } + RsyncRecursiveStub func(string, string) error + rsyncRecursiveMutex sync.RWMutex + rsyncRecursiveArgsForCall []struct { + arg1 string + arg2 string + } + rsyncRecursiveReturns struct { + result1 error + } + rsyncRecursiveReturnsOnCall map[int]struct { + result1 error + } + SetOptionsStub func(...object.OptFn) + setOptionsMutex sync.RWMutex + setOptionsArgsForCall []struct { + arg1 []object.OptFn + } + invocations map[string][][]interface{} + invocationsMutex sync.RWMutex +} + +func (fake *FakeStore) CopyBucketToBucket(arg1 string, arg2 string) error { + fake.copyBucketToBucketMutex.Lock() + ret, specificReturn := fake.copyBucketToBucketReturnsOnCall[len(fake.copyBucketToBucketArgsForCall)] + fake.copyBucketToBucketArgsForCall = append(fake.copyBucketToBucketArgsForCall, struct { + arg1 string + arg2 string + }{arg1, arg2}) + stub := fake.CopyBucketToBucketStub + fakeReturns := fake.copyBucketToBucketReturns + fake.recordInvocation("CopyBucketToBucket", []interface{}{arg1, arg2}) + fake.copyBucketToBucketMutex.Unlock() + if stub != nil { + return stub(arg1, arg2) + } + if specificReturn { + return ret.result1 + } + return fakeReturns.result1 +} + +func (fake *FakeStore) CopyBucketToBucketCallCount() int { + fake.copyBucketToBucketMutex.RLock() + defer fake.copyBucketToBucketMutex.RUnlock() + return len(fake.copyBucketToBucketArgsForCall) +} + +func (fake *FakeStore) CopyBucketToBucketCalls(stub func(string, string) error) { + fake.copyBucketToBucketMutex.Lock() + defer fake.copyBucketToBucketMutex.Unlock() + fake.CopyBucketToBucketStub = stub +} + +func (fake *FakeStore) CopyBucketToBucketArgsForCall(i int) (string, string) { + fake.copyBucketToBucketMutex.RLock() + defer fake.copyBucketToBucketMutex.RUnlock() + argsForCall := fake.copyBucketToBucketArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2 +} + +func (fake *FakeStore) CopyBucketToBucketReturns(result1 error) { + fake.copyBucketToBucketMutex.Lock() + defer fake.copyBucketToBucketMutex.Unlock() + fake.CopyBucketToBucketStub = nil + fake.copyBucketToBucketReturns = struct { + result1 error + }{result1} +} + +func (fake *FakeStore) CopyBucketToBucketReturnsOnCall(i int, result1 error) { + fake.copyBucketToBucketMutex.Lock() + defer fake.copyBucketToBucketMutex.Unlock() + fake.CopyBucketToBucketStub = nil + if fake.copyBucketToBucketReturnsOnCall == nil { + fake.copyBucketToBucketReturnsOnCall = make(map[int]struct { + result1 error + }) + } + fake.copyBucketToBucketReturnsOnCall[i] = struct { + result1 error + }{result1} +} + +func (fake *FakeStore) CopyToLocal(arg1 string, arg2 string) error { + fake.copyToLocalMutex.Lock() + ret, specificReturn := fake.copyToLocalReturnsOnCall[len(fake.copyToLocalArgsForCall)] + fake.copyToLocalArgsForCall = append(fake.copyToLocalArgsForCall, struct { + arg1 string + arg2 string + }{arg1, arg2}) + stub := fake.CopyToLocalStub + fakeReturns := fake.copyToLocalReturns + fake.recordInvocation("CopyToLocal", []interface{}{arg1, arg2}) + fake.copyToLocalMutex.Unlock() + if stub != nil { + return stub(arg1, arg2) + } + if specificReturn { + return ret.result1 + } + return fakeReturns.result1 +} + +func (fake *FakeStore) CopyToLocalCallCount() int { + fake.copyToLocalMutex.RLock() + defer fake.copyToLocalMutex.RUnlock() + return len(fake.copyToLocalArgsForCall) +} + +func (fake *FakeStore) CopyToLocalCalls(stub func(string, string) error) { + fake.copyToLocalMutex.Lock() + defer fake.copyToLocalMutex.Unlock() + fake.CopyToLocalStub = stub +} + +func (fake *FakeStore) CopyToLocalArgsForCall(i int) (string, string) { + fake.copyToLocalMutex.RLock() + defer fake.copyToLocalMutex.RUnlock() + argsForCall := fake.copyToLocalArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2 +} + +func (fake *FakeStore) CopyToLocalReturns(result1 error) { + fake.copyToLocalMutex.Lock() + defer fake.copyToLocalMutex.Unlock() + fake.CopyToLocalStub = nil + fake.copyToLocalReturns = struct { + result1 error + }{result1} +} + +func (fake *FakeStore) CopyToLocalReturnsOnCall(i int, result1 error) { + fake.copyToLocalMutex.Lock() + defer fake.copyToLocalMutex.Unlock() + fake.CopyToLocalStub = nil + if fake.copyToLocalReturnsOnCall == nil { + fake.copyToLocalReturnsOnCall = make(map[int]struct { + result1 error + }) + } + fake.copyToLocalReturnsOnCall[i] = struct { + result1 error + }{result1} +} + +func (fake *FakeStore) CopyToRemote(arg1 string, arg2 string) error { + fake.copyToRemoteMutex.Lock() + ret, specificReturn := fake.copyToRemoteReturnsOnCall[len(fake.copyToRemoteArgsForCall)] + fake.copyToRemoteArgsForCall = append(fake.copyToRemoteArgsForCall, struct { + arg1 string + arg2 string + }{arg1, arg2}) + stub := fake.CopyToRemoteStub + fakeReturns := fake.copyToRemoteReturns + fake.recordInvocation("CopyToRemote", []interface{}{arg1, arg2}) + fake.copyToRemoteMutex.Unlock() + if stub != nil { + return stub(arg1, arg2) + } + if specificReturn { + return ret.result1 + } + return fakeReturns.result1 +} + +func (fake *FakeStore) CopyToRemoteCallCount() int { + fake.copyToRemoteMutex.RLock() + defer fake.copyToRemoteMutex.RUnlock() + return len(fake.copyToRemoteArgsForCall) +} + +func (fake *FakeStore) CopyToRemoteCalls(stub func(string, string) error) { + fake.copyToRemoteMutex.Lock() + defer fake.copyToRemoteMutex.Unlock() + fake.CopyToRemoteStub = stub +} + +func (fake *FakeStore) CopyToRemoteArgsForCall(i int) (string, string) { + fake.copyToRemoteMutex.RLock() + defer fake.copyToRemoteMutex.RUnlock() + argsForCall := fake.copyToRemoteArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2 +} + +func (fake *FakeStore) CopyToRemoteReturns(result1 error) { + fake.copyToRemoteMutex.Lock() + defer fake.copyToRemoteMutex.Unlock() + fake.CopyToRemoteStub = nil + fake.copyToRemoteReturns = struct { + result1 error + }{result1} +} + +func (fake *FakeStore) CopyToRemoteReturnsOnCall(i int, result1 error) { + fake.copyToRemoteMutex.Lock() + defer fake.copyToRemoteMutex.Unlock() + fake.CopyToRemoteStub = nil + if fake.copyToRemoteReturnsOnCall == nil { + fake.copyToRemoteReturnsOnCall = make(map[int]struct { + result1 error + }) + } + fake.copyToRemoteReturnsOnCall[i] = struct { + result1 error + }{result1} +} + +func (fake *FakeStore) GetMarkerPath(arg1 string, arg2 string) (string, error) { + fake.getMarkerPathMutex.Lock() + ret, specificReturn := fake.getMarkerPathReturnsOnCall[len(fake.getMarkerPathArgsForCall)] + fake.getMarkerPathArgsForCall = append(fake.getMarkerPathArgsForCall, struct { + arg1 string + arg2 string + }{arg1, arg2}) + stub := fake.GetMarkerPathStub + fakeReturns := fake.getMarkerPathReturns + fake.recordInvocation("GetMarkerPath", []interface{}{arg1, arg2}) + fake.getMarkerPathMutex.Unlock() + if stub != nil { + return stub(arg1, arg2) + } + if specificReturn { + return ret.result1, ret.result2 + } + return fakeReturns.result1, fakeReturns.result2 +} + +func (fake *FakeStore) GetMarkerPathCallCount() int { + fake.getMarkerPathMutex.RLock() + defer fake.getMarkerPathMutex.RUnlock() + return len(fake.getMarkerPathArgsForCall) +} + +func (fake *FakeStore) GetMarkerPathCalls(stub func(string, string) (string, error)) { + fake.getMarkerPathMutex.Lock() + defer fake.getMarkerPathMutex.Unlock() + fake.GetMarkerPathStub = stub +} + +func (fake *FakeStore) GetMarkerPathArgsForCall(i int) (string, string) { + fake.getMarkerPathMutex.RLock() + defer fake.getMarkerPathMutex.RUnlock() + argsForCall := fake.getMarkerPathArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2 +} + +func (fake *FakeStore) GetMarkerPathReturns(result1 string, result2 error) { + fake.getMarkerPathMutex.Lock() + defer fake.getMarkerPathMutex.Unlock() + fake.GetMarkerPathStub = nil + fake.getMarkerPathReturns = struct { + result1 string + result2 error + }{result1, result2} +} + +func (fake *FakeStore) GetMarkerPathReturnsOnCall(i int, result1 string, result2 error) { + fake.getMarkerPathMutex.Lock() + defer fake.getMarkerPathMutex.Unlock() + fake.GetMarkerPathStub = nil + if fake.getMarkerPathReturnsOnCall == nil { + fake.getMarkerPathReturnsOnCall = make(map[int]struct { + result1 string + result2 error + }) + } + fake.getMarkerPathReturnsOnCall[i] = struct { + result1 string + result2 error + }{result1, result2} +} + +func (fake *FakeStore) GetReleasePath(arg1 string, arg2 string, arg3 string, arg4 bool) (string, error) { + fake.getReleasePathMutex.Lock() + ret, specificReturn := fake.getReleasePathReturnsOnCall[len(fake.getReleasePathArgsForCall)] + fake.getReleasePathArgsForCall = append(fake.getReleasePathArgsForCall, struct { + arg1 string + arg2 string + arg3 string + arg4 bool + }{arg1, arg2, arg3, arg4}) + stub := fake.GetReleasePathStub + fakeReturns := fake.getReleasePathReturns + fake.recordInvocation("GetReleasePath", []interface{}{arg1, arg2, arg3, arg4}) + fake.getReleasePathMutex.Unlock() + if stub != nil { + return stub(arg1, arg2, arg3, arg4) + } + if specificReturn { + return ret.result1, ret.result2 + } + return fakeReturns.result1, fakeReturns.result2 +} + +func (fake *FakeStore) GetReleasePathCallCount() int { + fake.getReleasePathMutex.RLock() + defer fake.getReleasePathMutex.RUnlock() + return len(fake.getReleasePathArgsForCall) +} + +func (fake *FakeStore) GetReleasePathCalls(stub func(string, string, string, bool) (string, error)) { + fake.getReleasePathMutex.Lock() + defer fake.getReleasePathMutex.Unlock() + fake.GetReleasePathStub = stub +} + +func (fake *FakeStore) GetReleasePathArgsForCall(i int) (string, string, string, bool) { + fake.getReleasePathMutex.RLock() + defer fake.getReleasePathMutex.RUnlock() + argsForCall := fake.getReleasePathArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2, argsForCall.arg3, argsForCall.arg4 +} + +func (fake *FakeStore) GetReleasePathReturns(result1 string, result2 error) { + fake.getReleasePathMutex.Lock() + defer fake.getReleasePathMutex.Unlock() + fake.GetReleasePathStub = nil + fake.getReleasePathReturns = struct { + result1 string + result2 error + }{result1, result2} +} + +func (fake *FakeStore) GetReleasePathReturnsOnCall(i int, result1 string, result2 error) { + fake.getReleasePathMutex.Lock() + defer fake.getReleasePathMutex.Unlock() + fake.GetReleasePathStub = nil + if fake.getReleasePathReturnsOnCall == nil { + fake.getReleasePathReturnsOnCall = make(map[int]struct { + result1 string + result2 error + }) + } + fake.getReleasePathReturnsOnCall[i] = struct { + result1 string + result2 error + }{result1, result2} +} + +func (fake *FakeStore) IsPathNormalized(arg1 string) bool { + fake.isPathNormalizedMutex.Lock() + ret, specificReturn := fake.isPathNormalizedReturnsOnCall[len(fake.isPathNormalizedArgsForCall)] + fake.isPathNormalizedArgsForCall = append(fake.isPathNormalizedArgsForCall, struct { + arg1 string + }{arg1}) + stub := fake.IsPathNormalizedStub + fakeReturns := fake.isPathNormalizedReturns + fake.recordInvocation("IsPathNormalized", []interface{}{arg1}) + fake.isPathNormalizedMutex.Unlock() + if stub != nil { + return stub(arg1) + } + if specificReturn { + return ret.result1 + } + return fakeReturns.result1 +} + +func (fake *FakeStore) IsPathNormalizedCallCount() int { + fake.isPathNormalizedMutex.RLock() + defer fake.isPathNormalizedMutex.RUnlock() + return len(fake.isPathNormalizedArgsForCall) +} + +func (fake *FakeStore) IsPathNormalizedCalls(stub func(string) bool) { + fake.isPathNormalizedMutex.Lock() + defer fake.isPathNormalizedMutex.Unlock() + fake.IsPathNormalizedStub = stub +} + +func (fake *FakeStore) IsPathNormalizedArgsForCall(i int) string { + fake.isPathNormalizedMutex.RLock() + defer fake.isPathNormalizedMutex.RUnlock() + argsForCall := fake.isPathNormalizedArgsForCall[i] + return argsForCall.arg1 +} + +func (fake *FakeStore) IsPathNormalizedReturns(result1 bool) { + fake.isPathNormalizedMutex.Lock() + defer fake.isPathNormalizedMutex.Unlock() + fake.IsPathNormalizedStub = nil + fake.isPathNormalizedReturns = struct { + result1 bool + }{result1} +} + +func (fake *FakeStore) IsPathNormalizedReturnsOnCall(i int, result1 bool) { + fake.isPathNormalizedMutex.Lock() + defer fake.isPathNormalizedMutex.Unlock() + fake.IsPathNormalizedStub = nil + if fake.isPathNormalizedReturnsOnCall == nil { + fake.isPathNormalizedReturnsOnCall = make(map[int]struct { + result1 bool + }) + } + fake.isPathNormalizedReturnsOnCall[i] = struct { + result1 bool + }{result1} +} + +func (fake *FakeStore) NormalizePath(arg1 ...string) (string, error) { + fake.normalizePathMutex.Lock() + ret, specificReturn := fake.normalizePathReturnsOnCall[len(fake.normalizePathArgsForCall)] + fake.normalizePathArgsForCall = append(fake.normalizePathArgsForCall, struct { + arg1 []string + }{arg1}) + stub := fake.NormalizePathStub + fakeReturns := fake.normalizePathReturns + fake.recordInvocation("NormalizePath", []interface{}{arg1}) + fake.normalizePathMutex.Unlock() + if stub != nil { + return stub(arg1...) + } + if specificReturn { + return ret.result1, ret.result2 + } + return fakeReturns.result1, fakeReturns.result2 +} + +func (fake *FakeStore) NormalizePathCallCount() int { + fake.normalizePathMutex.RLock() + defer fake.normalizePathMutex.RUnlock() + return len(fake.normalizePathArgsForCall) +} + +func (fake *FakeStore) NormalizePathCalls(stub func(...string) (string, error)) { + fake.normalizePathMutex.Lock() + defer fake.normalizePathMutex.Unlock() + fake.NormalizePathStub = stub +} + +func (fake *FakeStore) NormalizePathArgsForCall(i int) []string { + fake.normalizePathMutex.RLock() + defer fake.normalizePathMutex.RUnlock() + argsForCall := fake.normalizePathArgsForCall[i] + return argsForCall.arg1 +} + +func (fake *FakeStore) NormalizePathReturns(result1 string, result2 error) { + fake.normalizePathMutex.Lock() + defer fake.normalizePathMutex.Unlock() + fake.NormalizePathStub = nil + fake.normalizePathReturns = struct { + result1 string + result2 error + }{result1, result2} +} + +func (fake *FakeStore) NormalizePathReturnsOnCall(i int, result1 string, result2 error) { + fake.normalizePathMutex.Lock() + defer fake.normalizePathMutex.Unlock() + fake.NormalizePathStub = nil + if fake.normalizePathReturnsOnCall == nil { + fake.normalizePathReturnsOnCall = make(map[int]struct { + result1 string + result2 error + }) + } + fake.normalizePathReturnsOnCall[i] = struct { + result1 string + result2 error + }{result1, result2} +} + +func (fake *FakeStore) PathExists(arg1 string) (bool, error) { + fake.pathExistsMutex.Lock() + ret, specificReturn := fake.pathExistsReturnsOnCall[len(fake.pathExistsArgsForCall)] + fake.pathExistsArgsForCall = append(fake.pathExistsArgsForCall, struct { + arg1 string + }{arg1}) + stub := fake.PathExistsStub + fakeReturns := fake.pathExistsReturns + fake.recordInvocation("PathExists", []interface{}{arg1}) + fake.pathExistsMutex.Unlock() + if stub != nil { + return stub(arg1) + } + if specificReturn { + return ret.result1, ret.result2 + } + return fakeReturns.result1, fakeReturns.result2 +} + +func (fake *FakeStore) PathExistsCallCount() int { + fake.pathExistsMutex.RLock() + defer fake.pathExistsMutex.RUnlock() + return len(fake.pathExistsArgsForCall) +} + +func (fake *FakeStore) PathExistsCalls(stub func(string) (bool, error)) { + fake.pathExistsMutex.Lock() + defer fake.pathExistsMutex.Unlock() + fake.PathExistsStub = stub +} + +func (fake *FakeStore) PathExistsArgsForCall(i int) string { + fake.pathExistsMutex.RLock() + defer fake.pathExistsMutex.RUnlock() + argsForCall := fake.pathExistsArgsForCall[i] + return argsForCall.arg1 +} + +func (fake *FakeStore) PathExistsReturns(result1 bool, result2 error) { + fake.pathExistsMutex.Lock() + defer fake.pathExistsMutex.Unlock() + fake.PathExistsStub = nil + fake.pathExistsReturns = struct { + result1 bool + result2 error + }{result1, result2} +} + +func (fake *FakeStore) PathExistsReturnsOnCall(i int, result1 bool, result2 error) { + fake.pathExistsMutex.Lock() + defer fake.pathExistsMutex.Unlock() + fake.PathExistsStub = nil + if fake.pathExistsReturnsOnCall == nil { + fake.pathExistsReturnsOnCall = make(map[int]struct { + result1 bool + result2 error + }) + } + fake.pathExistsReturnsOnCall[i] = struct { + result1 bool + result2 error + }{result1, result2} +} + +func (fake *FakeStore) RsyncRecursive(arg1 string, arg2 string) error { + fake.rsyncRecursiveMutex.Lock() + ret, specificReturn := fake.rsyncRecursiveReturnsOnCall[len(fake.rsyncRecursiveArgsForCall)] + fake.rsyncRecursiveArgsForCall = append(fake.rsyncRecursiveArgsForCall, struct { + arg1 string + arg2 string + }{arg1, arg2}) + stub := fake.RsyncRecursiveStub + fakeReturns := fake.rsyncRecursiveReturns + fake.recordInvocation("RsyncRecursive", []interface{}{arg1, arg2}) + fake.rsyncRecursiveMutex.Unlock() + if stub != nil { + return stub(arg1, arg2) + } + if specificReturn { + return ret.result1 + } + return fakeReturns.result1 +} + +func (fake *FakeStore) RsyncRecursiveCallCount() int { + fake.rsyncRecursiveMutex.RLock() + defer fake.rsyncRecursiveMutex.RUnlock() + return len(fake.rsyncRecursiveArgsForCall) +} + +func (fake *FakeStore) RsyncRecursiveCalls(stub func(string, string) error) { + fake.rsyncRecursiveMutex.Lock() + defer fake.rsyncRecursiveMutex.Unlock() + fake.RsyncRecursiveStub = stub +} + +func (fake *FakeStore) RsyncRecursiveArgsForCall(i int) (string, string) { + fake.rsyncRecursiveMutex.RLock() + defer fake.rsyncRecursiveMutex.RUnlock() + argsForCall := fake.rsyncRecursiveArgsForCall[i] + return argsForCall.arg1, argsForCall.arg2 +} + +func (fake *FakeStore) RsyncRecursiveReturns(result1 error) { + fake.rsyncRecursiveMutex.Lock() + defer fake.rsyncRecursiveMutex.Unlock() + fake.RsyncRecursiveStub = nil + fake.rsyncRecursiveReturns = struct { + result1 error + }{result1} +} + +func (fake *FakeStore) RsyncRecursiveReturnsOnCall(i int, result1 error) { + fake.rsyncRecursiveMutex.Lock() + defer fake.rsyncRecursiveMutex.Unlock() + fake.RsyncRecursiveStub = nil + if fake.rsyncRecursiveReturnsOnCall == nil { + fake.rsyncRecursiveReturnsOnCall = make(map[int]struct { + result1 error + }) + } + fake.rsyncRecursiveReturnsOnCall[i] = struct { + result1 error + }{result1} +} + +func (fake *FakeStore) SetOptions(arg1 ...object.OptFn) { + fake.setOptionsMutex.Lock() + fake.setOptionsArgsForCall = append(fake.setOptionsArgsForCall, struct { + arg1 []object.OptFn + }{arg1}) + stub := fake.SetOptionsStub + fake.recordInvocation("SetOptions", []interface{}{arg1}) + fake.setOptionsMutex.Unlock() + if stub != nil { + fake.SetOptionsStub(arg1...) + } +} + +func (fake *FakeStore) SetOptionsCallCount() int { + fake.setOptionsMutex.RLock() + defer fake.setOptionsMutex.RUnlock() + return len(fake.setOptionsArgsForCall) +} + +func (fake *FakeStore) SetOptionsCalls(stub func(...object.OptFn)) { + fake.setOptionsMutex.Lock() + defer fake.setOptionsMutex.Unlock() + fake.SetOptionsStub = stub +} + +func (fake *FakeStore) SetOptionsArgsForCall(i int) []object.OptFn { + fake.setOptionsMutex.RLock() + defer fake.setOptionsMutex.RUnlock() + argsForCall := fake.setOptionsArgsForCall[i] + return argsForCall.arg1 +} + +func (fake *FakeStore) Invocations() map[string][][]interface{} { + fake.invocationsMutex.RLock() + defer fake.invocationsMutex.RUnlock() + fake.copyBucketToBucketMutex.RLock() + defer fake.copyBucketToBucketMutex.RUnlock() + fake.copyToLocalMutex.RLock() + defer fake.copyToLocalMutex.RUnlock() + fake.copyToRemoteMutex.RLock() + defer fake.copyToRemoteMutex.RUnlock() + fake.getMarkerPathMutex.RLock() + defer fake.getMarkerPathMutex.RUnlock() + fake.getReleasePathMutex.RLock() + defer fake.getReleasePathMutex.RUnlock() + fake.isPathNormalizedMutex.RLock() + defer fake.isPathNormalizedMutex.RUnlock() + fake.normalizePathMutex.RLock() + defer fake.normalizePathMutex.RUnlock() + fake.pathExistsMutex.RLock() + defer fake.pathExistsMutex.RUnlock() + fake.rsyncRecursiveMutex.RLock() + defer fake.rsyncRecursiveMutex.RUnlock() + fake.setOptionsMutex.RLock() + defer fake.setOptionsMutex.RUnlock() + copiedInvocations := map[string][][]interface{}{} + for key, value := range fake.invocations { + copiedInvocations[key] = value + } + return copiedInvocations +} + +func (fake *FakeStore) 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 _ object.Store = new(FakeStore) diff --git a/pkg/release/releasefakes/fake_archiver_impl.go b/pkg/release/releasefakes/fake_archiver_impl.go index d304b90c440..f7cd99f927a 100644 --- a/pkg/release/releasefakes/fake_archiver_impl.go +++ b/pkg/release/releasefakes/fake_archiver_impl.go @@ -1,3 +1,19 @@ +/* +Copyright 2020 The Kubernetes Authors. + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + // Code generated by counterfeiter. DO NOT EDIT. package releasefakes diff --git a/pkg/testgrid/testgridfakes/fake_client.go b/pkg/testgrid/testgridfakes/fake_client.go index f98868b6d9b..778cc01ee5d 100644 --- a/pkg/testgrid/testgridfakes/fake_client.go +++ b/pkg/testgrid/testgridfakes/fake_client.go @@ -49,15 +49,16 @@ func (fake *FakeClient) GetURLResponse(arg1 string, arg2 bool) (string, error) { arg1 string arg2 bool }{arg1, arg2}) + stub := fake.GetURLResponseStub + fakeReturns := fake.getURLResponseReturns fake.recordInvocation("GetURLResponse", []interface{}{arg1, arg2}) fake.getURLResponseMutex.Unlock() - if fake.GetURLResponseStub != nil { - return fake.GetURLResponseStub(arg1, arg2) + if stub != nil { + return stub(arg1, arg2) } if specificReturn { return ret.result1, ret.result2 } - fakeReturns := fake.getURLResponseReturns return fakeReturns.result1, fakeReturns.result2 }