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
80bd622b
Commit
80bd622b
authored
May 18, 2011
by
Rogério Carvalho Schneider
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test using channels-stats location
parent
040ac9d6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
29 additions
and
29 deletions
+29
-29
base_test_case.rb
test/base_test_case.rb
+1
-1
test_channel_statistics.rb
test/test_channel_statistics.rb
+23
-23
test_cleanup_memory.rb
test/test_cleanup_memory.rb
+5
-5
No files found.
test/base_test_case.rb
View file @
80bd622b
...
...
@@ -216,7 +216,7 @@ http {
listen <%=nginx_port%>;
server_name <%=nginx_host%>;
location /channels
_
stats {
location /channels
-
stats {
# activate channels statistics mode for this location
push_stream_channels_statistics;
...
...
test/test_channel_statistics.rb
View file @
80bd622b
...
...
@@ -8,7 +8,7 @@ class TestChannelStatistics < Test::Unit::TestCase
channel
=
'ch_test_get_channel_statistics_whithout_created_channel'
EventMachine
.
run
{
pub_1
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
_
stats?id='
+
channel
.
to_s
).
get
:head
=>
headers
,
:timeout
=>
30
pub_1
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
-
stats?id='
+
channel
.
to_s
).
get
:head
=>
headers
,
:timeout
=>
30
pub_1
.
callback
{
assert_equal
(
404
,
pub_1
.
response_header
.
status
,
"Channel was founded"
)
assert_equal
(
0
,
pub_1
.
response_header
.
content_length
,
"Recieved a non empty response"
)
...
...
@@ -27,7 +27,7 @@ class TestChannelStatistics < Test::Unit::TestCase
publish_message
(
channel
,
headers
,
body
)
EventMachine
.
run
{
pub_2
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
_
stats?id='
+
channel
.
to_s
).
get
:head
=>
headers
,
:timeout
=>
30
pub_2
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
-
stats?id='
+
channel
.
to_s
).
get
:head
=>
headers
,
:timeout
=>
30
pub_2
.
callback
{
assert_equal
(
200
,
pub_2
.
response_header
.
status
,
"Request was not accepted"
)
assert_not_equal
(
0
,
pub_2
.
response_header
.
content_length
,
"Empty response was received"
)
...
...
@@ -48,7 +48,7 @@ class TestChannelStatistics < Test::Unit::TestCase
body
=
'body'
create_channel_by_subscribe
(
channel
,
headers
)
do
pub_1
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
_
stats?id='
+
channel
.
to_s
).
get
:head
=>
headers
,
:timeout
=>
30
pub_1
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
-
stats?id='
+
channel
.
to_s
).
get
:head
=>
headers
,
:timeout
=>
30
pub_1
.
callback
{
assert_equal
(
200
,
pub_1
.
response_header
.
status
,
"Request was not accepted"
)
assert_not_equal
(
0
,
pub_1
.
response_header
.
content_length
,
"Empty response was received"
)
...
...
@@ -67,7 +67,7 @@ class TestChannelStatistics < Test::Unit::TestCase
headers
=
{
'accept'
=>
'application/json'
}
EventMachine
.
run
{
pub_2
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
_
stats?id=ALL'
).
get
:head
=>
headers
,
:timeout
=>
30
pub_2
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
-
stats?id=ALL'
).
get
:head
=>
headers
,
:timeout
=>
30
pub_2
.
callback
{
assert_equal
(
200
,
pub_2
.
response_header
.
status
,
"Request was not accepted"
)
assert_not_equal
(
0
,
pub_2
.
response_header
.
content_length
,
"Empty response was received"
)
...
...
@@ -88,7 +88,7 @@ class TestChannelStatistics < Test::Unit::TestCase
publish_message
(
channel
,
headers
,
body
)
EventMachine
.
run
{
pub_2
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
_
stats?id=ALL'
).
get
:head
=>
headers
,
:timeout
=>
30
pub_2
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
-
stats?id=ALL'
).
get
:head
=>
headers
,
:timeout
=>
30
pub_2
.
callback
{
assert_equal
(
200
,
pub_2
.
response_header
.
status
,
"Request was not accepted"
)
assert_not_equal
(
0
,
pub_2
.
response_header
.
content_length
,
"Empty response was received"
)
...
...
@@ -118,7 +118,7 @@ class TestChannelStatistics < Test::Unit::TestCase
publish_message
(
channel
,
headers
,
body
)
EventMachine
.
run
{
pub_2
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
_
stats?id=ALL'
).
get
:head
=>
headers
,
:timeout
=>
30
pub_2
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
-
stats?id=ALL'
).
get
:head
=>
headers
,
:timeout
=>
30
pub_2
.
callback
{
assert_equal
(
200
,
pub_2
.
response_header
.
status
,
"Request was not accepted"
)
assert_not_equal
(
0
,
pub_2
.
response_header
.
content_length
,
"Empty response was received"
)
...
...
@@ -142,7 +142,7 @@ class TestChannelStatistics < Test::Unit::TestCase
body
=
'body'
create_channel_by_subscribe
(
channel
,
headers
)
do
pub_1
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
_
stats?id=ALL'
).
get
:head
=>
headers
,
:timeout
=>
30
pub_1
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
-
stats?id=ALL'
).
get
:head
=>
headers
,
:timeout
=>
30
pub_1
.
callback
{
assert_equal
(
200
,
pub_1
.
response_header
.
status
,
"Request was not accepted"
)
assert_not_equal
(
0
,
pub_1
.
response_header
.
content_length
,
"Empty response was received"
)
...
...
@@ -162,7 +162,7 @@ class TestChannelStatistics < Test::Unit::TestCase
headers
=
{
'accept'
=>
'application/json'
}
EventMachine
.
run
{
pub_1
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
_
stats'
).
get
:head
=>
headers
,
:timeout
=>
30
pub_1
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
-
stats'
).
get
:head
=>
headers
,
:timeout
=>
30
pub_1
.
callback
{
assert_equal
(
200
,
pub_1
.
response_header
.
status
,
"Don't get channels statistics"
)
assert_not_equal
(
0
,
pub_1
.
response_header
.
content_length
,
"Don't received channels statistics"
)
...
...
@@ -188,7 +188,7 @@ class TestChannelStatistics < Test::Unit::TestCase
publish_message
(
channel
,
headers
,
body
)
EventMachine
.
run
{
pub_2
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
_
stats'
).
get
:head
=>
headers
,
:timeout
=>
30
pub_2
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
-
stats'
).
get
:head
=>
headers
,
:timeout
=>
30
pub_2
.
callback
{
assert_equal
(
200
,
pub_2
.
response_header
.
status
,
"Don't get channels statistics"
)
assert_not_equal
(
0
,
pub_2
.
response_header
.
content_length
,
"Don't received channels statistics"
)
...
...
@@ -221,7 +221,7 @@ class TestChannelStatistics < Test::Unit::TestCase
publish_message
(
channel
,
headers
,
body
)
EventMachine
.
run
{
pub_2
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
_
stats'
).
get
:head
=>
headers
,
:timeout
=>
30
pub_2
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
-
stats'
).
get
:head
=>
headers
,
:timeout
=>
30
pub_2
.
callback
{
assert_equal
(
200
,
pub_2
.
response_header
.
status
,
"Don't get channels statistics"
)
assert_not_equal
(
0
,
pub_2
.
response_header
.
content_length
,
"Don't received channels statistics"
)
...
...
@@ -247,7 +247,7 @@ class TestChannelStatistics < Test::Unit::TestCase
body
=
'body'
create_channel_by_subscribe
(
channel
,
headers
)
do
pub_1
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
_
stats'
).
get
:head
=>
headers
,
:timeout
=>
30
pub_1
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
-
stats'
).
get
:head
=>
headers
,
:timeout
=>
30
pub_1
.
callback
{
assert_equal
(
200
,
pub_1
.
response_header
.
status
,
"Request was not accepted"
)
assert_not_equal
(
0
,
pub_1
.
response_header
.
content_length
,
"Empty response was received"
)
...
...
@@ -266,11 +266,11 @@ class TestChannelStatistics < Test::Unit::TestCase
EventMachine
.
run
{
multi
=
EventMachine
::
MultiRequest
.
new
multi
.
add
(
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
_
stats'
).
get
)
multi
.
add
(
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
_
stats'
).
put
:body
=>
'body'
)
multi
.
add
(
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
_
stats'
).
post
)
multi
.
add
(
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
_
stats'
).
delete
)
multi
.
add
(
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
_
stats'
).
head
)
multi
.
add
(
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
-
stats'
).
get
)
multi
.
add
(
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
-
stats'
).
put
:body
=>
'body'
)
multi
.
add
(
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
-
stats'
).
post
)
multi
.
add
(
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
-
stats'
).
delete
)
multi
.
add
(
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
-
stats'
).
head
)
multi
.
callback
{
assert_equal
(
5
,
multi
.
responses
[
:succeeded
].
length
)
...
...
@@ -308,13 +308,13 @@ class TestChannelStatistics < Test::Unit::TestCase
multi
=
EventMachine
::
MultiRequest
.
new
multi
.
add
(
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
_
stats'
).
get
)
# default content_type
multi
.
add
(
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
_
stats'
).
get
:head
=>
{
'accept'
=>
'text/plain'
})
multi
.
add
(
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
_
stats'
).
get
:head
=>
{
'accept'
=>
'application/json'
})
multi
.
add
(
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
_
stats'
).
get
:head
=>
{
'accept'
=>
'application/yaml'
})
multi
.
add
(
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
_
stats'
).
get
:head
=>
{
'accept'
=>
'application/xml'
})
multi
.
add
(
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
_
stats'
).
get
:head
=>
{
'accept'
=>
'text/x-json'
})
multi
.
add
(
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
_
stats'
).
get
:head
=>
{
'accept'
=>
'text/x-yaml'
})
multi
.
add
(
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
-
stats'
).
get
)
# default content_type
multi
.
add
(
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
-
stats'
).
get
:head
=>
{
'accept'
=>
'text/plain'
})
multi
.
add
(
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
-
stats'
).
get
:head
=>
{
'accept'
=>
'application/json'
})
multi
.
add
(
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
-
stats'
).
get
:head
=>
{
'accept'
=>
'application/yaml'
})
multi
.
add
(
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
-
stats'
).
get
:head
=>
{
'accept'
=>
'application/xml'
})
multi
.
add
(
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
-
stats'
).
get
:head
=>
{
'accept'
=>
'text/x-json'
})
multi
.
add
(
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
-
stats'
).
get
:head
=>
{
'accept'
=>
'text/x-yaml'
})
multi
.
callback
{
assert_equal
(
7
,
multi
.
responses
[
:succeeded
].
length
)
...
...
test/test_cleanup_memory.rb
View file @
80bd622b
...
...
@@ -42,7 +42,7 @@ class TestCreateManyChannels < Test::Unit::TestCase
stored_messages_setp_1
=
0
stored_messages_setp_2
=
0
pub_2
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
_
stats?id='
+
channel
.
to_s
).
get
:head
=>
headers
,
:timeout
=>
60
pub_2
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
-
stats?id='
+
channel
.
to_s
).
get
:head
=>
headers
,
:timeout
=>
60
pub_2
.
callback
{
assert_equal
(
200
,
pub_2
.
response_header
.
status
,
"Don't get channels statistics"
)
assert_not_equal
(
0
,
pub_2
.
response_header
.
content_length
,
"Don't received channels statistics"
)
...
...
@@ -50,7 +50,7 @@ class TestCreateManyChannels < Test::Unit::TestCase
sleep
(
40
)
#wait for message timeout and for cleanup timer
pub_3
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
_
stats?id='
+
channel
.
to_s
).
get
:head
=>
headers
,
:timeout
=>
60
pub_3
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
-
stats?id='
+
channel
.
to_s
).
get
:head
=>
headers
,
:timeout
=>
60
pub_3
.
callback
{
assert_equal
(
200
,
pub_3
.
response_header
.
status
,
"Don't get channels statistics"
)
assert_not_equal
(
0
,
pub_3
.
response_header
.
content_length
,
"Don't received channels statistics"
)
...
...
@@ -101,7 +101,7 @@ class TestCreateManyChannels < Test::Unit::TestCase
EventMachine
.
run
{
channels_setp_1
=
0
channels_setp_2
=
0
pub_2
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
_
stats'
).
get
:head
=>
headers
,
:timeout
=>
60
pub_2
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
-
stats'
).
get
:head
=>
headers
,
:timeout
=>
60
pub_2
.
callback
{
assert_equal
(
200
,
pub_2
.
response_header
.
status
,
"Don't get channels statistics"
)
assert_not_equal
(
0
,
pub_2
.
response_header
.
content_length
,
"Don't received channels statistics"
)
...
...
@@ -111,7 +111,7 @@ class TestCreateManyChannels < Test::Unit::TestCase
sleep
(
45
)
#wait for message timeout and for cleanup timer
pub_3
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
_
stats'
).
get
:head
=>
headers
,
:timeout
=>
60
pub_3
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
-
stats'
).
get
:head
=>
headers
,
:timeout
=>
60
pub_3
.
callback
{
assert_equal
(
200
,
pub_3
.
response_header
.
status
,
"Don't get channels statistics"
)
assert_not_equal
(
0
,
pub_3
.
response_header
.
content_length
,
"Don't received channels statistics"
)
...
...
@@ -123,7 +123,7 @@ class TestCreateManyChannels < Test::Unit::TestCase
pub_4
.
callback
{
assert_equal
(
200
,
pub_4
.
response_header
.
status
,
"Don't get channels statistics"
)
pub_5
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
_
stats'
).
get
:head
=>
headers
,
:timeout
=>
60
pub_5
=
EventMachine
::
HttpRequest
.
new
(
nginx_address
+
'/channels
-
stats'
).
get
:head
=>
headers
,
:timeout
=>
60
pub_5
.
callback
{
assert_equal
(
200
,
pub_5
.
response_header
.
status
,
"Don't get channels statistics"
)
assert_not_equal
(
0
,
pub_5
.
response_header
.
content_length
,
"Don't received channels statistics"
)
...
...
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