mirror of https://github.com/knative/pkg.git
Fix `InitialBuckets()` for statefulSetBuilder's electors (#2483)
* Not all unoppossedElector has universal bucket Some are for StatefulSet and only owns their own * Avoid comparing pointers which may be flaky * Address PR feedback
This commit is contained in:
parent
8db11d0f9f
commit
29f716f18b
|
|
@ -273,7 +273,7 @@ func (ue *unopposedElector) Run(ctx context.Context) {
|
|||
|
||||
func (ue *unopposedElector) InitialBuckets() []reconciler.Bucket {
|
||||
return []reconciler.Bucket{
|
||||
reconciler.UniversalBucket(),
|
||||
ue.bkt,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -384,8 +384,10 @@ func TestStandardBucketName(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestUnopposedElectorInitialBucket(t *testing.T) {
|
||||
u := &unopposedElector{}
|
||||
if u.InitialBuckets()[0] != reconciler.UniversalBucket() {
|
||||
t.Errorf("expected the unopposedElector to return the universal bucket")
|
||||
u := &unopposedElector{
|
||||
bkt: reconciler.UniversalBucket(),
|
||||
}
|
||||
if diff := cmp.Diff(u.InitialBuckets(), []reconciler.Bucket{reconciler.UniversalBucket()}); diff != "" {
|
||||
t.Errorf("unexpected u.InitialBuckets() (-want,+got): %s", diff)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue