blob: 46e4247a9a5f2cf1439ab176045a69d2cec4191e [file] [log] [blame]
---
# ============LICENSE_START=======================================================
# Copyright (C) 2020 The Nordix Foundation. All rights reserved.
# ================================================================================
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
# ============LICENSE_END=========================================================
- name: Set test work and result directories
set_fact:
testfw_workdir: "{{ test_cache }}/{{ test_framework }}/{{ healthcheck_test_tier }}"
testfw_configdir: "{{ config_path }}/{{ test_framework }}"
testfw_resultdir: "{{ test_cache }}/{{ test_framework }}/{{ healthcheck_test_tier }}/results"
- name: Ensure {{ testfw_workdir }} exists and empty
file:
path: "{{ testfw_workdir }}"
state: "{{ item }}"
mode: 0755
with_items:
- absent
- directory
become: true
- name: Ensure {{ testfw_configdir }} exists and empty
file:
path: "{{ testfw_configdir }}"
state: "{{ item }}"
mode: 0755
with_items:
- absent
- directory
become: true
- name: Ensure {{ testfw_resultdir }} exists and empty
file:
path: "{{ testfw_resultdir }}"
state: "{{ item }}"
mode: 0755
with_items:
- absent
- directory
become: true
- name: Get the list of ONAP componants installed and enabled in the setup
shell: |
set -o pipefail && \
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
args:
executable: "/bin/bash"
changed_when: false
register: onap_enabled_services
- name: Generate testcases.yaml file
template:
src: healthcheck-testcases.yaml.j2
dest: "{{ testfw_configdir }}/testcases.yaml"
- name: Delete existing {{ healthcheck_config_map }}
k8s:
name: "{{ healthcheck_config_map }}"
kind: ConfigMap
api_version: v1
state: absent
namespace: onap
- name: Create xtesting healthcheck testcases ConfigMap - {{ healthcheck_config_map }}
shell: |
kubectl -n {{ onap_namespace }} create configmap {{ healthcheck_config_map }} --from-file "{{ testfw_configdir }}/testcases.yaml"
args:
executable: "/bin/bash"
changed_when: false
# eprasad: there is bug in ansible k8s module, removing a job doest not remove pods assisated with it hence using shell here.
- name: Delete healthcheck job
shell: |
"kubectl -n {{ onap_namespace }} delete job xtesting-onap-{{ healthcheck_test_tier }}"
args:
executable: "/bin/bash"
changed_when: false
ignore_errors: yes # yamllint disable-line rule:truthy
- name: Construct and save healthcheck testsuite deployment to file
template:
src: "healthcheck_deployment.yaml.j2"
dest: "{{ testfw_configdir }}/healthcheck-{{ healthcheck_test_tier }}.yaml"
# vim: set ts=2 sw=2 expandtab: