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 |
Akash Rajguru | a5e5764 | 2021-06-02 14:40:39 +0100 | [diff] [blame^] | 57 | 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 |
eprasad | ada6d5b | 2020-12-07 17:18:33 +0000 | [diff] [blame] | 63 | register: onap_enabled_services |
eprasad | ef12f10 | 2020-11-25 08:57:22 +0000 | [diff] [blame] | 64 | |
eprasad | ada6d5b | 2020-12-07 17:18:33 +0000 | [diff] [blame] | 65 | - name: Generate testcases.yaml file |
eprasad | ef12f10 | 2020-11-25 08:57:22 +0000 | [diff] [blame] | 66 | template: |
eprasad | ada6d5b | 2020-12-07 17:18:33 +0000 | [diff] [blame] | 67 | 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 Rajguru | a5e5764 | 2021-06-02 14:40:39 +0100 | [diff] [blame^] | 79 | 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 |
eprasad | ada6d5b | 2020-12-07 17:18:33 +0000 | [diff] [blame] | 84 | |
| 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 Rajguru | a5e5764 | 2021-06-02 14:40:39 +0100 | [diff] [blame^] | 87 | 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 |
eprasad | ada6d5b | 2020-12-07 17:18:33 +0000 | [diff] [blame] | 93 | |
| 94 | - name: Construct and save healthcheck testsuite deployment to file |
| 95 | template: |
| 96 | src: "healthcheck_deployment.yaml.j2" |
eprasad | 81108dc | 2020-12-29 11:49:10 +0000 | [diff] [blame] | 97 | dest: "{{ testfw_configdir }}/healthcheck-{{ healthcheck_test_tier }}.yaml" |
eprasad | ef12f10 | 2020-11-25 08:57:22 +0000 | [diff] [blame] | 98 | |
| 99 | # vim: set ts=2 sw=2 expandtab: |