Add support for kitchen testing

This changeset adds support for testing openstack-chef-repo with kitchen
and tempest.

Out of 63 tests, 33 pass and 30 are skipped, same as with current CI
tests.

The recipe, run_tempest in openstack-integration-test, is called at the
end of the installation phase.

In addition, a tempest run can be executed manually with
"kitchen verify".

Depends-On: I98706b1fc2c65a2359ca9b117a9491c0569514bd
Change-Id: I90c4ab627e3834ba9fd5791c425320e9536f7826
This commit is contained in:
Roger Luethi 2017-09-08 14:15:19 +02:00 committed by Samuel Cassiba
parent 9274ef3a7f
commit 962633f25a
2 changed files with 141 additions and 0 deletions

127
.kitchen.yml Normal file
View File

@ -0,0 +1,127 @@
---
driver:
name: vagrant
customize:
memory: 12000
provisioner:
name: chef_zero
# You may wish to disable always updating cookbooks in CI or other testing
# environments.
# For example:
# always_update_cookbooks: <%= !ENV['CI'] %>
always_update_cookbooks: true
require_chef_omnibus: 12
# 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.
encrypted_data_bag_secret_key_path: .chef/encrypted_data_bag_secret
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'
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]
- recipe[openstack-common::client]
- recipe[openstack-ops-database::server]
- recipe[openstack-ops-database::openstack-db]
- recipe[openstack-ops-messaging::rabbitmq-server]
- recipe[openstack-identity::server-apache]
- recipe[openstack-identity::registration]
- recipe[openstack-identity::openrc]
- recipe[openstack-image::api]
- recipe[openstack-image::registry]
- recipe[openstack-image::identity_registration]
- recipe[openstack-network::identity_registration]
- recipe[openstack-network::ml2_core_plugin]
- recipe[openstack-network::ml2_openvswitch]
- recipe[openstack-network]
- recipe[openstack-network::openvswitch]
- recipe[openstack-network::_bridge_config_example]
- recipe[openstack-network::plugin_config]
- recipe[openstack-network::server]
- recipe[openstack-network::l3_agent]
- recipe[openstack-network::dhcp_agent]
- recipe[openstack-network::metadata_agent]
- recipe[openstack-network::openvswitch_agent]
- recipe[openstack-compute::nova-setup]
- recipe[openstack-compute::identity_registration]
- recipe[openstack-compute::conductor]
- recipe[openstack-compute::api-os-compute]
- recipe[openstack-compute::api-metadata]
- recipe[openstack-compute::placement_api]
- recipe[openstack-compute::scheduler]
- recipe[openstack-compute::vncproxy]
- recipe[openstack-compute::compute]
- recipe[openstack-compute::identity_registration]
# NOTE: block-storage, orchestration, dashboard, etc. can be installed
# but are not tested by tempest
- recipe[openstack-block-storage::api]
- recipe[openstack-block-storage::scheduler]
- recipe[openstack-block-storage::volume_driver_lvm]
- recipe[openstack-block-storage::volume]
- recipe[openstack-block-storage::backup]
- recipe[openstack-block-storage::identity_registration]
- recipe[openstack-orchestration::engine]
- recipe[openstack-orchestration::api]
- recipe[openstack-orchestration::api-cfn]
- recipe[openstack-orchestration::api-cloudwatch]
- recipe[openstack-orchestration::identity_registration]
- recipe[openstack-image::image_upload]
- recipe[openstack-dashboard::horizon]
- recipe[openstack-dashboard::neutron-lbaas-dashboard]
- recipe[openstack-integration-test::create_network]
- recipe[openstack-integration-test::setup]
- recipe[openstack-integration-test::run_tempest]
verifier:
inspec_tests:
- test/tempest/default
# from environments/allinone-ubuntu16.json, environments/allinone-centos7.json
attributes:
# Attributes copied from environments/integration-ubuntu16.json
openstack:
telemetry:
conf:
DEFAULT:
meter_dispatchers: database
mq:
user: admin
network:
conf:
DEFAULT:
service_plugins: router
image:
image_upload: true
compute:
conf:
libvirt:
virt_type: qemu
secret:
key_path: /tmp/kitchen/encrypted_data_bag_secret

View File

@ -0,0 +1,14 @@
# # encoding: utf-8
# Inspec test for openstack-chef-repo
# The Inspec reference, with examples and extensive documentation, can be
# 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 | ' \
'tee /root/inspec-tempest-$(date -Iminutes).log &&' \
'exit \${PIPESTATUS[0]}"') do
its('exit_status') { should eq 0 }
end