forked from digitalocean/atc
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fake_image_resource_fetcher.go
133 lines (122 loc) · 5.28 KB
/
fake_image_resource_fetcher.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
// This file was generated by counterfeiter
package imagefakes
import (
"io"
"os"
"sync"
"code.cloudfoundry.org/lager"
"github.com/concourse/atc"
"github.com/concourse/atc/dbng"
"github.com/concourse/atc/worker"
"github.com/concourse/atc/worker/image"
)
type FakeImageResourceFetcher struct {
FetchStub func(logger lager.Logger, signals <-chan os.Signal, resourceUser dbng.ResourceUser, imageResourceType string, imageResourceSource atc.Source, tags atc.Tags, teamID int, customTypes atc.VersionedResourceTypes, imageFetchingDelegate worker.ImageFetchingDelegate, privileged bool) (worker.Volume, io.ReadCloser, atc.Version, error)
fetchMutex sync.RWMutex
fetchArgsForCall []struct {
logger lager.Logger
signals <-chan os.Signal
resourceUser dbng.ResourceUser
imageResourceType string
imageResourceSource atc.Source
tags atc.Tags
teamID int
customTypes atc.VersionedResourceTypes
imageFetchingDelegate worker.ImageFetchingDelegate
privileged bool
}
fetchReturns struct {
result1 worker.Volume
result2 io.ReadCloser
result3 atc.Version
result4 error
}
fetchReturnsOnCall map[int]struct {
result1 worker.Volume
result2 io.ReadCloser
result3 atc.Version
result4 error
}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeImageResourceFetcher) Fetch(logger lager.Logger, signals <-chan os.Signal, resourceUser dbng.ResourceUser, imageResourceType string, imageResourceSource atc.Source, tags atc.Tags, teamID int, customTypes atc.VersionedResourceTypes, imageFetchingDelegate worker.ImageFetchingDelegate, privileged bool) (worker.Volume, io.ReadCloser, atc.Version, error) {
fake.fetchMutex.Lock()
ret, specificReturn := fake.fetchReturnsOnCall[len(fake.fetchArgsForCall)]
fake.fetchArgsForCall = append(fake.fetchArgsForCall, struct {
logger lager.Logger
signals <-chan os.Signal
resourceUser dbng.ResourceUser
imageResourceType string
imageResourceSource atc.Source
tags atc.Tags
teamID int
customTypes atc.VersionedResourceTypes
imageFetchingDelegate worker.ImageFetchingDelegate
privileged bool
}{logger, signals, resourceUser, imageResourceType, imageResourceSource, tags, teamID, customTypes, imageFetchingDelegate, privileged})
fake.recordInvocation("Fetch", []interface{}{logger, signals, resourceUser, imageResourceType, imageResourceSource, tags, teamID, customTypes, imageFetchingDelegate, privileged})
fake.fetchMutex.Unlock()
if fake.FetchStub != nil {
return fake.FetchStub(logger, signals, resourceUser, imageResourceType, imageResourceSource, tags, teamID, customTypes, imageFetchingDelegate, privileged)
}
if specificReturn {
return ret.result1, ret.result2, ret.result3, ret.result4
}
return fake.fetchReturns.result1, fake.fetchReturns.result2, fake.fetchReturns.result3, fake.fetchReturns.result4
}
func (fake *FakeImageResourceFetcher) FetchCallCount() int {
fake.fetchMutex.RLock()
defer fake.fetchMutex.RUnlock()
return len(fake.fetchArgsForCall)
}
func (fake *FakeImageResourceFetcher) FetchArgsForCall(i int) (lager.Logger, <-chan os.Signal, dbng.ResourceUser, string, atc.Source, atc.Tags, int, atc.VersionedResourceTypes, worker.ImageFetchingDelegate, bool) {
fake.fetchMutex.RLock()
defer fake.fetchMutex.RUnlock()
return fake.fetchArgsForCall[i].logger, fake.fetchArgsForCall[i].signals, fake.fetchArgsForCall[i].resourceUser, fake.fetchArgsForCall[i].imageResourceType, fake.fetchArgsForCall[i].imageResourceSource, fake.fetchArgsForCall[i].tags, fake.fetchArgsForCall[i].teamID, fake.fetchArgsForCall[i].customTypes, fake.fetchArgsForCall[i].imageFetchingDelegate, fake.fetchArgsForCall[i].privileged
}
func (fake *FakeImageResourceFetcher) FetchReturns(result1 worker.Volume, result2 io.ReadCloser, result3 atc.Version, result4 error) {
fake.FetchStub = nil
fake.fetchReturns = struct {
result1 worker.Volume
result2 io.ReadCloser
result3 atc.Version
result4 error
}{result1, result2, result3, result4}
}
func (fake *FakeImageResourceFetcher) FetchReturnsOnCall(i int, result1 worker.Volume, result2 io.ReadCloser, result3 atc.Version, result4 error) {
fake.FetchStub = nil
if fake.fetchReturnsOnCall == nil {
fake.fetchReturnsOnCall = make(map[int]struct {
result1 worker.Volume
result2 io.ReadCloser
result3 atc.Version
result4 error
})
}
fake.fetchReturnsOnCall[i] = struct {
result1 worker.Volume
result2 io.ReadCloser
result3 atc.Version
result4 error
}{result1, result2, result3, result4}
}
func (fake *FakeImageResourceFetcher) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.fetchMutex.RLock()
defer fake.fetchMutex.RUnlock()
return fake.invocations
}
func (fake *FakeImageResourceFetcher) 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 _ image.ImageResourceFetcher = new(FakeImageResourceFetcher)