Only run a minimal integration test setup

Currently integration tests running on Infra instances are failing
because they are hitting the 8GB memory limit. So we remove all but
the most basic services from being deployed, creating effectively a
minimal-in-one setup.

Change-Id: Ica74ed9a79e7aa6800a9b5e874013df99f6654aa
Depends-On: I9e7b24ba40c9f8303eae1325ced1f5a787466888
This commit is contained in:
Jens Rosenboom 2017-03-30 14:38:42 +00:00
parent ede4b00073
commit 887f82636d
3 changed files with 126 additions and 27 deletions

View File

@ -115,7 +115,6 @@ end
# Helper for setting up basic query tests
def _run_basic_queries # rubocop:disable Metrics/MethodLength
_run_commands('basic common test queries', {
'curl' => ['-v http://localhost', '-kv https://localhost'],
'sudo netstat' => ['-nlp'],
'nova-manage' => ['version', 'db version'],
'nova' => %w(--version service-list hypervisor-list flavor-list),
@ -123,10 +122,9 @@ def _run_basic_queries # rubocop:disable Metrics/MethodLength
'glance' => %w(--version image-list),
'keystone-manage' => %w(db_version),
'openstack' => ['--version', 'user list', 'endpoint list', 'role list',
'service list', 'project list', 'volume list',
'service list', 'project list',
'network agent list', 'extension list --network ',
'network list', 'subnet list'],
'cinder-manage' => ['version list', 'db version'],
'neutron' => %w(port-list quota-list),
'ovs-vsctl' => %w(show) }
)
@ -144,26 +142,10 @@ def _run_basic_queries # rubocop:disable Metrics/MethodLength
end
end
# Helper for setting up basic ceilometer tests
def _run_ceilometer_tests(pass) # rubocop:disable Metrics/MethodLength
_run_commands('ceilometer api query', {
'ceilometer' => ['meter-list', 'resource-list', 'sample-list']
}
)
end
# Helper for setting up basic nova tests
def _run_nova_tests(pass) # rubocop:disable Metrics/MethodLength
_run_commands('cinder storage volume create', {
'openstack' => ['volume list', "volume create --description test_volume_#{pass} --size 1 test_volume_#{pass}"],
'sleep' => ['10'] }
)
_run_commands('cinder storage volume query', {
'openstack' => ['volume list'] }
)
uuid = `sudo bash -c ". /root/openrc && openstack volume show --format value -c id test_volume_#{pass}"`
_run_commands('nova server create', {
'openstack' => ['server list', "server create --image cirros --flavor m1.nano --block-device-mapping vdb=#{uuid.strip}:::1 test#{pass}"],
'openstack' => ['server list', "server create --image cirros --flavor m1.nano test#{pass}"],
'sleep' => ['40'] }
)
_run_commands('nova server cleanup', {
@ -171,7 +153,7 @@ def _run_nova_tests(pass) # rubocop:disable Metrics/MethodLength
'sleep' => ['15'] }
)
_run_commands('nova server query', {
'openstack' => ['volume list', 'server list'] }
'openstack' => ['server list'] }
)
end
@ -195,15 +177,14 @@ def _setup_nova_cells # rubocop:disable Metrics/MethodLength
)
end
# Helper for setting up tempest and upload the default cirros image. Tempest
# itself is not yet used for integration tests.
# Helper for setting up tempest and upload the default cirros image.
def _setup_tempest(client_opts)
sh %(sudo chef-client #{client_opts} -E allinone-#{@platform} -r 'recipe[openstack-integration-test::setup]')
sh %(sudo chef-client #{client_opts} -E integration-#{@platform} -r 'recipe[openstack-integration-test::setup]')
end
def _save_logs(prefix, log_dir)
sh %(sleep 25)
%w(nova neutron keystone cinder glance heat apache2 rabbitmq mysql-default openvswitch mariadb ceilometer).each do |project|
%w(nova neutron keystone glance apache2 rabbitmq mysql-default openvswitch mariadb).each do |project|
sh %(mkdir -p #{log_dir}/#{prefix}/#{project})
sh %(sudo cp -rL /etc/#{project} #{log_dir}/#{prefix}/#{project}/etc || true)
sh %(sudo cp -rL /var/log/#{project} #{log_dir}/#{prefix}/#{project}/log || true)
@ -217,12 +198,17 @@ task :integration => [:create_key, :berks_vendor] do
sh %(sudo mkdir -p /etc/chef && sudo cp .chef/encrypted_data_bag_secret /etc/chef/openstack_data_bag_secret)
_run_env_queries
# Install mysql2 gem to avoid hitting mirror issues
sh %(wget https://rubygems.org/downloads/mysql2-0.4.4.gem)
sh %(sudo apt-get install -y libmysqlclient-dev)
sh %(chef exec gem install -N ./mysql2-0.4.4.gem)
# Three passes to make sure of cookbooks idempotency
for i in 1..3
begin
puts "####### Pass #{i}"
# Kick off chef client in local mode, will converge OpenStack right on the gate job "in place"
sh %(sudo chef-client #{client_opts} -E allinone-#{@platform} -r 'role[allinone]')
sh %(sudo chef-client #{client_opts} -E integration-#{@platform} -r 'role[minimal]')
if i == 1
_setup_nova_cells
_setup_tempest(client_opts)
@ -230,7 +216,6 @@ task :integration => [:create_key, :berks_vendor] do
end
_run_basic_queries
_run_nova_tests(i)
# _run_ceilometer_tests(i)
rescue => e
raise "####### Pass #{i} failed with #{e.message}"

View File

@ -0,0 +1,63 @@
{
"name": "integration-ubuntu16",
"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",
"default_attributes": {
"apache": {
"listen": []
},
"apt": {
"compile_time_update" : true
}
},
"override_attributes": {
"openstack": {
"apt": {
"update_apt_cache": true
},
"telemetry": {
"conf": {
"DEFAULT": {
"meter_dispatchers": "database"
}
}
},
"integration-test": {
"conf": {
"service_available": {
"ceilometer": false,
"heat": false,
"horizon": false
}
}
},
"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": {
"virt_type": "qemu"
}
}
}
}
}
}

51
roles/minimal.json Normal file
View File

@ -0,0 +1,51 @@
{
"name": "minimal",
"description": "This will deploy a minimal set of services for Openstack Compute to function on a single box for integration testing.",
"json_class": "Chef::Role",
"default_attributes": {
},
"override_attributes": {
},
"chef_type": "role",
"run_list": [
"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]",
"recipe[openstack-image::image_upload]"
],
"env_run_lists": {
}
}