it"should not accept '0' as ping message interval"do
it"should not accept '0' as ping message interval"do
nginx_test_configuration({:ping_message_interval=>0}).shouldinclude("push_stream_ping_message_interval cannot be zero")
expect(nginx_test_configuration({:ping_message_interval=>0})).toinclude("push_stream_ping_message_interval cannot be zero")
end
end
it"should not accept a blank message template"do
it"should not accept a blank message template"do
nginx_test_configuration({:message_template=>""}).shouldinclude("push_stream_message_template cannot be blank")
expect(nginx_test_configuration({:message_template=>""})).toinclude("push_stream_message_template cannot be blank")
end
end
it"should not accept '0' as subscriber connection ttl"do
it"should not accept '0' as subscriber connection ttl"do
nginx_test_configuration({:subscriber_connection_ttl=>0}).shouldinclude("push_stream_subscriber_connection_ttl cannot be zero")
expect(nginx_test_configuration({:subscriber_connection_ttl=>0})).toinclude("push_stream_subscriber_connection_ttl cannot be zero")
end
end
it"should not accept '0' as long polling subscriber connection ttl"do
it"should not accept '0' as long polling subscriber connection ttl"do
nginx_test_configuration({:longpolling_connection_ttl=>0}).shouldinclude("push_stream_longpolling_connection_ttl cannot be zero")
expect(nginx_test_configuration({:longpolling_connection_ttl=>0})).toinclude("push_stream_longpolling_connection_ttl cannot be zero")
end
end
it"should not accept '0' as max channel id length"do
it"should not accept '0' as max channel id length"do
nginx_test_configuration({:max_channel_id_length=>0}).shouldinclude("push_stream_max_channel_id_length cannot be zero")
expect(nginx_test_configuration({:max_channel_id_length=>0})).toinclude("push_stream_max_channel_id_length cannot be zero")
end
end
it"should not accept '0' as message ttl"do
it"should not accept '0' as message ttl"do
nginx_test_configuration({:message_ttl=>0}).shouldinclude("push_stream_message_ttl cannot be zero")
expect(nginx_test_configuration({:message_ttl=>0})).toinclude("push_stream_message_ttl cannot be zero")
end
end
it"should not accept '0' as max subscribers per channel"do
it"should not accept '0' as max subscribers per channel"do
nginx_test_configuration({:max_subscribers_per_channel=>0}).shouldinclude("push_stream_max_subscribers_per_channel cannot be zero")
expect(nginx_test_configuration({:max_subscribers_per_channel=>0})).toinclude("push_stream_max_subscribers_per_channel cannot be zero")
end
end
it"should not accept '0' as max messages stored per channel"do
it"should not accept '0' as max messages stored per channel"do
nginx_test_configuration({:max_messages_stored_per_channel=>0}).shouldinclude("push_stream_max_messages_stored_per_channel cannot be zero")
expect(nginx_test_configuration({:max_messages_stored_per_channel=>0})).toinclude("push_stream_max_messages_stored_per_channel cannot be zero")
end
end
it"should not accept '0' as max number of channels"do
it"should not accept '0' as max number of channels"do
nginx_test_configuration({:max_number_of_channels=>0}).shouldinclude("push_stream_max_number_of_channels cannot be zero")
expect(nginx_test_configuration({:max_number_of_channels=>0})).toinclude("push_stream_max_number_of_channels cannot be zero")
end
end
it"should not accept '0' as max number of wildcard channels"do
it"should not accept '0' as max number of wildcard channels"do
nginx_test_configuration({:max_number_of_wildcard_channels=>0}).shouldinclude("push_stream_max_number_of_wildcard_channels cannot be zero")
expect(nginx_test_configuration({:max_number_of_wildcard_channels=>0})).toinclude("push_stream_max_number_of_wildcard_channels cannot be zero")
end
end
it"should not accept '0' as max wildcard channels"do
it"should not accept '0' as max wildcard channels"do
nginx_test_configuration({:wildcard_channel_max_qtd=>0}).shouldinclude("push_stream_wildcard_channel_max_qtd cannot be zero")
expect(nginx_test_configuration({:wildcard_channel_max_qtd=>0})).toinclude("push_stream_wildcard_channel_max_qtd cannot be zero")
end
end
it"should not set max wildcard channels without set boadcast channel prefix"do
it"should not set max wildcard channels without set boadcast channel prefix"do
nginx_test_configuration({:wildcard_channel_max_qtd=>1,:wildcard_channel_prefix=>""}).shouldinclude("cannot set wildcard channel max qtd if push_stream_wildcard_channel_prefix is not set or blank")
expect(nginx_test_configuration({:wildcard_channel_max_qtd=>1,:wildcard_channel_prefix=>""})).toinclude("cannot set wildcard channel max qtd if push_stream_wildcard_channel_prefix is not set or blank")
end
end
it"should not accept '0' as max number of wildcard channels"do
it"should not accept '0' as max number of wildcard channels"do
nginx_test_configuration(config).shouldinclude("max number of wildcard channels cannot be smaller than value in push_stream_wildcard_channel_max_qtd")
expect(nginx_test_configuration(config)).toinclude("max number of wildcard channels cannot be smaller than value in push_stream_wildcard_channel_max_qtd")
end
end
it"should accept a configuration without http block"do
it"should accept a configuration without http block"do
...
@@ -70,48 +70,48 @@ describe "Setup Parameters" do
...
@@ -70,48 +70,48 @@ describe "Setup Parameters" do
}
}
}
}
}
}
nginx_test_configuration(config).shouldinclude("ngx_http_push_stream_module will not be used with this configuration.")
expect(nginx_test_configuration(config)).toinclude("ngx_http_push_stream_module will not be used with this configuration.")
fail("Let a file on client body temp dir")unlessDir.entries(conf.client_body_temp).select{|f|fifFile.file?(File.expand_path(f,conf.client_body_temp))}.empty?
fail("Let a file on client body temp dir")unlessDir.entries(conf.client_body_temp).select{|f|fifFile.file?(File.expand_path(f,conf.client_body_temp))}.empty?
EventMachine.stop
EventMachine.stop
end
end
...
@@ -212,7 +212,7 @@ describe "Publisher Properties" do
...
@@ -212,7 +212,7 @@ describe "Publisher Properties" do
fail("Let a file on client body temp dir")unlessDir.entries(conf.client_body_temp).select{|f|fifFile.file?(File.expand_path(f,conf.client_body_temp))}.empty?
fail("Let a file on client body temp dir")unlessDir.entries(conf.client_body_temp).select{|f|fifFile.file?(File.expand_path(f,conf.client_body_temp))}.empty?
EventMachine.stop
EventMachine.stop
end
end
...
@@ -229,12 +229,12 @@ describe "Publisher Properties" do
...
@@ -229,12 +229,12 @@ describe "Publisher Properties" do
@@ -748,7 +748,7 @@ describe "Subscriber Properties" do
...
@@ -748,7 +748,7 @@ describe "Subscriber Properties" do
}
}
})
})
nginx_test_configuration(merged_config).shouldinclude(%{"push_stream_header_template_file" directive is duplicate or template set by 'push_stream_header_template'})
expect(nginx_test_configuration(merged_config)).toinclude(%{"push_stream_header_template_file" directive is duplicate or template set by 'push_stream_header_template'})
end
end
it"should not accept header_template_file and header_template on same level"do
it"should not accept header_template_file and header_template on same level"do
...
@@ -764,7 +764,7 @@ describe "Subscriber Properties" do
...
@@ -764,7 +764,7 @@ describe "Subscriber Properties" do
}
}
})
})
nginx_test_configuration(merged_config).shouldinclude(%{"push_stream_header_template" directive is duplicate})
expect(nginx_test_configuration(merged_config)).toinclude(%{"push_stream_header_template" directive is duplicate})
end
end
it"should accept header_template_file and header_template on different levels"do
it"should accept header_template_file and header_template on different levels"do
...
@@ -812,7 +812,7 @@ describe "Subscriber Properties" do
...
@@ -812,7 +812,7 @@ describe "Subscriber Properties" do
:header_template_file=>"/unexistent/path"
:header_template_file=>"/unexistent/path"
})
})
nginx_test_configuration(merged_config).shouldinclude(%{push stream module: unable to open file "/unexistent/path" for header template})
expect(nginx_test_configuration(merged_config)).toinclude(%{push stream module: unable to open file "/unexistent/path" for header template})
end
end
end
end
...
@@ -823,7 +823,7 @@ describe "Subscriber Properties" do
...
@@ -823,7 +823,7 @@ describe "Subscriber Properties" do
@@ -67,8 +67,8 @@ describe "Subscriber WebSocket" do
...
@@ -67,8 +67,8 @@ describe "Subscriber WebSocket" do
socket=open_socket(nginx_host,nginx_port)
socket=open_socket(nginx_host,nginx_port)
socket.print("#{request}\r\n")
socket.print("#{request}\r\n")
headers,body=read_response_on_socket(socket)
headers,body=read_response_on_socket(socket)
body.shouldeql("")
expect(body).toeql("")
headers.shouldmatch_the_pattern(/Don't have at least one of the mandatory headers: Connection, Upgrade, Sec-WebSocket-Key and Sec-WebSocket-Version/)
expect(headers).tomatch_the_pattern(/Don't have at least one of the mandatory headers: Connection, Upgrade, Sec-WebSocket-Key and Sec-WebSocket-Version/)
socket.close
socket.close
request<<"Connection: Upgrade\r\n"
request<<"Connection: Upgrade\r\n"
...
@@ -76,8 +76,8 @@ describe "Subscriber WebSocket" do
...
@@ -76,8 +76,8 @@ describe "Subscriber WebSocket" do
socket=open_socket(nginx_host,nginx_port)
socket=open_socket(nginx_host,nginx_port)
socket.print("#{request}\r\n")
socket.print("#{request}\r\n")
headers,body=read_response_on_socket(socket)
headers,body=read_response_on_socket(socket)
body.shouldeql("")
expect(body).toeql("")
headers.shouldmatch_the_pattern(/Don't have at least one of the mandatory headers: Connection, Upgrade, Sec-WebSocket-Key and Sec-WebSocket-Version/)
expect(headers).tomatch_the_pattern(/Don't have at least one of the mandatory headers: Connection, Upgrade, Sec-WebSocket-Key and Sec-WebSocket-Version/)
@@ -85,8 +85,8 @@ describe "Subscriber WebSocket" do
...
@@ -85,8 +85,8 @@ describe "Subscriber WebSocket" do
socket=open_socket(nginx_host,nginx_port)
socket=open_socket(nginx_host,nginx_port)
socket.print("#{request}\r\n")
socket.print("#{request}\r\n")
headers,body=read_response_on_socket(socket)
headers,body=read_response_on_socket(socket)
body.shouldeql("")
expect(body).toeql("")
headers.shouldmatch_the_pattern(/Don't have at least one of the mandatory headers: Connection, Upgrade, Sec-WebSocket-Key and Sec-WebSocket-Version/)
expect(headers).tomatch_the_pattern(/Don't have at least one of the mandatory headers: Connection, Upgrade, Sec-WebSocket-Key and Sec-WebSocket-Version/)
socket.close
socket.close
request<<"Upgrade: websocket\r\n"
request<<"Upgrade: websocket\r\n"
...
@@ -94,8 +94,8 @@ describe "Subscriber WebSocket" do
...
@@ -94,8 +94,8 @@ describe "Subscriber WebSocket" do
socket=open_socket(nginx_host,nginx_port)
socket=open_socket(nginx_host,nginx_port)
socket.print("#{request}\r\n")
socket.print("#{request}\r\n")
headers,body=read_response_on_socket(socket)
headers,body=read_response_on_socket(socket)
body.shouldeql("")
expect(body).toeql("")
headers.shouldmatch_the_pattern(/Don't have at least one of the mandatory headers: Connection, Upgrade, Sec-WebSocket-Key and Sec-WebSocket-Version/)
expect(headers).tomatch_the_pattern(/Don't have at least one of the mandatory headers: Connection, Upgrade, Sec-WebSocket-Key and Sec-WebSocket-Version/)
socket.close
socket.close
request<<"Sec-WebSocket-Version: 8\r\n"
request<<"Sec-WebSocket-Version: 8\r\n"
...
@@ -103,9 +103,9 @@ describe "Subscriber WebSocket" do
...
@@ -103,9 +103,9 @@ describe "Subscriber WebSocket" do
socket=open_socket(nginx_host,nginx_port)
socket=open_socket(nginx_host,nginx_port)
socket.print("#{request}\r\n")
socket.print("#{request}\r\n")
headers,body=read_response_on_socket(socket)
headers,body=read_response_on_socket(socket)
body.shouldeql("")
expect(body).toeql("")
headers.should_notmatch_the_pattern(/Don't have at least one of the mandatory headers: Connection, Upgrade, Sec-WebSocket-Key and Sec-WebSocket-Version/)
expect(headers).not_tomatch_the_pattern(/Don't have at least one of the mandatory headers: Connection, Upgrade, Sec-WebSocket-Key and Sec-WebSocket-Version/)