@@ -56,7 +56,7 @@ var _ = Describe("runnables", func() {
56
56
57
57
It ("should add WarmupRunnable to the Warmup and LeaderElection group" , func () {
58
58
warmupRunnable := warmupRunnableFunc {
59
- RunFunc : func (c context.Context ) error {
59
+ StartFunc : func (c context.Context ) error {
60
60
<- c .Done ()
61
61
return nil
62
62
},
@@ -72,8 +72,8 @@ var _ = Describe("runnables", func() {
72
72
})
73
73
74
74
It ("should add WarmupRunnable that doesn't needs leader election to warmup group only" , func () {
75
- warmupRunnable := combinedRunnable {
76
- RunFunc : func (c context.Context ) error {
75
+ warmupRunnable := leaderElectionAndWarmupRunnable {
76
+ StartFunc : func (c context.Context ) error {
77
77
<- c .Done ()
78
78
return nil
79
79
},
@@ -93,8 +93,8 @@ var _ = Describe("runnables", func() {
93
93
})
94
94
95
95
It ("should add WarmupRunnable that needs leader election to Warmup and LeaderElection group, not Others" , func () {
96
- warmupRunnable := combinedRunnable {
97
- RunFunc : func (c context.Context ) error {
96
+ warmupRunnable := leaderElectionAndWarmupRunnable {
97
+ StartFunc : func (c context.Context ) error {
98
98
<- c .Done ()
99
99
return nil
100
100
},
@@ -118,7 +118,7 @@ var _ = Describe("runnables", func() {
118
118
var warmupExecuted atomic.Bool
119
119
120
120
warmupRunnable := warmupRunnableFunc {
121
- RunFunc : func (c context.Context ) error {
121
+ StartFunc : func (c context.Context ) error {
122
122
<- c .Done ()
123
123
return nil
124
124
},
@@ -145,7 +145,7 @@ var _ = Describe("runnables", func() {
145
145
expectedErr := fmt .Errorf ("expected warmup error" )
146
146
147
147
warmupRunnable := warmupRunnableFunc {
148
- RunFunc : func (c context.Context ) error {
148
+ StartFunc : func (c context.Context ) error {
149
149
<- c .Done ()
150
150
return nil
151
151
},
@@ -354,29 +354,29 @@ var _ LeaderElectionRunnable = &leaderElectionRunnableFunc{}
354
354
// leaderElectionRunnableFunc is a helper struct that implements LeaderElectionRunnable
355
355
// for testing purposes.
356
356
type leaderElectionRunnableFunc struct {
357
- RunFunc func (context.Context ) error
357
+ StartFunc func (context.Context ) error
358
358
NeedLeaderElectionFunc func () bool
359
359
}
360
360
361
361
func (r leaderElectionRunnableFunc ) Start (ctx context.Context ) error {
362
- return r .RunFunc (ctx )
362
+ return r .StartFunc (ctx )
363
363
}
364
364
365
365
func (r leaderElectionRunnableFunc ) NeedLeaderElection () bool {
366
366
return r .NeedLeaderElectionFunc ()
367
367
}
368
368
369
- var _ WarmupRunnable = & warmupRunnableFunc {}
369
+ var _ warmupRunnable = & warmupRunnableFunc {}
370
370
371
371
// warmupRunnableFunc is a helper struct that implements WarmupRunnable
372
372
// for testing purposes.
373
373
type warmupRunnableFunc struct {
374
- RunFunc func (context.Context ) error
374
+ StartFunc func (context.Context ) error
375
375
WarmupFunc func (context.Context ) error
376
376
}
377
377
378
378
func (r warmupRunnableFunc ) Start (ctx context.Context ) error {
379
- return r .RunFunc (ctx )
379
+ return r .StartFunc (ctx )
380
380
}
381
381
382
382
func (r warmupRunnableFunc ) Warmup (ctx context.Context ) error {
@@ -387,25 +387,25 @@ func (r warmupRunnableFunc) WaitForWarmupComplete(ctx context.Context) bool {
387
387
return true
388
388
}
389
389
390
- // combinedRunnable implements both WarmupRunnable and LeaderElectionRunnable
391
- type combinedRunnable struct {
392
- RunFunc func (context.Context ) error
390
+ // leaderElectionAndWarmupRunnable implements both WarmupRunnable and LeaderElectionRunnable
391
+ type leaderElectionAndWarmupRunnable struct {
392
+ StartFunc func (context.Context ) error
393
393
WarmupFunc func (context.Context ) error
394
394
NeedLeaderElectionFunc func () bool
395
395
}
396
396
397
- func (r combinedRunnable ) Start (ctx context.Context ) error {
398
- return r .RunFunc (ctx )
397
+ func (r leaderElectionAndWarmupRunnable ) Start (ctx context.Context ) error {
398
+ return r .StartFunc (ctx )
399
399
}
400
400
401
- func (r combinedRunnable ) Warmup (ctx context.Context ) error {
401
+ func (r leaderElectionAndWarmupRunnable ) Warmup (ctx context.Context ) error {
402
402
return r .WarmupFunc (ctx )
403
403
}
404
404
405
- func (r combinedRunnable ) WaitForWarmupComplete (ctx context.Context ) bool {
405
+ func (r leaderElectionAndWarmupRunnable ) WaitForWarmupComplete (ctx context.Context ) bool {
406
406
return true
407
407
}
408
408
409
- func (r combinedRunnable ) NeedLeaderElection () bool {
409
+ func (r leaderElectionAndWarmupRunnable ) NeedLeaderElection () bool {
410
410
return r .NeedLeaderElectionFunc ()
411
411
}
0 commit comments