diff --git a/spec/acceptance/ansible_spec.rb b/spec/acceptance/ansible_spec.rb index d2cec04b0..57aeffb61 100644 --- a/spec/acceptance/ansible_spec.rb +++ b/spec/acceptance/ansible_spec.rb @@ -7,6 +7,8 @@ it_behaves_like 'the default foreman proxy application' + it_behaves_like 'the exposed feature', 'ansible' + describe package('ansible-collection-theforeman-foreman') do it { is_expected.to be_installed } end diff --git a/spec/acceptance/container_gateway_spec.rb b/spec/acceptance/container_gateway_spec.rb index 004fdbb14..4c9df8795 100644 --- a/spec/acceptance/container_gateway_spec.rb +++ b/spec/acceptance/container_gateway_spec.rb @@ -7,6 +7,8 @@ it_behaves_like 'the default foreman proxy application' + it_behaves_like 'the exposed feature', 'container_gateway' + describe 'is created' do it { expect(package('rubygem-smart_proxy_container_gateway')).to be_installed } it { expect(file('/etc/foreman-proxy/settings.d/container_gateway.yml')).to be_file } diff --git a/spec/acceptance/discovery_spec.rb b/spec/acceptance/discovery_spec.rb index 16cb68030..81b358ae8 100644 --- a/spec/acceptance/discovery_spec.rb +++ b/spec/acceptance/discovery_spec.rb @@ -7,7 +7,5 @@ it_behaves_like 'the default foreman proxy application' - describe command('curl -sk https://127.0.0.1:8443/features | grep -q discovery') do - its(:exit_status) { should eq 0 } - end + it_behaves_like 'the exposed feature', 'discovery' end diff --git a/spec/acceptance/dns_spec.rb b/spec/acceptance/dns_spec.rb index 16e4bd545..00125e805 100644 --- a/spec/acceptance/dns_spec.rb +++ b/spec/acceptance/dns_spec.rb @@ -9,6 +9,8 @@ it_behaves_like 'the default foreman proxy application' + it_behaves_like 'the exposed feature', 'dns' + describe port(53) do it { is_expected.to be_listening } end diff --git a/spec/acceptance/dynflow_spec.rb b/spec/acceptance/dynflow_spec.rb index 2d18559cb..710d046c1 100644 --- a/spec/acceptance/dynflow_spec.rb +++ b/spec/acceptance/dynflow_spec.rb @@ -6,4 +6,6 @@ include_examples 'the example', 'dynflow.pp' it_behaves_like 'the default foreman proxy application' + + it_behaves_like 'the exposed feature', 'dynflow' end diff --git a/spec/acceptance/openscap_spec.rb b/spec/acceptance/openscap_spec.rb index f44adec5a..47adb7c8e 100644 --- a/spec/acceptance/openscap_spec.rb +++ b/spec/acceptance/openscap_spec.rb @@ -7,6 +7,8 @@ it_behaves_like 'the default foreman proxy application' + it_behaves_like 'the exposed feature', 'openscap' + describe package('puppet-foreman_scap_client') do it { is_expected.to be_installed } end diff --git a/spec/acceptance/remote_execution_script_pull_mqtt_spec.rb b/spec/acceptance/remote_execution_script_pull_mqtt_spec.rb index 98d3f79bf..79d550bc5 100644 --- a/spec/acceptance/remote_execution_script_pull_mqtt_spec.rb +++ b/spec/acceptance/remote_execution_script_pull_mqtt_spec.rb @@ -8,6 +8,8 @@ it_behaves_like 'the default foreman proxy application' + it_behaves_like 'the exposed feature', 'script' + describe port(1883) do it { is_expected.to be_listening } end @@ -70,6 +72,8 @@ it_behaves_like 'the default foreman proxy application' + it_behaves_like 'the exposed feature', 'script' + describe port(1883) do it { is_expected.not_to be_listening } end diff --git a/spec/acceptance/remote_execution_script_spec.rb b/spec/acceptance/remote_execution_script_spec.rb index 6b89f500f..bffed1d35 100644 --- a/spec/acceptance/remote_execution_script_spec.rb +++ b/spec/acceptance/remote_execution_script_spec.rb @@ -7,6 +7,8 @@ it_behaves_like 'the default foreman proxy application' + it_behaves_like 'the exposed feature', 'script' + describe file('/etc/foreman-proxy/settings.d/remote_execution_ssh.yml') do its(:content) { is_expected.to_not match %r{:ssh_log_level:} } end @@ -19,6 +21,8 @@ it_behaves_like 'the default foreman proxy application' + it_behaves_like 'the exposed feature', 'script' + describe file('/etc/foreman-proxy/settings.d/remote_execution_ssh.yml') do its(:content) { is_expected.to match %r{:ssh_log_level: debug} } end diff --git a/spec/acceptance/salt_spec.rb b/spec/acceptance/salt_spec.rb index da09a197a..d8fc8689d 100644 --- a/spec/acceptance/salt_spec.rb +++ b/spec/acceptance/salt_spec.rb @@ -7,6 +7,8 @@ it_behaves_like 'the default foreman proxy application' + it_behaves_like 'the exposed feature', 'salt' + specify { expect(file('/etc/salt/master.d')).to be_directory } specify { expect(file('/etc/salt/master.d/foreman.conf')).to be_file.and(have_attributes(owner: 'root', group: 'foreman-proxy')) } end diff --git a/spec/support/acceptance/examples.rb b/spec/support/acceptance/examples.rb index 79f61a9fd..a93a31af9 100644 --- a/spec/support/acceptance/examples.rb +++ b/spec/support/acceptance/examples.rb @@ -12,3 +12,13 @@ it { is_expected.to be_listening } end end + +shared_examples 'the exposed feature' do |feature| + let(:feature) { feature } + + cert_dir = '/etc/foreman-proxy' + describe curl_command("https://#{host_inventory['fqdn']}:8443/features", cacert: "#{cert_dir}/certificate.pem", cert: "#{cert_dir}/certificate.pem", key: "#{cert_dir}/key.pem") do + its(:stdout) { should include(feature) } + its(:exit_status) { should eq 0 } + end +end