Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
2
22a7f0099
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Summer2022
22a7f0099
Commits
e7aaeae3
Commit
e7aaeae3
authored
5 years ago
by
haohongfan
Browse files
Options
Downloads
Patches
Plain Diff
fix: fix delete unused var bug
parent
340cf88e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cluster/cluster_impl/failback_cluster_test.go
+3
-3
3 additions, 3 deletions
cluster/cluster_impl/failback_cluster_test.go
cluster/cluster_impl/forking_cluster_test.go
+4
-4
4 additions, 4 deletions
cluster/cluster_impl/forking_cluster_test.go
with
7 additions
and
7 deletions
cluster/cluster_impl/failback_cluster_test.go
+
3
−
3
View file @
e7aaeae3
...
@@ -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
()
...
...
This diff is collapsed.
Click to expand it.
cluster/cluster_impl/forking_cluster_test.go
+
4
−
4
View file @
e7aaeae3
...
@@ -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
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment