@@ -28,17 +28,17 @@ import (
28
28
"sigs.k8s.io/controller-runtime/pkg/recorder"
29
29
)
30
30
31
- // NewFakeResourceLock creates a new FakeResourceLock for use in testing
31
+ // NewResourceLock creates a new ResourceLock for use in testing
32
32
// leader election.
33
- func NewFakeResourceLock (config * rest.Config , recorderProvider recorder.Provider , options leaderelection.Options ) (resourcelock.Interface , error ) {
33
+ func NewResourceLock (config * rest.Config , recorderProvider recorder.Provider , options leaderelection.Options ) (resourcelock.Interface , error ) {
34
34
// Leader id, needs to be unique
35
35
id , err := os .Hostname ()
36
36
if err != nil {
37
37
return nil , err
38
38
}
39
39
id = id + "_" + string (uuid .NewUUID ())
40
40
41
- return & FakeResourceLock {
41
+ return & ResourceLock {
42
42
id : id ,
43
43
record : resourcelock.LeaderElectionRecord {
44
44
HolderIdentity : id ,
@@ -50,41 +50,41 @@ func NewFakeResourceLock(config *rest.Config, recorderProvider recorder.Provider
50
50
}, nil
51
51
}
52
52
53
- // FakeResourceLock implements the ResourceLockInterface.
53
+ // ResourceLock implements the ResourceLockInterface.
54
54
// By default returns that the current identity holds the lock.
55
- type FakeResourceLock struct {
55
+ type ResourceLock struct {
56
56
id string
57
57
record resourcelock.LeaderElectionRecord
58
58
}
59
59
60
60
// Get implements the ResourceLockInterface.
61
- func (f * FakeResourceLock ) Get () (* resourcelock.LeaderElectionRecord , error ) {
61
+ func (f * ResourceLock ) Get () (* resourcelock.LeaderElectionRecord , error ) {
62
62
return & f .record , nil
63
63
}
64
64
65
65
// Create implements the ResourceLockInterface.
66
- func (f * FakeResourceLock ) Create (ler resourcelock.LeaderElectionRecord ) error {
66
+ func (f * ResourceLock ) Create (ler resourcelock.LeaderElectionRecord ) error {
67
67
f .record = ler
68
68
return nil
69
69
}
70
70
71
71
// Update implements the ResourceLockInterface.
72
- func (f * FakeResourceLock ) Update (ler resourcelock.LeaderElectionRecord ) error {
72
+ func (f * ResourceLock ) Update (ler resourcelock.LeaderElectionRecord ) error {
73
73
f .record = ler
74
74
return nil
75
75
}
76
76
77
77
// RecordEvent implements the ResourceLockInterface.
78
- func (f * FakeResourceLock ) RecordEvent (s string ) {
78
+ func (f * ResourceLock ) RecordEvent (s string ) {
79
79
return
80
80
}
81
81
82
- // Idenity implements the ResourceLockInterface.
83
- func (f * FakeResourceLock ) Identity () string {
82
+ // Identity implements the ResourceLockInterface.
83
+ func (f * ResourceLock ) Identity () string {
84
84
return f .id
85
85
}
86
86
87
87
// Describe implements the ResourceLockInterface.
88
- func (f * FakeResourceLock ) Describe () string {
88
+ func (f * ResourceLock ) Describe () string {
89
89
return f .id
90
90
}
0 commit comments