From c570dd05e2da3ee24c115246c4213f20ae8f8f5d Mon Sep 17 00:00:00 2001 From: Chandan Kumar Date: Mon, 7 May 2018 13:40:12 +0530 Subject: [PATCH] Enable tempest.log in /var/log/tempest for container * In CI, when tempest container is used, It is good to dump the logs in /var/log/tempest so that it would be easier to verify tempest container is used. * Introduced tempest_log_dir and tempest_log_file var to the validate-tempest-playbook Depends-On: https://review.openstack.org/#/c/566364/ Change-Id: Ifd72d902c623b3941a6c714e36b7cf104109a570 --- roles/validate-tempest/README.md | 2 ++ roles/validate-tempest/defaults/main.yml | 2 ++ roles/validate-tempest/tasks/tempest-results.yml | 5 +++++ roles/validate-tempest/templates/configure-tempest.sh.j2 | 4 ++++ roles/validate-tempest/templates/run-tempest.sh.j2 | 1 + 5 files changed, 14 insertions(+) diff --git a/roles/validate-tempest/README.md b/roles/validate-tempest/README.md index f6086b214..15164724e 100644 --- a/roles/validate-tempest/README.md +++ b/roles/validate-tempest/README.md @@ -31,6 +31,8 @@ Role Variables * `tempestmail_config`: config.yaml - name of config file for tempestmail script * `tempestmail_log_server`: - Server where the logs are saved * `tempest_track_resources`: true/false - whether to save the state of resources after tempest run (default: true) +* `tempest_log_dir`: - The directory path where tempest log file is stored (default: /var/log/tempest) +* `tempest_log_file`: - The name of tempest log file (default: tempest.log) * `check_tempest_bugs`: true/false - Will check every bugzilla and launchpad bug in the yaml skip file * `tempest_plugins`: list - List of openstack services tempest plugins to be installed diff --git a/roles/validate-tempest/defaults/main.yml b/roles/validate-tempest/defaults/main.yml index 3822bd609..228d3464b 100644 --- a/roles/validate-tempest/defaults/main.yml +++ b/roles/validate-tempest/defaults/main.yml @@ -30,6 +30,8 @@ tempest_dir: "{{ working_dir }}/tempest" tempest_whitelist_file_src: "whitelist_file.j2" tempest_whitelist_file: "whitelist_file.conf" tempest_whitelist: [] +tempest_log_dir: "/var/log/tempest" +tempest_log_file: "tempest.log" tempest_plugins: >- {% if release not in ['newton', 'ocata', 'pike'] -%} [ "python-keystone-tests-tempest", "python-neutron-tests-tempest" ] diff --git a/roles/validate-tempest/tasks/tempest-results.yml b/roles/validate-tempest/tasks/tempest-results.yml index 9853e5109..b97f5f392 100644 --- a/roles/validate-tempest/tasks/tempest-results.yml +++ b/roles/validate-tempest/tasks/tempest-results.yml @@ -6,6 +6,11 @@ sudo chmod -R 777 {{ tempest_dir }} when: tempest_format == 'container' + - name: Change permission of tempest container log directory + shell: | + sudo chmod -R 777 /var/log/containers/tempest + when: tempest_format == 'container' + - name: Generate testrepository.subunit results file shell: > set -o pipefail && diff --git a/roles/validate-tempest/templates/configure-tempest.sh.j2 b/roles/validate-tempest/templates/configure-tempest.sh.j2 index 2f95c31a1..6f8550284 100644 --- a/roles/validate-tempest/templates/configure-tempest.sh.j2 +++ b/roles/validate-tempest/templates/configure-tempest.sh.j2 @@ -132,6 +132,10 @@ $TEMPESTCONF --out etc/tempest.conf \ {% endfor %} {% endif %} --create \ + {% if tempest_format == 'container' %} + DEFAULT.log_dir {{ tempest_log_dir }} \ + DEFAULT.log_file {{ tempest_log_file }} \ + {% endif %} {% if release in ['newton', 'ocata', 'pike'] %} identity.uri $OS_AUTH_URL \ identity.admin_password $OS_PASSWORD \ diff --git a/roles/validate-tempest/templates/run-tempest.sh.j2 b/roles/validate-tempest/templates/run-tempest.sh.j2 index f027b497d..769e41211 100644 --- a/roles/validate-tempest/templates/run-tempest.sh.j2 +++ b/roles/validate-tempest/templates/run-tempest.sh.j2 @@ -48,6 +48,7 @@ sudo docker run -i -v $RCFILE:$RCFILE \ -v {{ working_dir }}/{{ tempest_whitelist_file }}:{{ working_dir }}/{{ tempest_whitelist_file }} \ -v {{ working_dir }}/{{ tempest_deployer_input_file }}:{{ working_dir }}/{{ tempest_deployer_input_file }} \ {% endif %} + -v /var/log/containers/tempest:{{ tempest_log_dir }} \ -v {{ tempest_dir }}:{{ tempest_dir }} \ -v {{ working_dir }}/tempest_container.sh:{{ working_dir }}/tempest_container.sh \ {% if not 'http' in tempest_test_image_path %}