blob: 781714ecc191a0e68375cfc2e8e1a30da19a148b [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
57 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
58 register: onap_enabled_services
eprasadef12f102020-11-25 08:57:22 +000059
eprasadada6d5b2020-12-07 17:18:33 +000060- name: Generate testcases.yaml file
eprasadef12f102020-11-25 08:57:22 +000061 template:
eprasadada6d5b2020-12-07 17:18:33 +000062 src: healthcheck-testcases.yaml.j2
63 dest: "{{ testfw_configdir }}/testcases.yaml"
64
65- name: Delete existing {{ healthcheck_config_map }}
66 k8s:
67 name: "{{ healthcheck_config_map }}"
68 kind: ConfigMap
69 api_version: v1
70 state: absent
71 namespace: onap
72
73- name: Create xtesting healthcheck testcases ConfigMap - {{ healthcheck_config_map }}
eprasad81108dc2020-12-29 11:49:10 +000074 shell: kubectl -n {{ onap_namespace }} create configmap {{ healthcheck_config_map }} --from-file "{{ testfw_configdir }}/testcases.yaml"
eprasadada6d5b2020-12-07 17:18:33 +000075
76# eprasad: there is bug in ansible k8s module, removing a job doest not remove pods assisated with it hence using shell here.
77- name: Delete healthcheck job
eprasad81108dc2020-12-29 11:49:10 +000078 shell: "kubectl -n {{ onap_namespace }} delete job xtesting-onap-{{ healthcheck_test_tier }}"
eprasadada6d5b2020-12-07 17:18:33 +000079 ignore_errors: yes
80
81- name: Construct and save healthcheck testsuite deployment to file
82 template:
83 src: "healthcheck_deployment.yaml.j2"
eprasad81108dc2020-12-29 11:49:10 +000084 dest: "{{ testfw_configdir }}/healthcheck-{{ healthcheck_test_tier }}.yaml"
eprasadef12f102020-11-25 08:57:22 +000085
86# vim: set ts=2 sw=2 expandtab: