blob: 46e4247a9a5f2cf1439ab176045a69d2cec4191e [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: Set test work and result directories
21 set_fact:
eprasad81108dc2020-12-29 11:49:10 +000022 testfw_workdir: "{{ test_cache }}/{{ test_framework }}/{{ healthcheck_test_tier }}"
eprasadef12f102020-11-25 08:57:22 +000023 testfw_configdir: "{{ config_path }}/{{ test_framework }}"
eprasad81108dc2020-12-29 11:49:10 +000024 testfw_resultdir: "{{ test_cache }}/{{ test_framework }}/{{ healthcheck_test_tier }}/results"
25
eprasadef12f102020-11-25 08:57:22 +000026- name: Ensure {{ testfw_workdir }} exists and empty
27 file:
28 path: "{{ testfw_workdir }}"
29 state: "{{ item }}"
30 mode: 0755
31 with_items:
32 - absent
33 - directory
34 become: true
35
36- name: Ensure {{ testfw_configdir }} exists and empty
37 file:
38 path: "{{ testfw_configdir }}"
39 state: "{{ item }}"
40 mode: 0755
41 with_items:
42 - absent
43 - directory
44 become: true
45
46- name: Ensure {{ testfw_resultdir }} exists and empty
47 file:
48 path: "{{ testfw_resultdir }}"
49 state: "{{ item }}"
50 mode: 0755
51 with_items:
52 - absent
53 - directory
54 become: true
55
eprasadada6d5b2020-12-07 17:18:33 +000056- name: Get the list of ONAP componants installed and enabled in the setup
Akash Rajgurua5e57642021-06-02 14:40:39 +010057 shell: |
58 set -o pipefail && \
59 helm ls --deployed --namespace onap --output yaml | grep name: | sed 's/.* //g' | awk -F '-' '{print $2}' | egrep -v '{{ healthcheck_test_ignore_list }}' | awk /./ | sed -e 's/^/- health-/' # noqa 204
60 args:
61 executable: "/bin/bash"
62 changed_when: false
eprasadada6d5b2020-12-07 17:18:33 +000063 register: onap_enabled_services
eprasadef12f102020-11-25 08:57:22 +000064
eprasadada6d5b2020-12-07 17:18:33 +000065- name: Generate testcases.yaml file
eprasadef12f102020-11-25 08:57:22 +000066 template:
eprasadada6d5b2020-12-07 17:18:33 +000067 src: healthcheck-testcases.yaml.j2
68 dest: "{{ testfw_configdir }}/testcases.yaml"
69
70- name: Delete existing {{ healthcheck_config_map }}
71 k8s:
72 name: "{{ healthcheck_config_map }}"
73 kind: ConfigMap
74 api_version: v1
75 state: absent
76 namespace: onap
77
78- name: Create xtesting healthcheck testcases ConfigMap - {{ healthcheck_config_map }}
Akash Rajgurua5e57642021-06-02 14:40:39 +010079 shell: |
80 kubectl -n {{ onap_namespace }} create configmap {{ healthcheck_config_map }} --from-file "{{ testfw_configdir }}/testcases.yaml"
81 args:
82 executable: "/bin/bash"
83 changed_when: false
eprasadada6d5b2020-12-07 17:18:33 +000084
85# eprasad: there is bug in ansible k8s module, removing a job doest not remove pods assisated with it hence using shell here.
86- name: Delete healthcheck job
Akash Rajgurua5e57642021-06-02 14:40:39 +010087 shell: |
88 "kubectl -n {{ onap_namespace }} delete job xtesting-onap-{{ healthcheck_test_tier }}"
89 args:
90 executable: "/bin/bash"
91 changed_when: false
92 ignore_errors: yes # yamllint disable-line rule:truthy
eprasadada6d5b2020-12-07 17:18:33 +000093
94- name: Construct and save healthcheck testsuite deployment to file
95 template:
96 src: "healthcheck_deployment.yaml.j2"
eprasad81108dc2020-12-29 11:49:10 +000097 dest: "{{ testfw_configdir }}/healthcheck-{{ healthcheck_test_tier }}.yaml"
eprasadef12f102020-11-25 08:57:22 +000098
99# vim: set ts=2 sw=2 expandtab: