11require 'spec_helper_acceptance'
22
33describe 'remote-access' , :unless => UNSUPPORTED_PLATFORMS . include? ( fact ( 'osfamily' ) ) do
4+ before do
5+ skip "These tests require the spec/acceptance/nodesets/centos-64-x64-2-hosts nodeset"
6+ end
47
5- if hosts . length > 1
6- describe "configuring multi-node postgresql" do
8+ describe "configuring multi-node postgresql" do
79
8- # Get the database's IP to connect to from the client
9- let ( :database_ip_address ) do
10- hosts_as ( 'database' ) . inject ( { } ) do |memo , host |
11- fact_on host , "ipaddress_eth1"
12- end
10+ # Get the database's IP to connect to from the database
11+ let ( :database_ip_address ) do
12+ hosts_as ( 'database' ) . inject ( { } ) do |memo , host |
13+ fact_on host , "ipaddress_eth1"
1314 end
15+ end
1416
15- hosts_as ( 'database' ) . each do |host |
16- it "should be able to configure a host as database on #{ host } " do
17- pp = <<-EOS
18- # Stop firewall so we can easily connect
19- service {'iptables':
20- ensure => 'stopped',
21- }
17+ hosts_as ( 'database' ) . each do |host |
18+ it "should be able to configure a host as database on #{ host } " do
19+ pp = <<-EOS
20+ # Stop firewall so we can easily connect
21+ service {'iptables':
22+ ensure => 'stopped',
23+ }
2224
23- class { 'postgresql::server':
24- ip_mask_allow_all_users => '0.0.0.0/0',
25- listen_addresses => '*',
26- }
25+ class { 'postgresql::server':
26+ ip_mask_allow_all_users => '0.0.0.0/0',
27+ listen_addresses => '*',
28+ }
2729
28- postgresql::server::db { 'puppet':
29- user => 'puppet',
30- password => postgresql_password('puppet', 'puppet'),
31- }
30+ postgresql::server::db { 'puppet':
31+ user => 'puppet',
32+ password => postgresql_password('puppet', 'puppet'),
33+ }
3234
33- postgresql::server::pg_hba_rule { 'allow full yolo access password':
34- type => 'host',
35- database => 'all',
36- user => 'all',
37- address => '0.0.0.0/0',
38- auth_method => 'password',
39- order => '002',
40- }
41- EOS
42- apply_manifest_on ( host , pp , :catch_failures => true )
43- end
35+ postgresql::server::pg_hba_rule { 'allow full yolo access password':
36+ type => 'host',
37+ database => 'all',
38+ user => 'all',
39+ address => '0.0.0.0/0',
40+ auth_method => 'password',
41+ order => '002',
42+ }
43+ EOS
44+ apply_manifest_on ( host , pp , :catch_failures => true )
4445 end
46+ end
4547
46- hosts_as ( 'client' ) . each do |host |
47- it "should be able to configure a host as client on #{ host } and then access database" do
48- pp = <<-EOS
49- class { 'postgresql::client':}
48+ hosts_as ( 'client' ) . each do |host |
49+ it "should be able to configure a host as client on #{ host } and then access database" do
50+ pp = <<-EOS
51+ class { 'postgresql::client':}
5052
51- $connection_settings = {
52- 'PGUSER' => "puppet",
53- 'PGPASSWORD' => "puppet",
54- 'PGHOST' => "#{ database_ip_address } ",
55- 'PGPORT' => "5432",
56- 'PGDATABASE' => "puppet",
57- }
53+ $connection_settings = {
54+ 'PGUSER' => "puppet",
55+ 'PGPASSWORD' => "puppet",
56+ 'PGHOST' => "#{ database_ip_address } ",
57+ 'PGPORT' => "5432",
58+ 'PGDATABASE' => "puppet",
59+ }
5860
59- postgresql_psql { 'run using connection_settings':
60- command => 'select 1',
61- psql_user => 'root',
62- psql_group => 'root',
63- connect_settings => $connection_settings,
64- }
65- EOS
66- apply_manifest_on ( host , pp , :catch_failures => true )
67- end
61+ postgresql_psql { 'run using connection_settings':
62+ command => 'select 1',
63+ psql_user => 'root',
64+ psql_group => 'root',
65+ connect_settings => $connection_settings,
66+ }
67+ EOS
68+ apply_manifest_on ( host , pp , :catch_failures => true )
6869 end
69-
7070 end
7171 end
72- end
72+ end
0 commit comments