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: |
eprasad | 81108dc | 2020-12-29 11:49:10 +0000 | [diff] [blame^] | 22 | testfw_workdir: "{{ test_cache }}/{{ test_framework }}/{{ healthcheck_test_tier }}" |
eprasad | ef12f10 | 2020-11-25 08:57:22 +0000 | [diff] [blame] | 23 | testfw_configdir: "{{ config_path }}/{{ test_framework }}" |
eprasad | 81108dc | 2020-12-29 11:49:10 +0000 | [diff] [blame^] | 24 | testfw_resultdir: "{{ test_cache }}/{{ test_framework }}/{{ healthcheck_test_tier }}/results" |
| 25 | |
eprasad | ef12f10 | 2020-11-25 08:57:22 +0000 | [diff] [blame] | 26 | - 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 | |
eprasad | ada6d5b | 2020-12-07 17:18:33 +0000 | [diff] [blame] | 56 | - 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 |
eprasad | ef12f10 | 2020-11-25 08:57:22 +0000 | [diff] [blame] | 59 | |
eprasad | ada6d5b | 2020-12-07 17:18:33 +0000 | [diff] [blame] | 60 | - name: Generate testcases.yaml file |
eprasad | ef12f10 | 2020-11-25 08:57:22 +0000 | [diff] [blame] | 61 | template: |
eprasad | ada6d5b | 2020-12-07 17:18:33 +0000 | [diff] [blame] | 62 | 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 }} |
eprasad | 81108dc | 2020-12-29 11:49:10 +0000 | [diff] [blame^] | 74 | shell: kubectl -n {{ onap_namespace }} create configmap {{ healthcheck_config_map }} --from-file "{{ testfw_configdir }}/testcases.yaml" |
eprasad | ada6d5b | 2020-12-07 17:18:33 +0000 | [diff] [blame] | 75 | |
| 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 |
eprasad | 81108dc | 2020-12-29 11:49:10 +0000 | [diff] [blame^] | 78 | shell: "kubectl -n {{ onap_namespace }} delete job xtesting-onap-{{ healthcheck_test_tier }}" |
eprasad | ada6d5b | 2020-12-07 17:18:33 +0000 | [diff] [blame] | 79 | ignore_errors: yes |
| 80 | |
| 81 | - name: Construct and save healthcheck testsuite deployment to file |
| 82 | template: |
| 83 | src: "healthcheck_deployment.yaml.j2" |
eprasad | 81108dc | 2020-12-29 11:49:10 +0000 | [diff] [blame^] | 84 | dest: "{{ testfw_configdir }}/healthcheck-{{ healthcheck_test_tier }}.yaml" |
eprasad | ef12f10 | 2020-11-25 08:57:22 +0000 | [diff] [blame] | 85 | |
| 86 | # vim: set ts=2 sw=2 expandtab: |