introduce test-kitchen
Change-Id: I374cb4a534e260c00a3cca178ec1d03c2faebcbf
Implements: blueprint service-level-testing
diff --git a/tests/integration/cluster/inspec/horizon_spec.rb b/tests/integration/cluster/inspec/horizon_spec.rb
new file mode 100644
index 0000000..cadccac
--- /dev/null
+++ b/tests/integration/cluster/inspec/horizon_spec.rb
@@ -0,0 +1,87 @@
+
+
+
+
+
+
+# TODO, enable helper files once resolved - https://github.com/chef/kitchen-inspec/issues/93
+#require 'spec_helper'
+param = {
+ user: 'horizon',
+ group: 'horizon',
+}
+
+# based on operating system we select the available service
+if ['centos', 'fedora', 'freebsd', 'opensuse'].include?(os[:family])
+ # CentOS, Fedora
+ service_nm = 'httpd'
+ config = '/etc/openstack-dashboard/local_settings'
+ apache_config = '/etc/httpd/conf.d/openstack-dashboard.conf'
+elsif ['debian', 'ubuntu'].include?(os[:family])
+ # Debian, Ubuntu
+ service_nm = 'apache'
+ config = '/etc/openstack-dashboard/local_settings.py'
+ apache_config = '/etc/apache2/conf-available/openstack-dashboard.conf'
+end
+
+control 'horizon' do
+
+ # TODO, check for config files and content
+ #debian
+ #'config': '/etc/openstack-dashboard/local_settings.py',
+ #'apache_config': '/etc/apache2/conf-available/openstack-dashboard.conf',
+ #'port_config_file': '/etc/apache2/ports.conf',
+ #'port_config_template': 'salt://horizon/files/ports.conf',
+ #rhel
+ #'config': '/etc/openstack-dashboard/local_settings',
+ #'apache_config': '/etc/httpd/conf.d/openstack-dashboard.conf',
+ #'port_config_file': '/etc/httpd/conf/httpd.conf',
+ #'port_config_template': 'salt://horizon/files/httpd.conf',
+
+
+ describe file(config) do
+ it { should exist }
+ its('content') { should match("SECRET_KEY = 'secret'") }
+ #it { should be_owned_by param[:user] }
+ #it { should be_grouped_into param[:group] }
+ end
+end
+
+control 'apache config' do
+ describe file(apache_config) do
+ it { should exist }
+ its('content') { should match("WSGIDaemonProcess horizon user=horizon group=horizon") }
+ end
+end
+
+
+return
+return if ENV['DOCKER']
+
+#control 'web server' do
+
+ #if os[:family] == 'ubuntu' && os[:release] >= '16.04'
+ #describe systemd_service(service_nm) do
+ #it { should be_enabled }
+ #it { should be_installed }
+ #it { should be_running }
+ #end
+ #else
+ #describe_service(service_nm) do
+ #it { should be_enabled }
+ #it { should be_installed }
+ #it { should be_running }
+ #end
+ #end
+
+
+ #if os.unix?
+ #describe port(80) do
+ #it { should be_listening }
+ #its('protocols') { should include('tcp') }
+ #end
+
+ #end
+#end
+
+
diff --git a/tests/integration/helpers/spec_helper.rb b/tests/integration/helpers/spec_helper.rb
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/integration/helpers/spec_helper.rb
diff --git a/tests/integration/single/inspec/horizon_spec.rb b/tests/integration/single/inspec/horizon_spec.rb
new file mode 100644
index 0000000..cadccac
--- /dev/null
+++ b/tests/integration/single/inspec/horizon_spec.rb
@@ -0,0 +1,87 @@
+
+
+
+
+
+
+# TODO, enable helper files once resolved - https://github.com/chef/kitchen-inspec/issues/93
+#require 'spec_helper'
+param = {
+ user: 'horizon',
+ group: 'horizon',
+}
+
+# based on operating system we select the available service
+if ['centos', 'fedora', 'freebsd', 'opensuse'].include?(os[:family])
+ # CentOS, Fedora
+ service_nm = 'httpd'
+ config = '/etc/openstack-dashboard/local_settings'
+ apache_config = '/etc/httpd/conf.d/openstack-dashboard.conf'
+elsif ['debian', 'ubuntu'].include?(os[:family])
+ # Debian, Ubuntu
+ service_nm = 'apache'
+ config = '/etc/openstack-dashboard/local_settings.py'
+ apache_config = '/etc/apache2/conf-available/openstack-dashboard.conf'
+end
+
+control 'horizon' do
+
+ # TODO, check for config files and content
+ #debian
+ #'config': '/etc/openstack-dashboard/local_settings.py',
+ #'apache_config': '/etc/apache2/conf-available/openstack-dashboard.conf',
+ #'port_config_file': '/etc/apache2/ports.conf',
+ #'port_config_template': 'salt://horizon/files/ports.conf',
+ #rhel
+ #'config': '/etc/openstack-dashboard/local_settings',
+ #'apache_config': '/etc/httpd/conf.d/openstack-dashboard.conf',
+ #'port_config_file': '/etc/httpd/conf/httpd.conf',
+ #'port_config_template': 'salt://horizon/files/httpd.conf',
+
+
+ describe file(config) do
+ it { should exist }
+ its('content') { should match("SECRET_KEY = 'secret'") }
+ #it { should be_owned_by param[:user] }
+ #it { should be_grouped_into param[:group] }
+ end
+end
+
+control 'apache config' do
+ describe file(apache_config) do
+ it { should exist }
+ its('content') { should match("WSGIDaemonProcess horizon user=horizon group=horizon") }
+ end
+end
+
+
+return
+return if ENV['DOCKER']
+
+#control 'web server' do
+
+ #if os[:family] == 'ubuntu' && os[:release] >= '16.04'
+ #describe systemd_service(service_nm) do
+ #it { should be_enabled }
+ #it { should be_installed }
+ #it { should be_running }
+ #end
+ #else
+ #describe_service(service_nm) do
+ #it { should be_enabled }
+ #it { should be_installed }
+ #it { should be_running }
+ #end
+ #end
+
+
+ #if os.unix?
+ #describe port(80) do
+ #it { should be_listening }
+ #its('protocols') { should include('tcp') }
+ #end
+
+ #end
+#end
+
+
diff --git a/tests/pillar/cluster.sls b/tests/pillar/cluster.sls
index 3eb9909..0070ce5 100644
--- a/tests/pillar/cluster.sls
+++ b/tests/pillar/cluster.sls
@@ -4,6 +4,12 @@
version: liberty
secret_key: secret
session_timeout: 43200
+ plugin:
+ horizon_theme:
+ theme_name: ubuntu
+ source:
+ engine: pkg
+ name: openstack-dashboard-ubuntu-theme
wsgi:
processes: 3
threads: 10
@@ -22,6 +28,7 @@
port: 11211
identity:
engine: keystone
+ encryption: encryption
host: 127.0.0.1
port: 5000
api_version: 2
@@ -45,4 +52,4 @@
- name: ctl03
host: 127.0.0.1
port: 80
- params: cookie ctl03 check inter 2000 fall 3
\ No newline at end of file
+ params: cookie ctl03 check inter 2000 fall 3
diff --git a/tests/pillar/single.sls b/tests/pillar/single.sls
index 827cd88..a678d49 100644
--- a/tests/pillar/single.sls
+++ b/tests/pillar/single.sls
@@ -7,6 +7,12 @@
bind:
address: 127.0.0.1
port: 80
+ plugin:
+ horizon_theme:
+ theme_name: ubuntu
+ source:
+ engine: pkg
+ name: openstack-dashboard-ubuntu-theme
wsgi:
processes: 3
threads: 10
@@ -23,4 +29,5 @@
port: 5000
host: 127.0.0.1
encryption: encryption
- api_version: 2
\ No newline at end of file
+ api_version: 2
+