blob: c65035ca556237e77b3d0697cd13651a6b4d2741 [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
eprasad81108dc2020-12-29 11:49:10 +000026 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/\///'
eprasadef12f102020-11-25 08:57:22 +000027 register: xtesting_pod
28
29- name: Wait for healthcheck job to complete
eprasad81108dc2020-12-29 11:49:10 +000030 shell: "kubectl -n {{ onap_namespace }} get pods {{ xtesting_pod.stdout }}"
eprasadef12f102020-11-25 08:57:22 +000031 register: healthcheck_pod
32 until: '" Completed " in healthcheck_pod.stdout'
33 retries: 100
34 delay: 4
35
36- name: collect healthcheck testsuite logs
eprasad81108dc2020-12-29 11:49:10 +000037 shell: "kubectl -n {{ onap_namespace }} logs {{ xtesting_pod.stdout }}"
eprasadef12f102020-11-25 08:57:22 +000038 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:
eprasadada6d5b2020-12-07 17:18:33 +000046 content: "{{ healthcheck_log.stdout }}"
eprasad81108dc2020-12-29 11:49:10 +000047 dest: "{{ test_cache }}/xtesting/{{ healthcheck_test_tier }}/results/xtesting.log"
eprasadef12f102020-11-25 08:57:22 +000048
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: