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
91af3d05
Commit
91af3d05
authored
Aug 29, 2011
by
Wandenberg Peixoto
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding test to publish a message with different chars on content
parent
2a83fa53
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
62 additions
and
0 deletions
+62
-0
test_publish_messages.rb
test/test_publish_messages.rb
+62
-0
No files found.
test/test_publish_messages.rb
View file @
91af3d05
...
...
@@ -24,6 +24,68 @@ class TestPublishMessages < Test::Unit::TestCase
}
end
def
config_test_publish_messages_with_different_bytes
@header_template
=
nil
@message_template
=
"~text~"
@ping_message_interval
=
nil
@client_max_body_size
=
'65k'
@client_body_buffer_size
=
'65k'
end
def
test_publish_messages_with_different_bytes
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
end
}
pub
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/pub?id='
+
channel
.
to_s
).
post
:head
=>
headers
,
:body
=>
body
,
:timeout
=>
30
add_test_timeout
(
5
)
}
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
}
pub
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/pub?id='
+
channel
.
to_s
).
post
:head
=>
headers
,
:body
=>
body
,
:timeout
=>
30
add_test_timeout
(
5
)
}
end
def
config_test_publish_many_messages_in_the_same_channel
@header_template
=
nil
@message_template
=
"~text~"
...
...
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