This repository has been archived by the owner on Mar 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 115
/
fake_build_tracker.go
79 lines (69 loc) · 2.06 KB
/
fake_build_tracker.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
// Code generated by counterfeiter. DO NOT EDIT.
package buildsfakes
import (
"sync"
"github.com/concourse/atc/builds"
)
type FakeBuildTracker struct {
TrackStub func()
trackMutex sync.RWMutex
trackArgsForCall []struct{}
ReleaseStub func()
releaseMutex sync.RWMutex
releaseArgsForCall []struct{}
invocations map[string][][]interface{}
invocationsMutex sync.RWMutex
}
func (fake *FakeBuildTracker) Track() {
fake.trackMutex.Lock()
fake.trackArgsForCall = append(fake.trackArgsForCall, struct{}{})
fake.recordInvocation("Track", []interface{}{})
fake.trackMutex.Unlock()
if fake.TrackStub != nil {
fake.TrackStub()
}
}
func (fake *FakeBuildTracker) TrackCallCount() int {
fake.trackMutex.RLock()
defer fake.trackMutex.RUnlock()
return len(fake.trackArgsForCall)
}
func (fake *FakeBuildTracker) Release() {
fake.releaseMutex.Lock()
fake.releaseArgsForCall = append(fake.releaseArgsForCall, struct{}{})
fake.recordInvocation("Release", []interface{}{})
fake.releaseMutex.Unlock()
if fake.ReleaseStub != nil {
fake.ReleaseStub()
}
}
func (fake *FakeBuildTracker) ReleaseCallCount() int {
fake.releaseMutex.RLock()
defer fake.releaseMutex.RUnlock()
return len(fake.releaseArgsForCall)
}
func (fake *FakeBuildTracker) Invocations() map[string][][]interface{} {
fake.invocationsMutex.RLock()
defer fake.invocationsMutex.RUnlock()
fake.trackMutex.RLock()
defer fake.trackMutex.RUnlock()
fake.releaseMutex.RLock()
defer fake.releaseMutex.RUnlock()
copiedInvocations := map[string][][]interface{}{}
for key, value := range fake.invocations {
copiedInvocations[key] = value
}
return copiedInvocations
}
func (fake *FakeBuildTracker) 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 _ builds.BuildTracker = new(FakeBuildTracker)