From fbbc2c01ebcd16758ab6a2b6066bad707a085dd6 Mon Sep 17 00:00:00 2001 From: Jens Rosenboom Date: Fri, 11 Mar 2016 09:55:21 +0100 Subject: [PATCH] Use new devstack-logs publisher Instead of pasting all the logs onto the console, we can now have them saved seperately by the devstack-logs publisher. Add "|| true" rescue commands to the chef-client invocations, so that rake will continue to run through to the save_logs even if the chef run fails. Change-Id: I475509d770e90da38ba76d4fe126d6610ef280e2 --- Rakefile | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/Rakefile b/Rakefile index 8019481..fbc75b7 100644 --- a/Rakefile +++ b/Rakefile @@ -150,6 +150,15 @@ def _setup_cinder_volume # rubocop:disable Metrics/MethodLength ) end +def _save_logs(prefix) + sh %(sleep 25) + %w(nova neutron keystone cinder glance heat).each do |project| + sh %(mkdir -p logs/#{prefix}/#{project}) + sh %(sudo cp -r /etc/#{project} logs/#{prefix}/#{project}/etc) + sh %(sudo cp -r /var/log/#{project} logs/#{prefix}/#{project}/log) + end +end + desc "Integration test on Infra" task :integration => [:create_key, :berks_vendor] do # This is a workaround for allowing chef-client to run in local mode @@ -160,15 +169,13 @@ task :integration => [:create_key, :berks_vendor] do for i in 1..3 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 integration-aio-neutron -r 'role[allinone-compute]','role[os-image-upload]','recipe[openstack-integration-test::setup]') + sh %(sudo chef-client #{client_opts} -E integration-aio-neutron -r 'role[allinone-compute]','role[os-image-upload]','recipe[openstack-integration-test::setup]' || true) + _save_logs("pass#{i}") _setup_local_network if i == 1 _run_basic_queries _setup_cinder_volume _run_nova_tests end - # Run the tempest formal tests, setup with the openstack-integration-test cookbook - Dir.chdir('/opt/tempest') do - sh %(sudo ./run_tests.sh) - end - # TODO (MRV) gather logs + + sh %(sudo chown -R $USER logs) end