Commit bdbe3706 authored by Wandenberg Peixoto's avatar Wandenberg Peixoto

speedup some tests

parent d3c644bf
......@@ -10,12 +10,11 @@ class TestCreateManyChannels < Test::Unit::TestCase
def test_create_many_channels
headers = {'accept' => 'application/json'}
body = 'channel started'
channels_to_be_created = 200
channels_callback = 0;
channels_to_be_created = 4000
EventMachine.run {
i = 0
EM.add_periodic_timer(0.05) do
EM.add_periodic_timer(0.001) do
i += 1
if i <= channels_to_be_created
pub = EventMachine::HttpRequest.new(nginx_address + '/pub?id=ch_test_create_many_channels_' + i.to_s ).post :head => headers, :body => body, :timeout => 30
......@@ -23,9 +22,7 @@ class TestCreateManyChannels < Test::Unit::TestCase
if pub.response_header.status != 200
assert_equal(200, pub.response_header.status, "Channel was not created: ch_test_create_many_channels_" + i.to_s)
end
channels_callback += 1
}
fail_if_connecttion_error(pub)
else
EventMachine.stop
end
......
......@@ -30,6 +30,7 @@ class TestPublishMessages < Test::Unit::TestCase
@header_template = nil
@message_template = "~text~"
@max_reserved_memory = "256m"
@ping_message_interval = nil
end
def test_publish_many_messages_in_the_same_channel
......@@ -53,7 +54,7 @@ class TestPublishMessages < Test::Unit::TestCase
fail_if_connecttion_error(sub)
i = 0
EM.add_periodic_timer(0.05) do
EM.add_periodic_timer(0.001) do
i += 1
if i <= messagens_to_publish
pub = EventMachine::HttpRequest.new(nginx_address + '/pub?id=' + channel.to_s ).post :head => headers, :body => body_prefix + i.to_s, :timeout => 30
......
......@@ -269,7 +269,7 @@ class TestPublisher < Test::Unit::TestCase
i = 0
stored_messages = 0
EM.add_periodic_timer(0.05) do
EM.add_periodic_timer(0.001) do
i += 1
if i <= messagens_to_publish
pub = EventMachine::HttpRequest.new(nginx_address + '/pub?id=' + channel.to_s ).post :head => headers, :body => body_prefix + i.to_s, :timeout => 30
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment