|
3 | 3 | describe 'Scenario: install foreman-proxy with remote_execution script plugin with pull-mqtt' do |
4 | 4 | before(:context) { purge_installed_packages } |
5 | 5 |
|
6 | | - include_examples 'the example', 'remote_execution_script_pull_mqtt.pp' |
| 6 | + context 'with default params' do |
| 7 | + include_examples 'the example', 'remote_execution_script_pull_mqtt.pp' |
7 | 8 |
|
8 | | - it_behaves_like 'the default foreman proxy application' |
| 9 | + it_behaves_like 'the default foreman proxy application' |
9 | 10 |
|
10 | | - describe port(1883) do |
11 | | - it { is_expected.to be_listening } |
12 | | - end |
| 11 | + describe port(1883) do |
| 12 | + it { is_expected.to be_listening } |
| 13 | + end |
13 | 14 |
|
14 | | - describe file('/etc/foreman-proxy/settings.d/remote_execution_ssh.yml') do |
15 | | - it { should be_file } |
16 | | - its(:content) { should match(%r{:mqtt_port: 1883}) } |
17 | | - its(:content) { should match(%r{:mqtt_broker: #{host_inventory['fqdn']}}) } |
18 | | - end |
| 15 | + describe file('/etc/foreman-proxy/settings.d/remote_execution_ssh.yml') do |
| 16 | + it { should be_file } |
| 17 | + its(:content) { should match(%r{:mqtt_port: 1883}) } |
| 18 | + its(:content) { should match(%r{:mqtt_broker: #{host_inventory['fqdn']}}) } |
| 19 | + end |
19 | 20 |
|
20 | | - describe file('/etc/mosquitto/foreman.acl') do |
21 | | - it { should be_file } |
22 | | - its(:content) { should match(%r{pattern read yggdrasil\/%u\/data\/in}) } |
23 | | - its(:content) { should match(%r{pattern write yggdrasil\/%u\/control\/out}) } |
24 | | - its(:content) { should match(%r{user #{host_inventory['fqdn']}}) } |
25 | | - its(:content) { should match(%r{topic write yggdrasil\/\+\/data\/in}) } |
26 | | - its(:content) { should match(%r{topic read yggdrasil\/\+\/control\/out}) } |
27 | | - end |
| 21 | + describe file('/etc/mosquitto/foreman.acl') do |
| 22 | + it { should be_file } |
| 23 | + its(:content) { should match(%r{pattern read yggdrasil\/%u\/data\/in}) } |
| 24 | + its(:content) { should match(%r{pattern write yggdrasil\/%u\/control\/out}) } |
| 25 | + its(:content) { should match(%r{user #{host_inventory['fqdn']}}) } |
| 26 | + its(:content) { should match(%r{topic write yggdrasil\/\+\/data\/in}) } |
| 27 | + its(:content) { should match(%r{topic read yggdrasil\/\+\/control\/out}) } |
| 28 | + end |
28 | 29 |
|
29 | | - describe x509_certificate('/etc/mosquitto/ssl/ssl_cert.pem') do |
30 | | - it { should be_certificate } |
31 | | - it { should be_valid } |
32 | | - end |
| 30 | + describe x509_certificate('/etc/mosquitto/ssl/ssl_cert.pem') do |
| 31 | + it { should be_certificate } |
| 32 | + it { should be_valid } |
| 33 | + end |
33 | 34 |
|
34 | | - describe file('/etc/mosquitto/ssl/ssl_cert.pem') do |
35 | | - it { should be_file } |
36 | | - it { should be_mode 440 } |
37 | | - it { should be_owned_by 'root' } |
38 | | - it { should be_grouped_into 'mosquitto' } |
39 | | - end |
| 35 | + describe file('/etc/mosquitto/ssl/ssl_cert.pem') do |
| 36 | + it { should be_file } |
| 37 | + it { should be_mode 440 } |
| 38 | + it { should be_owned_by 'root' } |
| 39 | + it { should be_grouped_into 'mosquitto' } |
| 40 | + end |
40 | 41 |
|
41 | | - describe x509_private_key('/etc/mosquitto/ssl/ssl_key.pem') do |
42 | | - it { should_not be_encrypted } |
43 | | - it { should be_valid } |
44 | | - it { should have_matching_certificate('/etc/mosquitto/ssl/ssl_cert.pem') } |
45 | | - end |
| 42 | + describe x509_private_key('/etc/mosquitto/ssl/ssl_key.pem') do |
| 43 | + it { should_not be_encrypted } |
| 44 | + it { should be_valid } |
| 45 | + it { should have_matching_certificate('/etc/mosquitto/ssl/ssl_cert.pem') } |
| 46 | + end |
46 | 47 |
|
47 | | - describe file('/etc/mosquitto/ssl/ssl_key.pem') do |
48 | | - it { should be_file } |
49 | | - it { should be_mode 440 } |
50 | | - it { should be_owned_by 'root' } |
51 | | - it { should be_grouped_into 'mosquitto' } |
52 | | - end |
| 48 | + describe file('/etc/mosquitto/ssl/ssl_key.pem') do |
| 49 | + it { should be_file } |
| 50 | + it { should be_mode 440 } |
| 51 | + it { should be_owned_by 'root' } |
| 52 | + it { should be_grouped_into 'mosquitto' } |
| 53 | + end |
| 54 | + |
| 55 | + describe x509_certificate('/etc/mosquitto/ssl/ssl_ca.pem') do |
| 56 | + it { should be_certificate } |
| 57 | + it { should be_valid } |
| 58 | + end |
53 | 59 |
|
54 | | - describe x509_certificate('/etc/mosquitto/ssl/ssl_ca.pem') do |
55 | | - it { should be_certificate } |
56 | | - it { should be_valid } |
| 60 | + describe file('/etc/mosquitto/ssl/ssl_ca.pem') do |
| 61 | + it { should be_file } |
| 62 | + it { should be_mode 440 } |
| 63 | + it { should be_owned_by 'root' } |
| 64 | + it { should be_grouped_into 'mosquitto' } |
| 65 | + end |
57 | 66 | end |
58 | 67 |
|
59 | | - describe file('/etc/mosquitto/ssl/ssl_ca.pem') do |
60 | | - it { should be_file } |
61 | | - it { should be_mode 440 } |
62 | | - it { should be_owned_by 'root' } |
63 | | - it { should be_grouped_into 'mosquitto' } |
| 68 | + context 'with default mode (SSH) after enabling pull-mqtt' do |
| 69 | + include_examples 'the example', 'remote_execution_script.pp' |
| 70 | + |
| 71 | + it_behaves_like 'the default foreman proxy application' |
| 72 | + |
| 73 | + describe port(1883) do |
| 74 | + it { is_expected.not_to be_listening } |
| 75 | + end |
| 76 | + |
| 77 | + describe file('/etc/foreman-proxy/settings.d/remote_execution_ssh.yml') do |
| 78 | + it { should be_file } |
| 79 | + its(:content) { should_not match(%r{:mqtt_port: 1883}) } |
| 80 | + its(:content) { should_not match(%r{:mqtt_broker: #{host_inventory['fqdn']}}) } |
| 81 | + end |
| 82 | + |
| 83 | + describe file('/etc/mosquitto/foreman.acl') do |
| 84 | + it { should_not exist } |
| 85 | + end |
| 86 | + |
| 87 | + describe file('/etc/mosquitto/ssl/ssl_cert.pem') do |
| 88 | + it { should_not exist } |
| 89 | + end |
| 90 | + |
| 91 | + describe file('/etc/mosquitto/ssl/ssl_key.pem') do |
| 92 | + it { should_not exist } |
| 93 | + end |
| 94 | + |
| 95 | + describe file('/etc/mosquitto/ssl/ssl_ca.pem') do |
| 96 | + it { should_not exist } |
| 97 | + end |
64 | 98 | end |
65 | 99 |
|
66 | 100 | end |
0 commit comments