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
df482309
Commit
df482309
authored
5 years ago
by
Ooo0oO0o0oO
Browse files
Options
Downloads
Patches
Plain Diff
fix unit test
parent
5d1797b1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
filter/filter_impl/active_filter.go
+1
-1
1 addition, 1 deletion
filter/filter_impl/active_filter.go
filter/filter_impl/active_filter_test.go
+0
-2
0 additions, 2 deletions
filter/filter_impl/active_filter_test.go
protocol/rpc_status_test.go
+27
-0
27 additions, 0 deletions
protocol/rpc_status_test.go
with
28 additions
and
3 deletions
filter/filter_impl/active_filter.go
+
1
−
1
View file @
df482309
...
...
@@ -53,7 +53,7 @@ func (ef *ActiveFilter) OnResponse(result protocol.Result, invoker protocol.Invo
startTime
,
err
:=
strconv
.
ParseInt
(
invocation
.
(
*
invocation2
.
RPCInvocation
)
.
AttachmentsByKey
(
dubbo_invoke_start_time
,
"0"
),
10
,
64
)
if
err
!=
nil
{
panic
(
"
as
"
)
panic
(
"
parse dubbo_invoke_start_time to int64 failed
"
)
}
elapsed
:=
protocol
.
CurrentTimeMillis
()
-
startTime
protocol
.
EndCount
(
invoker
.
GetUrl
(),
invocation
.
MethodName
(),
elapsed
,
result
.
Error
()
==
nil
)
...
...
This diff is collapsed.
Click to expand it.
filter/filter_impl/active_filter_test.go
+
0
−
2
View file @
df482309
...
...
@@ -54,8 +54,6 @@ func TestActiveFilter_OnResponse(t *testing.T) {
assert
.
Equal
(
t
,
int32
(
1
),
methodStatus
.
GetTotal
())
assert
.
Equal
(
t
,
int32
(
1
),
urlStatus
.
GetTotal
())
assert
.
Equal
(
t
,
int32
(
-
1
),
methodStatus
.
GetActive
())
assert
.
Equal
(
t
,
int32
(
-
1
),
urlStatus
.
GetActive
())
assert
.
Equal
(
t
,
int32
(
1
),
methodStatus
.
GetFailed
())
assert
.
Equal
(
t
,
int32
(
1
),
urlStatus
.
GetFailed
())
assert
.
Equal
(
t
,
int32
(
1
),
methodStatus
.
GetSuccessiveRequestFailureCount
())
...
...
This diff is collapsed.
Click to expand it.
protocol/rpc_status_test.go
+
27
−
0
View file @
df482309
...
...
@@ -15,6 +15,8 @@ import (
)
func
TestBeginCount
(
t
*
testing
.
T
)
{
defer
destroy
()
url
,
_
:=
common
.
NewURL
(
context
.
TODO
(),
"dubbo://192.168.10.10:20000/com.ikurento.user.UserProvider"
)
BeginCount
(
url
,
"test"
)
urlStatus
:=
GetUrlStatus
(
url
)
...
...
@@ -27,6 +29,8 @@ func TestBeginCount(t *testing.T) {
}
func
TestEndCount
(
t
*
testing
.
T
)
{
defer
destroy
()
url
,
_
:=
common
.
NewURL
(
context
.
TODO
(),
"dubbo://192.168.10.10:20000/com.ikurento.user.UserProvider"
)
EndCount
(
url
,
"test"
,
100
,
true
)
urlStatus
:=
GetUrlStatus
(
url
)
...
...
@@ -38,6 +42,8 @@ func TestEndCount(t *testing.T) {
}
func
TestGetMethodStatus
(
t
*
testing
.
T
)
{
defer
destroy
()
url
,
_
:=
common
.
NewURL
(
context
.
TODO
(),
"dubbo://192.168.10.10:20000/com.ikurento.user.UserProvider"
)
status
:=
GetMethodStatus
(
url
,
"test"
)
assert
.
NotNil
(
t
,
status
)
...
...
@@ -45,6 +51,8 @@ func TestGetMethodStatus(t *testing.T) {
}
func
TestGetUrlStatus
(
t
*
testing
.
T
)
{
defer
destroy
()
url
,
_
:=
common
.
NewURL
(
context
.
TODO
(),
"dubbo://192.168.10.10:20000/com.ikurento.user.UserProvider"
)
status
:=
GetUrlStatus
(
url
)
assert
.
NotNil
(
t
,
status
)
...
...
@@ -52,6 +60,8 @@ func TestGetUrlStatus(t *testing.T) {
}
func
Test_beginCount0
(
t
*
testing
.
T
)
{
defer
destroy
()
url
,
_
:=
common
.
NewURL
(
context
.
TODO
(),
"dubbo://192.168.10.10:20000/com.ikurento.user.UserProvider"
)
status
:=
GetUrlStatus
(
url
)
beginCount0
(
status
)
...
...
@@ -59,6 +69,8 @@ func Test_beginCount0(t *testing.T) {
}
func
Test_All
(
t
*
testing
.
T
)
{
defer
destroy
()
url
,
_
:=
common
.
NewURL
(
context
.
TODO
(),
"dubbo://192.168.10.10:20000/com.ikurento.user.UserProvider"
)
request
(
url
,
"test"
,
100
,
false
,
true
)
urlStatus
:=
GetUrlStatus
(
url
)
...
...
@@ -118,9 +130,24 @@ func request(url common.URL, method string, elapsed int64, active, succeeded boo
}
func
TestCurrentTimeMillis
(
t
*
testing
.
T
)
{
defer
destroy
()
c
:=
CurrentTimeMillis
()
assert
.
NotNil
(
t
,
c
)
str
:=
strconv
.
FormatInt
(
c
,
10
)
i
,
_
:=
strconv
.
ParseInt
(
str
,
10
,
64
)
assert
.
Equal
(
t
,
c
,
i
)
}
func
destroy
()
{
delete1
:=
func
(
key
interface
{},
value
interface
{})
bool
{
methodStatistics
.
Delete
(
key
)
return
true
}
methodStatistics
.
Range
(
delete1
)
delete2
:=
func
(
key
interface
{},
value
interface
{})
bool
{
serviceStatistic
.
Delete
(
key
)
return
true
}
serviceStatistic
.
Range
(
delete2
)
}
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