Skip to content
Snippets Groups Projects
Commit e7aaeae3 authored by haohongfan's avatar haohongfan
Browse files

fix: fix delete unused var bug

parent 340cf88e
No related branches found
No related tags found
No related merge requests found
...@@ -98,7 +98,7 @@ func TestFailbackRetryOneSuccess(t *testing.T) { ...@@ -98,7 +98,7 @@ func TestFailbackRetryOneSuccess(t *testing.T) {
wg.Add(1) wg.Add(1)
now := time.Now() now := time.Now()
mockSuccResult := &protocol.RPCResult{Rest: rest{tried: 0, success: true}} mockSuccResult := &protocol.RPCResult{Rest: rest{tried: 0, success: true}}
invoker.EXPECT().Invoke(gomock.Any()).DoAndReturn(func() protocol.Result { invoker.EXPECT().Invoke(gomock.Any()).DoAndReturn(func(protocol.Invocation) protocol.Result {
delta := time.Since(now).Nanoseconds() / int64(time.Second) delta := time.Since(now).Nanoseconds() / int64(time.Second)
assert.True(t, delta >= 5) assert.True(t, delta >= 5)
wg.Done() wg.Done()
...@@ -144,7 +144,7 @@ func TestFailbackRetryFailed(t *testing.T) { ...@@ -144,7 +144,7 @@ func TestFailbackRetryFailed(t *testing.T) {
// add retry call that eventually failed. // add retry call that eventually failed.
for i := 0; i < retries; i++ { for i := 0; i < retries; i++ {
j := i + 1 j := i + 1
invoker.EXPECT().Invoke(gomock.Any()).DoAndReturn(func() protocol.Result { invoker.EXPECT().Invoke(gomock.Any()).DoAndReturn(func(protocol.Invocation) protocol.Result {
delta := time.Since(now).Nanoseconds() / int64(time.Second) delta := time.Since(now).Nanoseconds() / int64(time.Second)
assert.True(t, delta >= int64(5*j)) assert.True(t, delta >= int64(5*j))
wg.Done() wg.Done()
...@@ -187,7 +187,7 @@ func TestFailbackRetryFailed10Times(t *testing.T) { ...@@ -187,7 +187,7 @@ func TestFailbackRetryFailed10Times(t *testing.T) {
var wg sync.WaitGroup var wg sync.WaitGroup
wg.Add(10) wg.Add(10)
now := time.Now() now := time.Now()
invoker.EXPECT().Invoke(gomock.Any()).DoAndReturn(func() protocol.Result { invoker.EXPECT().Invoke(gomock.Any()).DoAndReturn(func(protocol.Invocation) protocol.Result {
delta := time.Since(now).Nanoseconds() / int64(time.Second) delta := time.Since(now).Nanoseconds() / int64(time.Second)
assert.True(t, delta >= 5) assert.True(t, delta >= 5)
wg.Done() wg.Done()
......
...@@ -81,7 +81,7 @@ func TestForkingInvokeSuccess(t *testing.T) { ...@@ -81,7 +81,7 @@ func TestForkingInvokeSuccess(t *testing.T) {
invokers = append(invokers, invoker) invokers = append(invokers, invoker)
invoker.EXPECT().IsAvailable().Return(true).AnyTimes() invoker.EXPECT().IsAvailable().Return(true).AnyTimes()
invoker.EXPECT().Invoke(gomock.Any()).DoAndReturn( invoker.EXPECT().Invoke(gomock.Any()).DoAndReturn(
func() protocol.Result { func(protocol.Invocation) protocol.Result {
wg.Done() wg.Done()
return mockResult return mockResult
}) })
...@@ -110,7 +110,7 @@ func TestForkingInvokeTimeout(t *testing.T) { ...@@ -110,7 +110,7 @@ func TestForkingInvokeTimeout(t *testing.T) {
invokers = append(invokers, invoker) invokers = append(invokers, invoker)
invoker.EXPECT().IsAvailable().Return(true).AnyTimes() invoker.EXPECT().IsAvailable().Return(true).AnyTimes()
invoker.EXPECT().Invoke(gomock.Any()).DoAndReturn( invoker.EXPECT().Invoke(gomock.Any()).DoAndReturn(
func() protocol.Result { func(protocol.Invocation) protocol.Result {
time.Sleep(2 * time.Second) time.Sleep(2 * time.Second)
wg.Done() wg.Done()
return mockResult return mockResult
...@@ -142,13 +142,13 @@ func TestForkingInvokeHalfTimeout(t *testing.T) { ...@@ -142,13 +142,13 @@ func TestForkingInvokeHalfTimeout(t *testing.T) {
invoker.EXPECT().IsAvailable().Return(true).AnyTimes() invoker.EXPECT().IsAvailable().Return(true).AnyTimes()
if i == 1 { if i == 1 {
invoker.EXPECT().Invoke(gomock.Any()).DoAndReturn( invoker.EXPECT().Invoke(gomock.Any()).DoAndReturn(
func() protocol.Result { func(protocol.Invocation) protocol.Result {
wg.Done() wg.Done()
return mockResult return mockResult
}) })
} else { } else {
invoker.EXPECT().Invoke(gomock.Any()).DoAndReturn( invoker.EXPECT().Invoke(gomock.Any()).DoAndReturn(
func() protocol.Result { func(protocol.Invocation) protocol.Result {
time.Sleep(2 * time.Second) time.Sleep(2 * time.Second)
wg.Done() wg.Done()
return mockResult return mockResult
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment