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 |
Akash Rajguru | a5e5764 | 2021-06-02 14:40:39 +0100 | [diff] [blame] | 26 | shell: | |
| 27 | set -o pipefail |
| 28 | kubectl -n {{ onap_namespace }} get pods -l job-name=xtesting-onap-{{ healthcheck_test_tier }} -o name \ |
| 29 | --no-headers=true | sed 's/\<pod\>//g' | sed 's/\///' |
| 30 | args: |
| 31 | executable: "/bin/bash" |
| 32 | changed_when: false |
eprasad | ef12f10 | 2020-11-25 08:57:22 +0000 | [diff] [blame] | 33 | register: xtesting_pod |
| 34 | |
| 35 | - name: Wait for healthcheck job to complete |
Akash Rajguru | a5e5764 | 2021-06-02 14:40:39 +0100 | [diff] [blame] | 36 | shell: | |
| 37 | kubectl -n {{ onap_namespace }} get pods {{ xtesting_pod.stdout }} |
| 38 | args: |
| 39 | executable: "/bin/bash" |
| 40 | changed_when: false |
eprasad | ef12f10 | 2020-11-25 08:57:22 +0000 | [diff] [blame] | 41 | register: healthcheck_pod |
| 42 | until: '" Completed " in healthcheck_pod.stdout' |
| 43 | retries: 100 |
| 44 | delay: 4 |
| 45 | |
| 46 | - name: collect healthcheck testsuite logs |
Akash Rajguru | a5e5764 | 2021-06-02 14:40:39 +0100 | [diff] [blame] | 47 | shell: | |
| 48 | kubectl -n {{ onap_namespace }} logs {{ xtesting_pod.stdout }} |
| 49 | args: |
| 50 | executable: "/bin/bash" |
| 51 | changed_when: false |
eprasad | ef12f10 | 2020-11-25 08:57:22 +0000 | [diff] [blame] | 52 | register: healthcheck_log |
| 53 | |
| 54 | - name: Log healthcheck testsuite output to console |
| 55 | debug: |
| 56 | var: healthcheck_log.stdout_lines |
| 57 | |
| 58 | - name: Save healthcheck testsuite output on jumphost |
| 59 | copy: |
eprasad | ada6d5b | 2020-12-07 17:18:33 +0000 | [diff] [blame] | 60 | content: "{{ healthcheck_log.stdout }}" |
eprasad | 81108dc | 2020-12-29 11:49:10 +0000 | [diff] [blame] | 61 | dest: "{{ test_cache }}/xtesting/{{ healthcheck_test_tier }}/results/xtesting.log" |
eprasad | ef12f10 | 2020-11-25 08:57:22 +0000 | [diff] [blame] | 62 | |
| 63 | - name: Determine the test verdict |
| 64 | fail: |
| 65 | msg: "Tests failed!" |
| 66 | when: "'Result.EX_ERROR' in healthcheck_log.stdout" |
| 67 | |
| 68 | # vim: set ts=2 sw=2 expandtab: |