blob: 34df2ff36a829f38ac0c54e3d9de25a3ccf05a7e [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
23 src: "{{ config_path }}/xtesting/healthcheck-{{ test_type }}.yaml"
24
25- name: Get the name of pod created by healthcheck job
26 shell: kubectl get pods -l job-name=xtesting-onap-{{ test_type }} -o name --no-headers=true | sed 's/\<pod\>//g' | sed 's/\///'
27 register: xtesting_pod
28
29- name: Wait for healthcheck job to complete
30 shell: "kubectl get pods {{ xtesting_pod.stdout }}"
31 register: healthcheck_pod
32 until: '" Completed " in healthcheck_pod.stdout'
33 retries: 100
34 delay: 4
35
36- name: collect healthcheck testsuite logs
37 shell: "kubectl logs {{ xtesting_pod.stdout }}"
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:
46 content: healthcheck_log.stdout_lines
47 dest: "{{ test_cache }}/xtesting/{{ test_type }}/results/xtesting.log"
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: