Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
erlang
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
erlang
Commits
321cfd69
Unverified
Commit
321cfd69
authored
Mar 05, 2019
by
Сергей Прохоров
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add some more metric-based asserts to CT
parent
68ba4e79
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
5 deletions
+20
-5
single_dc_SUITE.erl
test/single_dc_SUITE.erl
+20
-5
No files found.
test/single_dc_SUITE.erl
View file @
321cfd69
...
...
@@ -12,6 +12,7 @@
-
include_lib
(
"common_test/include/ct.hrl"
).
-
include_lib
(
"stdlib/include/assert.hrl"
).
-
define
(
APP
,
mtproto_proxy
).
all
()
->
%% All exported functions of arity 1 whose name ends with "_case"
...
...
@@ -38,6 +39,7 @@ init_per_testcase(Name, Cfg) ->
end_per_testcase
(
Name
,
Cfg
)
->
?
MODULE
:
Name
({
post
,
Cfg
}).
%% @doc Send single packet and receive it back
echo_secure_case
({
pre
,
Cfg
})
->
setup_single
(
?
FUNCTION_NAME
,
?
LINE
,
Cfg
);
echo_secure_case
({
post
,
Cfg
})
->
...
...
@@ -53,19 +55,20 @@ echo_secure_case(Cfg) when is_list(Cfg) ->
ok
=
mtp_test_client
:
close
(
Cli2
),
?
assertEqual
(
Data
,
Packet
),
?
assertEqual
(
1
,
mtp_test_metric
:
get_tags
(
count
,
[
mtproto_proxy
,
in_connection
,
total
],
[
?
FUNCTION_NAME
])),
count
,
[
?
APP
,
in_connection
,
total
],
[
?
FUNCTION_NAME
])),
%% race-condition
%% ?assertEqual(1, mtp_test_metric:get_tags(
%% count, [
mtproto_proxy
,in_connection_closed,total], [?FUNCTION_NAME])),
%% count, [
?APP
,in_connection_closed,total], [?FUNCTION_NAME])),
?
assertEqual
({
1
,
64
,
64
,
64
},
mtp_test_metric
:
get_tags
(
histogram
,
[
mtproto_proxy
,
tg_packet_size
,
bytes
],
histogram
,
[
?
APP
,
tg_packet_size
,
bytes
],
[
upstream_to_downstream
])),
?
assertMatch
({
1
,
_,
_,
_},
% larger because of RPC headers
mtp_test_metric
:
get_tags
(
histogram
,
[
mtproto_proxy
,
tg_packet_size
,
bytes
],
histogram
,
[
?
APP
,
tg_packet_size
,
bytes
],
[
downstream_to_upstream
])).
%% @doc Send many packets and receive them back
echo_abridged_many_packets_case
({
pre
,
Cfg
})
->
setup_single
(
?
FUNCTION_NAME
,
?
LINE
,
Cfg
);
echo_abridged_many_packets_case
({
post
,
Cfg
})
->
...
...
@@ -82,7 +85,19 @@ echo_abridged_many_packets_case(Cfg) when is_list(Cfg) ->
timer
:
sleep
(
10
),
% TODO: some hook in proxy to find when sent
{
ok
,
RecvPackets
,
Cli
}
=
mtp_test_client
:
recv_all
(
Cli2
,
1000
),
ok
=
mtp_test_client
:
close
(
Cli
),
?
assertEqual
(
Packets
,
RecvPackets
).
?
assertEqual
(
Packets
,
RecvPackets
),
?
assertEqual
({
length
(
Packets
),
%total count
iolist_size
(
Packets
),
%total sum
lists
:
min
(
lists
:
map
(
fun
erlang
:
byte_size
/
1
,
Packets
)),
%min
lists
:
max
(
lists
:
map
(
fun
erlang
:
byte_size
/
1
,
Packets
))
%max
},
mtp_test_metric
:
get_tags
(
histogram
,
[
?
APP
,
tg_packet_size
,
bytes
],
[
upstream_to_downstream
])).
%% TODO: backpressure tests
%% TODO: send a lot, not read, and then close test
%% Helpers
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment