Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
nginx-push-stream-module
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
nginx-push-stream-module
Commits
ad816423
Commit
ad816423
authored
Sep 18, 2011
by
Wandenberg Peixoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor sending message in small ranges
parent
4e0d8669
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
44 deletions
+22
-44
test_publish_messages.rb
test/test_publish_messages.rb
+22
-44
No files found.
test/test_publish_messages.rb
View file @
ad816423
...
...
@@ -36,54 +36,32 @@ class TestPublishMessages < Test::Unit::TestCase
headers
=
{
'accept'
=>
'text/html'
}
channel
=
'ch_test_publish_messages_with_different_bytes'
bytes
=
[]
1
.
upto
(
127
)
do
|
i
|
1
.
upto
(
255
)
do
|
j
|
bytes
<<
"%s%s"
%
[
i
.
chr
,
j
.
chr
]
end
end
body
=
bytes
.
join
(
''
)
response
=
''
EventMachine
.
run
{
sub
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/sub/'
+
channel
.
to_s
).
get
:head
=>
headers
sub
.
stream
{
|
chunk
|
response
+=
chunk
if
response
.
include?
(
body
)
assert_equal
(
body
+
"
\r\n
"
,
response
,
"The published message was not received correctly"
)
EventMachine
.
stop
ranges
=
[
1
..
63
,
64
..
127
,
128
..
191
,
192
..
255
]
ranges
.
each
do
|
range
|
bytes
=
[]
range
.
each
do
|
i
|
1
.
upto
(
255
)
do
|
j
|
bytes
<<
"%s%s"
%
[
i
.
chr
,
j
.
chr
]
end
}
pub
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/pub?id='
+
channel
.
to_s
).
post
:head
=>
headers
,
:body
=>
body
,
:timeout
=>
30
add_test_timeout
}
bytes
=
[]
128
.
upto
(
255
)
do
|
i
|
1
.
upto
(
255
)
do
|
j
|
bytes
<<
"%s%s"
%
[
i
.
chr
,
j
.
chr
]
end
end
body
=
bytes
.
join
(
''
)
response
=
''
EventMachine
.
run
{
sub
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/sub/'
+
channel
.
to_s
).
get
:head
=>
headers
sub
.
stream
{
|
chunk
|
response
+=
chunk
if
response
.
include?
(
body
)
assert_equal
(
body
+
"
\r\n
"
,
response
,
"The published message was not received correctly"
)
EventMachine
.
stop
end
body
=
bytes
.
join
(
''
)
response
=
''
EventMachine
.
run
{
sub
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/sub/'
+
channel
.
to_s
).
get
:head
=>
headers
sub
.
stream
{
|
chunk
|
response
+=
chunk
if
response
.
include?
(
body
)
assert_equal
(
body
+
"
\r\n
"
,
response
,
"The published message was not received correctly"
)
EventMachine
.
stop
end
}
pub
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/pub?id='
+
channel
.
to_s
).
post
:head
=>
headers
,
:body
=>
body
,
:timeout
=>
30
add_test_timeout
}
pub
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/pub?id='
+
channel
.
to_s
).
post
:head
=>
headers
,
:body
=>
body
,
:timeout
=>
30
add_test_timeout
(
5
)
}
end
end
def
config_test_publish_many_messages_in_the_same_channel
...
...
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