blob: 895af9304e78cb7c5d21979e5db29fecf053c199 [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:
22 testfw_workdir: "{{ test_cache }}/{{ test_framework }}/{{ test_type }}"
23 testfw_configdir: "{{ config_path }}/{{ test_framework }}"
24 testfw_resultdir: "{{ test_cache }}/{{ test_framework }}/{{ test_type }}/results"
eprasadef12f102020-11-25 08:57:22 +000025- name: Ensure {{ testfw_workdir }} exists and empty
26 file:
27 path: "{{ testfw_workdir }}"
28 state: "{{ item }}"
29 mode: 0755
30 with_items:
31 - absent
32 - directory
33 become: true
34
35- name: Ensure {{ testfw_configdir }} exists and empty
36 file:
37 path: "{{ testfw_configdir }}"
38 state: "{{ item }}"
39 mode: 0755
40 with_items:
41 - absent
42 - directory
43 become: true
44
45- name: Ensure {{ testfw_resultdir }} exists and empty
46 file:
47 path: "{{ testfw_resultdir }}"
48 state: "{{ item }}"
49 mode: 0755
50 with_items:
51 - absent
52 - directory
53 become: true
54
eprasadada6d5b2020-12-07 17:18:33 +000055- name: Get the list of ONAP componants installed and enabled in the setup
56 shell: "helm ls --deployed --namespace onap -c --output yaml | grep Name: | sed 's/.* //g' | awk -F '-' '{print $2}' | egrep -v '{{ healthcheck_test_ignore_list }}' | awk /./ | sed -e 's/^/- health-/'" # noqa 204
57 register: onap_enabled_services
eprasadef12f102020-11-25 08:57:22 +000058
eprasadada6d5b2020-12-07 17:18:33 +000059- name: Generate testcases.yaml file
eprasadef12f102020-11-25 08:57:22 +000060 template:
eprasadada6d5b2020-12-07 17:18:33 +000061 src: healthcheck-testcases.yaml.j2
62 dest: "{{ testfw_configdir }}/testcases.yaml"
63
64- name: Delete existing {{ healthcheck_config_map }}
65 k8s:
66 name: "{{ healthcheck_config_map }}"
67 kind: ConfigMap
68 api_version: v1
69 state: absent
70 namespace: onap
71
72- name: Create xtesting healthcheck testcases ConfigMap - {{ healthcheck_config_map }}
73 shell: kubectl create configmap {{ healthcheck_config_map }} --from-file "{{ testfw_configdir }}/testcases.yaml"
74
75# eprasad: there is bug in ansible k8s module, removing a job doest not remove pods assisated with it hence using shell here.
76- name: Delete healthcheck job
77 shell: "kubectl delete job xtesting-onap-{{ test_type }} -n onap"
78 ignore_errors: yes
79
80- name: Construct and save healthcheck testsuite deployment to file
81 template:
82 src: "healthcheck_deployment.yaml.j2"
eprasadef12f102020-11-25 08:57:22 +000083 dest: "{{ testfw_configdir }}/healthcheck-{{ test_type }}.yaml"
84
85# vim: set ts=2 sw=2 expandtab: