Skip to content

Commit

Permalink
Review comments #1.
Browse files Browse the repository at this point in the history
  • Loading branch information
easwars committed Aug 21, 2020
1 parent b8482a8 commit 342d459
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions balancer/rls/internal/picker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,7 @@ func TestPick_DataCacheMiss_PendingCacheMiss(t *testing.T) {
},
}
if test.defaultPickExists {
p.defaultPick = func(info balancer.PickInfo) (balancer.PickResult, error) {
return defaultPicker.Pick(info)
}
p.defaultPick = defaultPicker.Pick
}

gotResult, err := p.Pick(balancer.PickInfo{
Expand Down Expand Up @@ -472,9 +470,7 @@ func TestPick_DataCacheHit_PendingCacheMiss(t *testing.T) {
},
}
if test.defaultPickExists {
p.defaultPick = func(info balancer.PickInfo) (balancer.PickResult, error) {
return defaultPicker.Pick(info)
}
p.defaultPick = defaultPicker.Pick
}

gotResult, err := p.Pick(balancer.PickInfo{
Expand Down Expand Up @@ -541,6 +537,11 @@ func TestPick_DataCacheHit_PendingCacheHit(t *testing.T) {
desc: "stale entry",
cacheEntry: &cache.Entry{ExpiryTime: time.Now().Add(defaultTestMaxAge)},
},
{
desc: "stale entry with default picker",
cacheEntry: &cache.Entry{ExpiryTime: time.Now().Add(defaultTestMaxAge)},
defaultPickExists: true,
},
{
desc: "entryExpired_defaultPickExists",
cacheEntry: &cache.Entry{},
Expand Down Expand Up @@ -576,9 +577,8 @@ func TestPick_DataCacheHit_PendingCacheHit(t *testing.T) {
if test.defaultPickExists {
p.defaultPick = func(info balancer.PickInfo) (balancer.PickResult, error) {
// We do not expect the default picker to be invoked at all.
// So, if we get here, the test will fail, because it
// expects the pick to be queued.
return balancer.PickResult{}, nil
// So, if we get here, we return an error.
return balancer.PickResult{}, errors.New("default picker invoked when expecting a child pick")
}
}

Expand Down

0 comments on commit 342d459

Please sign in to comment.