summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorHunter Haugen <h.haugen@gmail.com>2012-10-10 17:03:04 -0700
committerHunter Haugen <h.haugen@gmail.com>2012-10-10 17:03:04 -0700
commitc09e5a07cef578e1017af546e315f1c3826bf9a7 (patch)
treecaba811a27f5b967f2b7e0d01ab74f319b851bc4 /spec
parentd7ffbc326a8172bb0d0ecb888ed12d2c7e3eb7fd (diff)
Allow multiple ports to be passed
haproxy supports a single port or port range, but also muliples of those. This commit changes the 'virtual_ip_port' parameter to 'ports' and updates the template to accept an array of ports
Diffstat (limited to 'spec')
-rw-r--r--spec/defines/config_spec.rb36
1 files changed, 27 insertions, 9 deletions
diff --git a/spec/defines/config_spec.rb b/spec/defines/config_spec.rb
index 89993ee..a30737e 100644
--- a/spec/defines/config_spec.rb
+++ b/spec/defines/config_spec.rb
@@ -3,15 +3,33 @@ require 'spec_helper'
describe 'haproxy::config' do
let(:title) { 'tyler' }
let(:facts) {{ :ipaddress => '1.1.1.1' }}
- let(:params) do
- { :name => 'croy',
- :virtual_ip_port => '18140'
- }
+ context "when only one port is provided" do
+ let(:params) do
+ { :name => 'croy',
+ :ports => '18140'
+ }
+ end
+
+ it { should contain_concat__fragment('croy_config_block').with(
+ 'order' => '20',
+ 'target' => '/etc/haproxy/haproxy.cfg',
+ 'content' => "\nlisten croy 1.1.1.1:18140\n balance roundrobin\n option tcplog\n option ssl-hello-chk\n"
+ ) }
end
+ context "when an array of ports is provided" do
+ let(:params) do
+ { :name => 'apache',
+ :ports => [
+ '80',
+ '443',
+ ]
+ }
+ end
- it { should contain_concat__fragment('croy_config_block').with(
- 'order' => '20',
- 'target' => '/etc/haproxy/haproxy.cfg',
- 'content' => "\nlisten croy 1.1.1.1:18140\n balance roundrobin\n option tcplog\n option ssl-hello-chk\n"
+ it { should contain_concat__fragment('apache_config_block').with(
+ 'order' => '20',
+ 'target' => '/etc/haproxy/haproxy.cfg',
+ 'content' => "\nlisten apache 1.1.1.1:80,1.1.1.1:443\n balance roundrobin\n option tcplog\n option ssl-hello-chk\n"
) }
-end \ No newline at end of file
+ end
+end