eprasad | ef12f10 | 2020-11-25 08:57:22 +0000 | [diff] [blame] | 1 | --- |
| 2 | # ============LICENSE_START======================================================= |
| 3 | # Copyright (C) 2020 The Nordix Foundation. All rights reserved. |
| 4 | # ================================================================================ |
| 5 | # Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | # you may not use this file except in compliance with the License. |
| 7 | # You may obtain a copy of the License at |
| 8 | # |
| 9 | # http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | # |
| 11 | # Unless required by applicable law or agreed to in writing, software |
| 12 | # distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | # See the License for the specific language governing permissions and |
| 15 | # limitations under the License. |
| 16 | # |
| 17 | # SPDX-License-Identifier: Apache-2.0 |
| 18 | # ============LICENSE_END========================================================= |
| 19 | |
| 20 | - name: start healthcheck job |
| 21 | k8s: |
| 22 | state: present |
eprasad | 81108dc | 2020-12-29 11:49:10 +0000 | [diff] [blame^] | 23 | src: "{{ config_path }}/xtesting/healthcheck-{{ healthcheck_test_tier }}.yaml" |
eprasad | ef12f10 | 2020-11-25 08:57:22 +0000 | [diff] [blame] | 24 | |
| 25 | - name: Get the name of pod created by healthcheck job |
eprasad | 81108dc | 2020-12-29 11:49:10 +0000 | [diff] [blame^] | 26 | shell: kubectl -n {{ onap_namespace }} get pods -l job-name=xtesting-onap-{{ healthcheck_test_tier }} -o name --no-headers=true | sed 's/\<pod\>//g' | sed 's/\///' |
eprasad | ef12f10 | 2020-11-25 08:57:22 +0000 | [diff] [blame] | 27 | register: xtesting_pod |
| 28 | |
| 29 | - name: Wait for healthcheck job to complete |
eprasad | 81108dc | 2020-12-29 11:49:10 +0000 | [diff] [blame^] | 30 | shell: "kubectl -n {{ onap_namespace }} get pods {{ xtesting_pod.stdout }}" |
eprasad | ef12f10 | 2020-11-25 08:57:22 +0000 | [diff] [blame] | 31 | register: healthcheck_pod |
| 32 | until: '" Completed " in healthcheck_pod.stdout' |
| 33 | retries: 100 |
| 34 | delay: 4 |
| 35 | |
| 36 | - name: collect healthcheck testsuite logs |
eprasad | 81108dc | 2020-12-29 11:49:10 +0000 | [diff] [blame^] | 37 | shell: "kubectl -n {{ onap_namespace }} logs {{ xtesting_pod.stdout }}" |
eprasad | ef12f10 | 2020-11-25 08:57:22 +0000 | [diff] [blame] | 38 | register: healthcheck_log |
| 39 | |
| 40 | - name: Log healthcheck testsuite output to console |
| 41 | debug: |
| 42 | var: healthcheck_log.stdout_lines |
| 43 | |
| 44 | - name: Save healthcheck testsuite output on jumphost |
| 45 | copy: |
eprasad | ada6d5b | 2020-12-07 17:18:33 +0000 | [diff] [blame] | 46 | content: "{{ healthcheck_log.stdout }}" |
eprasad | 81108dc | 2020-12-29 11:49:10 +0000 | [diff] [blame^] | 47 | dest: "{{ test_cache }}/xtesting/{{ healthcheck_test_tier }}/results/xtesting.log" |
eprasad | ef12f10 | 2020-11-25 08:57:22 +0000 | [diff] [blame] | 48 | |
| 49 | - name: Determine the test verdict |
| 50 | fail: |
| 51 | msg: "Tests failed!" |
| 52 | when: "'Result.EX_ERROR' in healthcheck_log.stdout" |
| 53 | |
| 54 | # vim: set ts=2 sw=2 expandtab: |