summaryrefslogtreecommitdiff
path: root/spec/defines
diff options
context:
space:
mode:
authorGary Larizza <gary@puppetlabs.com>2012-05-09 16:38:43 -0700
committerGary Larizza <gary@puppetlabs.com>2012-05-09 16:38:43 -0700
commit580e831fbb7ba60cc0206661a8cfe263613c2b5e (patch)
tree5ea4f7ae5ef95e72433e046aed367cf07bfb9172 /spec/defines
parent01d46be262154b76ffd794fadf0d43deeb425fa6 (diff)
Commit spec tests for the haproxy module
Previously, the haproxy module didn't provide rspec tests for the class or defined resource types. This commit adds the tests, a spec_helper file, and a rakefile so you can do `rake spec` and automatically run the tests. I've also committed a symlink in the spec/fixtures/modules/haproxy directory so the rspec-puppet tests will FIND the haproxy class/defined resource types, but I HAVE NOT committed a symlink so that it will find the concat class (which is a dependency for this module). If you choose to run the tests, you must symlink the concat module in the spec/fixtures/modules directory before the spec tests will pass.
Diffstat (limited to 'spec/defines')
-rw-r--r--spec/defines/balancermember_spec.rb23
-rw-r--r--spec/defines/config_spec.rb17
2 files changed, 40 insertions, 0 deletions
diff --git a/spec/defines/balancermember_spec.rb b/spec/defines/balancermember_spec.rb
new file mode 100644
index 0000000..75b761e
--- /dev/null
+++ b/spec/defines/balancermember_spec.rb
@@ -0,0 +1,23 @@
+require 'spec_helper'
+
+describe 'haproxy::balancermember' do
+ let(:title) { 'tyler' }
+ let(:facts) do
+ { :ipaddress => '1.1.1.1',
+ :hostname => 'dero'
+ }
+ end
+ let(:params) do
+ { :name => 'tyler',
+ :listening_service => 'croy',
+ :balancer_port => '18140',
+ :balancermember_options => 'check'
+ }
+ end
+
+ it { should contain_concat__fragment('croy_balancermember_tyler').with(
+ 'order' => '20',
+ 'target' => '/etc/haproxy/haproxy.cfg',
+ 'content' => " server dero 1.1.1.1:18140 check \n"
+ ) }
+end \ No newline at end of file
diff --git a/spec/defines/config_spec.rb b/spec/defines/config_spec.rb
new file mode 100644
index 0000000..89993ee
--- /dev/null
+++ b/spec/defines/config_spec.rb
@@ -0,0 +1,17 @@
+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'
+ }
+ 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 \ No newline at end of file