Commit 781c16b7 authored by Wandenberg's avatar Wandenberg

update nginx_test_helper gem

parent 899c46ac
...@@ -5,7 +5,7 @@ gem 'rake', '~> 10.0.3' ...@@ -5,7 +5,7 @@ gem 'rake', '~> 10.0.3'
group :test do group :test do
gem 'rspec', '~> 2.12.0' gem 'rspec', '~> 2.12.0'
gem 'em-http-request', '~> 1.0.3' gem 'em-http-request', '~> 1.0.3'
gem 'nginx_test_helper', '~> 0.0.1' gem 'nginx_test_helper', '~> 0.1.0'
gem 'jshintrb', '~> 0.2.1' gem 'jshintrb', '~> 0.2.1'
gem 'therubyracer', '~> 0.11.3' gem 'therubyracer', '~> 0.11.3'
gem 'jasmine', '~> 1.3.1' gem 'jasmine', '~> 1.3.1'
......
...@@ -44,7 +44,7 @@ GEM ...@@ -44,7 +44,7 @@ GEM
libv8 (3.11.8.13) libv8 (3.11.8.13)
listen (0.7.2) listen (0.7.2)
multi_json (1.5.0) multi_json (1.5.0)
nginx_test_helper (0.0.1) nginx_test_helper (0.1.0)
popen4 popen4
nokogiri (1.5.6) nokogiri (1.5.6)
open4 (1.3.0) open4 (1.3.0)
...@@ -87,7 +87,7 @@ DEPENDENCIES ...@@ -87,7 +87,7 @@ DEPENDENCIES
jshintrb (~> 0.2.1) jshintrb (~> 0.2.1)
json (~> 1.7.6) json (~> 1.7.6)
listen (~> 0.7.2) listen (~> 0.7.2)
nginx_test_helper (~> 0.0.1) nginx_test_helper (~> 0.1.0)
nokogiri (~> 1.5.6) nokogiri (~> 1.5.6)
rake (~> 10.0.3) rake (~> 10.0.3)
rb-inotify (~> 0.8.8) rb-inotify (~> 0.8.8)
......
...@@ -361,7 +361,7 @@ shared_examples_for "statistics location" do ...@@ -361,7 +361,7 @@ shared_examples_for "statistics location" do
0.step(number_of_channels - 1, 1000) do |i| 0.step(number_of_channels - 1, 1000) do |i|
socket = open_socket(nginx_host, nginx_port) socket = open_socket(nginx_host, nginx_port)
1.upto(1000) do |j| 1.upto(1000) do |j|
headers, body = post_in_socket("/pub?id=#{channel}#{i + j}", body, socket, "}\r\n") headers, body = post_in_socket("/pub?id=#{channel}#{i + j}", body, socket, {:wait_for => "}\r\n"})
headers.should include("HTTP/1.1 200 OK") headers.should include("HTTP/1.1 200 OK")
end end
socket.close socket.close
...@@ -506,7 +506,7 @@ shared_examples_for "statistics location" do ...@@ -506,7 +506,7 @@ shared_examples_for "statistics location" do
0.step(number_of_channels - 1, 1000) do |i| 0.step(number_of_channels - 1, 1000) do |i|
socket = open_socket(nginx_host, nginx_port) socket = open_socket(nginx_host, nginx_port)
1.upto(1000) do |j| 1.upto(1000) do |j|
headers, body = post_in_socket("/pub?id=#{channel}#{i + j}", body, socket, "}\r\n") headers, body = post_in_socket("/pub?id=#{channel}#{i + j}", body, socket, {:wait_for => "}\r\n"})
headers.should include("HTTP/1.1 200 OK") headers.should include("HTTP/1.1 200 OK")
end end
socket.close socket.close
......
...@@ -20,7 +20,7 @@ describe "Keepalive" do ...@@ -20,7 +20,7 @@ describe "Keepalive" do
0.step(channels_to_be_created - 1, 500) do |i| 0.step(channels_to_be_created - 1, 500) do |i|
socket = open_socket(nginx_host, nginx_port) socket = open_socket(nginx_host, nginx_port)
1.upto(500) do |j| 1.upto(500) do |j|
headers, body = post_in_socket("/pub?id=#{channel}#{i + j}", body, socket, "}\r\n") headers, body = post_in_socket("/pub?id=#{channel}#{i + j}", body, socket, {:wait_for => "}\r\n"})
headers.should include("HTTP/1.1 200 OK") headers.should include("HTTP/1.1 200 OK")
end end
socket.close socket.close
...@@ -39,7 +39,7 @@ describe "Keepalive" do ...@@ -39,7 +39,7 @@ describe "Keepalive" do
body.should eql("") body.should eql("")
headers.should include("No channel id provided.") headers.should include("No channel id provided.")
headers, body = post_in_socket("/pub?id=#{channel}", content, socket, "}\r\n") headers, body = post_in_socket("/pub?id=#{channel}", content, socket, {:wait_for => "}\r\n"})
body.should eql("{\"channel\": \"#{channel}\", \"published_messages\": \"1\", \"stored_messages\": \"1\", \"subscribers\": \"0\"}\r\n") body.should eql("{\"channel\": \"#{channel}\", \"published_messages\": \"1\", \"stored_messages\": \"1\", \"subscribers\": \"0\"}\r\n")
headers, body = get_in_socket("/channels-stats", socket) headers, body = get_in_socket("/channels-stats", socket)
...@@ -65,7 +65,7 @@ describe "Keepalive" do ...@@ -65,7 +65,7 @@ describe "Keepalive" do
1.upto(500) do |j| 1.upto(500) do |j|
socket.print(get_messages) socket.print(get_messages)
post_in_socket("/pub?id=#{channel}", "#{body_prefix} #{j.to_s.rjust(3, '0')}", socket_pub, "}\r\n") post_in_socket("/pub?id=#{channel}", "#{body_prefix} #{j.to_s.rjust(3, '0')}", socket_pub, {:wait_for => "}\r\n"})
headers, body = read_response_on_socket(socket, "\r\n0\r\n\r\n") headers, body = read_response_on_socket(socket, "\r\n0\r\n\r\n")
body.should eql("18\r\nmessage to be sent #{j.to_s.rjust(3, '0')}\r\n\r\n0\r\n\r\n") body.should eql("18\r\nmessage to be sent #{j.to_s.rjust(3, '0')}\r\n\r\n0\r\n\r\n")
end end
......
...@@ -31,7 +31,7 @@ describe "Measure Memory" do ...@@ -31,7 +31,7 @@ describe "Measure Memory" do
while (true) do while (true) do
socket.print(post_channel_message) socket.print(post_channel_message)
resp_headers, resp_body = read_response_on_socket(socket, "}\r\n") resp_headers, resp_body = read_response_on_socket(socket, {:wait_for => "}\r\n"})
break unless resp_headers.match(/200 OK/) break unless resp_headers.match(/200 OK/)
end end
socket.close socket.close
...@@ -62,7 +62,7 @@ describe "Measure Memory" do ...@@ -62,7 +62,7 @@ describe "Measure Memory" do
while (true) do while (true) do
post_channel_message = "POST /pub?id=#{channel} HTTP/1.0\r\nContent-Length: #{body.size}\r\n\r\n#{body}" post_channel_message = "POST /pub?id=#{channel} HTTP/1.0\r\nContent-Length: #{body.size}\r\n\r\n#{body}"
socket.print(post_channel_message) socket.print(post_channel_message)
resp_headers, resp_body = read_response_on_socket(socket, "}\r\n") resp_headers, resp_body = read_response_on_socket(socket, {:wait_for => "}\r\n"})
break unless resp_headers.match(/200 OK/) break unless resp_headers.match(/200 OK/)
channel += 1 channel += 1
end end
......
...@@ -134,7 +134,7 @@ describe "Publisher Publishing Messages" do ...@@ -134,7 +134,7 @@ describe "Publisher Publishing Messages" do
0.step(messagens_to_publish - 1, 500) do |i| 0.step(messagens_to_publish - 1, 500) do |i|
socket = open_socket(nginx_host, nginx_port) socket = open_socket(nginx_host, nginx_port)
1.upto(500) do |j| 1.upto(500) do |j|
resp_headers, body = post_in_socket("/pub?id=#{channel}", body_prefix + (i+j).to_s, socket, "}\r\n") resp_headers, body = post_in_socket("/pub?id=#{channel}", body_prefix + (i+j).to_s, socket, {:wait_for => "}\r\n"})
fail("Message was not published: " + body_prefix + (i+j).to_s) unless resp_headers.include?("HTTP/1.1 200 OK") fail("Message was not published: " + body_prefix + (i+j).to_s) unless resp_headers.include?("HTTP/1.1 200 OK")
end end
socket.close socket.close
......
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