eprasad | ef12f10 | 2020-11-25 08:57:22 +0000 | [diff] [blame] | 1 | --- |
| 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" |
eprasad | ef12f10 | 2020-11-25 08:57:22 +0000 | [diff] [blame] | 25 | - 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 | |
eprasad | ada6d5b | 2020-12-07 17:18:33 +0000 | [diff] [blame^] | 55 | - 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 |
eprasad | ef12f10 | 2020-11-25 08:57:22 +0000 | [diff] [blame] | 58 | |
eprasad | ada6d5b | 2020-12-07 17:18:33 +0000 | [diff] [blame^] | 59 | - name: Generate testcases.yaml file |
eprasad | ef12f10 | 2020-11-25 08:57:22 +0000 | [diff] [blame] | 60 | template: |
eprasad | ada6d5b | 2020-12-07 17:18:33 +0000 | [diff] [blame^] | 61 | 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" |
eprasad | ef12f10 | 2020-11-25 08:57:22 +0000 | [diff] [blame] | 83 | dest: "{{ testfw_configdir }}/healthcheck-{{ test_type }}.yaml" |
| 84 | |
| 85 | # vim: set ts=2 sw=2 expandtab: |