blob: 6a0234f1035c6122e8c89e389c37894b94fd16cb [file] [log] [blame]
eprasadef12f102020-11-25 08:57:22 +00001---
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
eprasad81108dc2020-12-29 11:49:10 +000023 src: "{{ config_path }}/xtesting/healthcheck-{{ healthcheck_test_tier }}.yaml"
eprasadef12f102020-11-25 08:57:22 +000024
25- name: Get the name of pod created by healthcheck job
Akash Rajgurua5e57642021-06-02 14:40:39 +010026 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
eprasadef12f102020-11-25 08:57:22 +000033 register: xtesting_pod
34
35- name: Wait for healthcheck job to complete
Akash Rajgurua5e57642021-06-02 14:40:39 +010036 shell: |
37 kubectl -n {{ onap_namespace }} get pods {{ xtesting_pod.stdout }}
38 args:
39 executable: "/bin/bash"
40 changed_when: false
eprasadef12f102020-11-25 08:57:22 +000041 register: healthcheck_pod
42 until: '" Completed " in healthcheck_pod.stdout'
43 retries: 100
44 delay: 4
45
46- name: collect healthcheck testsuite logs
Akash Rajgurua5e57642021-06-02 14:40:39 +010047 shell: |
48 kubectl -n {{ onap_namespace }} logs {{ xtesting_pod.stdout }}
49 args:
50 executable: "/bin/bash"
51 changed_when: false
eprasadef12f102020-11-25 08:57:22 +000052 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:
eprasadada6d5b2020-12-07 17:18:33 +000060 content: "{{ healthcheck_log.stdout }}"
eprasad81108dc2020-12-29 11:49:10 +000061 dest: "{{ test_cache }}/xtesting/{{ healthcheck_test_tier }}/results/xtesting.log"
eprasadef12f102020-11-25 08:57:22 +000062
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: