Implemented Chef 13 support for Test Kitchen and CI

- implemented foodcritic and cookstyle corrections
- simplified environments files to a single environment for each scenario,
  as opposed to one environment file per OS flavor
- updated inspec test for tempest from package

Implements blueprint modern-chef

Depends-On: If971a472c1fd9149a891200548a267655620fce2
Depends-On: Ib268737d2f5c3196061d89202d806c3af1c54e72
Change-Id: I5f1cb87573098623aa9f8c224a89527ce813e055
This commit is contained in:
Samuel Cassiba 2017-11-27 18:12:45 -08:00 committed by Jens Harbott (frickler)
parent d7e8923363
commit 9a0b2b6622
5 changed files with 42 additions and 105 deletions

View File

@ -1,8 +1,11 @@
---
driver:
name: dokken
privileged: true # because Docker and SystemD
chef_version: 12
privileged: true
chef_version: current
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- /sys/fs/selinux:/sys/fs/selinux:rw
transport:
name: dokken
@ -15,39 +18,26 @@ verifier:
name: inspec
platforms:
# from environments/allinone-ubuntu16.json
- name: ubuntu-16.04
driver:
image: dokken/ubuntu-16.04
pid_one_command: /bin/systemd
attributes:
apache:
listen: []
openstack:
is_release: true
apt:
update_apt_cache: true
dashboard:
server_hostname: localhost
memcached_servers: ['127.0.0.1:11211']
# from environments/allinone-centos7.json
intermediate_instructions:
- RUN /usr/bin/apt-get update
- RUN /usr/bin/apt-get install apt-transport-https lsb-release procps net-tools sudo -y
- name: centos-7
platform: rhel
driver:
image: dokken/centos-7
pid_one_command: /usr/lib/systemd/systemd
attributes:
openstack:
is_release: true
mariadb:
mysqld:
lc_messages_dir: '/usr/share/mariadb'
intermediate_instructions:
- RUN yum -y install which net-tools
suites:
- name: default
run_list:
# run_list taken from roles/allinone.json
- recipe[build-essential]
- recipe[selinux::disabled]
- recipe[openstack-common]
- recipe[openstack-common::logging]
- recipe[openstack-common::sysctl]
@ -105,10 +95,17 @@ suites:
verifier:
inspec_tests:
- test/tempest/default
# from environments/allinone-ubuntu16.json, environments/allinone-centos7.json
# from environments/allinone.json
attributes:
# Attributes copied from environments/integration-ubuntu16.json
# Attributes copied from environments/integration.json
apache:
listen: []
openstack:
is_release: true
apt:
update_apt_cache: true
dashboard:
server_hostname: localhost
telemetry:
conf:
DEFAULT:
@ -116,6 +113,7 @@ suites:
mq:
user: admin
network:
tun_network_bridge_interface: eth0
conf:
DEFAULT:
service_plugins: router
@ -124,6 +122,7 @@ suites:
compute:
conf:
libvirt:
cpu_type: none
virt_type: qemu
secret:
key_path: /opt/kitchen/encrypted_data_bag_secret

View File

@ -4,6 +4,10 @@ driver:
customize:
memory: 12000
client_rb:
treat_deprecation_warnings_as_errors: true
resource_cloning: false
provisioner:
name: chef_zero
# You may wish to disable always updating cookbooks in CI or other testing
@ -11,7 +15,7 @@ provisioner:
# For example:
# always_update_cookbooks: <%= !ENV['CI'] %>
always_update_cookbooks: true
require_chef_omnibus: 12
require_chef_omnibus: 13
# Copy secret to /tmp/kitchen on test VM. Kitchen tries to gather secrets
# before any recipes had a chance to run -> we cannot use a recipe to put the
# secrets file in place.
@ -21,31 +25,13 @@ verifier:
name: inspec
platforms:
# from environments/allinone-ubuntu16.json
- name: ubuntu-16.04
attributes:
apache:
listen: []
apt:
compile_time_update: true
openstack:
apt:
update_apt_cache: true
dashboard:
server_hostname: localhost
memcached_servers: ['127.0.0.1:11211']
# from environments/allinone-centos7.json
- name: centos-7.3
attributes:
mariadb:
mysqld:
lc_messages_dir: '/usr/share/mariadb'
- name: centos-7.4
suites:
- name: default
run_list:
# run_list taken from roles/allinone.json
- recipe[build-essential]
- recipe[openstack-common]
- recipe[openstack-common::logging]
- recipe[openstack-common::sysctl]
@ -106,7 +92,15 @@ suites:
# from environments/allinone-ubuntu16.json, environments/allinone-centos7.json
attributes:
# Attributes copied from environments/integration-ubuntu16.json
apache:
listen: []
openstack:
is_release: true
apt:
update_apt_cache: true
dashboard:
server_hostname: localhost
memcached_servers: ['127.0.0.1:11211']
telemetry:
conf:
DEFAULT:
@ -122,6 +116,7 @@ suites:
compute:
conf:
libvirt:
cpu_type: none
virt_type: qemu
secret:
key_path: /tmp/kitchen/encrypted_data_bag_secret

View File

@ -1,53 +0,0 @@
{
"name": "allinone-centos7",
"description": "Environment used in testing the upstream cookbooks and reference Chef repository with vagrant. To be used with the vagrantfile-allinone vagrantfile. Defines the necessary attributes for a working all-in-one openstack deployment, using neutron for the networking component, and the openvswitch neutron plugin",
"cookbook_versions": {
},
"json_class": "Chef::Environment",
"chef_type": "environment",
"override_attributes": {
"mariadb": {
"mysqld": {
"lc_messages_dir": "/usr/share/mariadb"
}
},
"openstack": {
"yum": {
"uri": "https://trunk.rdoproject.org/centos7-master/current-passed-ci/",
"gpgcheck": false
},
"telemetry": {
"conf": {
"DEFAULT": {
"meter_dispatchers": "database"
}
}
},
"dashboard": {
"server_hostname": "localhost"
},
"memcached_servers": [ "127.0.0.1:11211" ],
"mq": {
"user": "admin"
},
"network": {
"conf": {
"DEFAULT": {
"service_plugins": "router"
}
}
},
"image": {
"image_upload": true
},
"compute": {
"conf": {
"libvirt": {
"cpu_mode": "none",
"virt_type": "qemu"
}
}
}
}
}
}

View File

@ -1,5 +1,5 @@
{
"name": "allinone-ubuntu16",
"name": "allinone",
"description": "Environment used in testing the upstream cookbooks and reference Chef repository with vagrant. To be used with the vagrantfile-allinone vagrantfile. Defines the necessary attributes for a working all-in-one openstack deployment, using neutron for the networking component, and the openvswitch neutron plugin",
"cookbook_versions": {
},
@ -8,15 +8,13 @@
"default_attributes": {
"apache": {
"listen": []
},
"apt": {
"compile_time_update" : true
}
},
"override_attributes": {
"openstack": {
"is_release": true,
"apt": {
"update_apt_cache": true
"update_apt_cache": "true"
},
"telemetry": {
"conf": {
@ -28,11 +26,10 @@
"dashboard": {
"server_hostname": "localhost"
},
"memcached_servers": [ "127.0.0.1:11211" ],
"mq": {
"user": "admin"
},
"network":{
"network": {
"conf": {
"DEFAULT": {
"service_plugins": "router"

View File

@ -6,8 +6,7 @@
# found at http://inspec.io/docs/reference/resources/
# There is no console output during runtime, check log file instead.
describe command('sudo bash -c "cd /opt/tempest && ' \
'sudo /opt/tempest-venv/tempest.sh | ' \
describe command('sudo bash -c "sudo tempest run --smoke --serial --config-file /etc/tempest/tempest.conf | ' \
'tee /root/inspec-tempest-$(date -Iminutes).log &&' \
'exit \${PIPESTATUS[0]}"') do
its('exit_status') { should eq 0 }