From b22dee9edad2c90b94cf78f5ed8fddbc1760b0a0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Konrad=20Ba=C5=84ka?= Date: Fri, 7 May 2021 12:46:51 +0200 Subject: [PATCH] [vFW_CNF_CDS] Provide Helm Tests for CNF MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Provide simple ping-based Helm tests for vFW CNF for demo purposes. Issue-ID: INT-1899 Signed-off-by: Konrad Bańka Change-Id: Ib526989760f34de790bd8d7a403941d73cb7250c --- .coafile | 4 +- .../templates/helm/vfw/templates/tests/ping.yaml | 55 ++++++++++++++++++++++ heat/vFW_CNF_CDS/templates/helm/vfw/values.yaml | 5 ++ .../templates/helm/vpkg/templates/tests/ping.yaml | 44 +++++++++++++++++ heat/vFW_CNF_CDS/templates/helm/vpkg/values.yaml | 5 ++ .../templates/helm/vsn/templates/tests/ping.yaml | 44 +++++++++++++++++ heat/vFW_CNF_CDS/templates/helm/vsn/values.yaml | 5 ++ 7 files changed, 161 insertions(+), 1 deletion(-) create mode 100644 heat/vFW_CNF_CDS/templates/helm/vfw/templates/tests/ping.yaml create mode 100644 heat/vFW_CNF_CDS/templates/helm/vpkg/templates/tests/ping.yaml create mode 100644 heat/vFW_CNF_CDS/templates/helm/vsn/templates/tests/ping.yaml diff --git a/.coafile b/.coafile index 372be892..0d741e60 100644 --- a/.coafile +++ b/.coafile @@ -1,8 +1,10 @@ [yaml] bears = YAMLLintBear yamllint_config = .yamllint +#[vFW_CNF_CDS] Helm tests use go template conditionals that are not yaml-compliant ignore = - .tox/** + .tox/**, + heat/vFW_CNF_CDS/templates/helm/**/templates/tests/* [json] bears = JSONFormatBear diff --git a/heat/vFW_CNF_CDS/templates/helm/vfw/templates/tests/ping.yaml b/heat/vFW_CNF_CDS/templates/helm/vfw/templates/tests/ping.yaml new file mode 100644 index 00000000..37b41832 --- /dev/null +++ b/heat/vFW_CNF_CDS/templates/helm/vfw/templates/tests/ping.yaml @@ -0,0 +1,55 @@ +--- +# Copyright © 2021 Samsung Electronics +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +{{- if eq .Values.Tests.enabled "yes" }} +apiVersion: batch/v1 +kind: Job +metadata: + name: "{{ .Values.vfw_name_0 }}-test" + labels: + vnf-name: {{ .Values.vnf_name }} + vf-module-name: {{ .Values.vfw_name_0 }} + release: {{ .Release.Name }} + chart: {{ .Chart.Name }} + annotations: + "helm.sh/hook": test-success +spec: + completions: 1 + template: + metadata: + annotations: + k8s.v1.cni.cncf.io/networks: "{{ .Values.net_attachment_definition }}" + k8s.plugin.opnfv.org/nfn-network: | + { "type": "ovn4nfv", + "interface": [ + { + "name": {{ .Values.int_private1_net_id | quote }}, + "interface": "eth1" , + "defaultGateway": "false" + } + { + "name": {{ .Values.int_private2_net_id | quote }}, + "interface": "eth2" , + "defaultGateway": "false" + } + ] + } + spec: + restartPolicy: Never + containers: + - name: "ping-test-eth1" + image: busybox + command: + - /bin/sh + - -exc + - "ping -c {{ .Values.Tests.ping_count }} -I eth1 {{ .Values.vfw_int_private1_ip_0 }}" + - name: "ping-test-eth2" + image: busybox + command: + - /bin/sh + - -exc + - "ping -c {{ .Values.Tests.ping_count }} -I eth2 {{ .Values.vfw_int_private2_ip_0 }}" +{{- end -}} diff --git a/heat/vFW_CNF_CDS/templates/helm/vfw/values.yaml b/heat/vFW_CNF_CDS/templates/helm/vfw/values.yaml index 488f61d3..59ce55bc 100644 --- a/heat/vFW_CNF_CDS/templates/helm/vfw/values.yaml +++ b/heat/vFW_CNF_CDS/templates/helm/vfw/values.yaml @@ -25,3 +25,8 @@ vsn_int_private2_ip_0: 192.168.20.3 dcae_collector_port: 8080 dcae_collector_ip: 10.0.4.1 #Placeholder demo_artifacts_version: 1.5.0 + +# Tests +Tests: + enabled: "yes" + ping_count: 4 diff --git a/heat/vFW_CNF_CDS/templates/helm/vpkg/templates/tests/ping.yaml b/heat/vFW_CNF_CDS/templates/helm/vpkg/templates/tests/ping.yaml new file mode 100644 index 00000000..f4900260 --- /dev/null +++ b/heat/vFW_CNF_CDS/templates/helm/vpkg/templates/tests/ping.yaml @@ -0,0 +1,44 @@ +--- +# Copyright © 2021 Samsung Electronics +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +{{- if eq .Values.Tests.enabled "yes" }} +apiVersion: batch/v1 +kind: Job +metadata: + name: "{{ .Values.vpg_name_0 }}-test" + labels: + vnf-name: {{ .Values.vnf_name }} + vf-module-name: {{ .Values.vpg_name_0 }} + release: {{ .Release.Name }} + chart: {{ .Chart.Name }} + annotations: + "helm.sh/hook": test-success +spec: + completions: 1 + template: + metadata: + annotations: + k8s.v1.cni.cncf.io/networks: "{{ .Values.net_attachment_definition }}" + k8s.plugin.opnfv.org/nfn-network: | + { "type": "ovn4nfv", + "interface": [ + { + "name": {{ .Values.int_private1_net_id | quote }}, + "interface": "eth1" , + "defaultGateway": "false" + } + ] + } + spec: + restartPolicy: Never + containers: + - name: "ping-test-eth1" + image: busybox + command: + - /bin/sh + - -exc + - "ping -c {{ .Values.Tests.ping_count }} -I eth1 {{ .Values.vpg_int_private1_ip_0 }}" +{{- end -}} diff --git a/heat/vFW_CNF_CDS/templates/helm/vpkg/values.yaml b/heat/vFW_CNF_CDS/templates/helm/vpkg/values.yaml index 82c208cb..4c07aa58 100644 --- a/heat/vFW_CNF_CDS/templates/helm/vpkg/values.yaml +++ b/heat/vFW_CNF_CDS/templates/helm/vpkg/values.yaml @@ -29,3 +29,8 @@ demo_artifacts_version: 1.5.0 vfw_int_private1_ip_0: 192.168.10.3 vsn_int_private2_ip_0: 192.168.20.3 int_private2_net_cidr: 192.168.20.0/24 + +# Tests +Tests: + enabled: "yes" + ping_count: 4 diff --git a/heat/vFW_CNF_CDS/templates/helm/vsn/templates/tests/ping.yaml b/heat/vFW_CNF_CDS/templates/helm/vsn/templates/tests/ping.yaml new file mode 100644 index 00000000..9b6a6d3e --- /dev/null +++ b/heat/vFW_CNF_CDS/templates/helm/vsn/templates/tests/ping.yaml @@ -0,0 +1,44 @@ +--- +# Copyright © 2021 Samsung Electronics +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Apache License, Version 2.0 +# which accompanies this distribution, and is available at +# http://www.apache.org/licenses/LICENSE-2.0 +{{- if eq .Values.Tests.enabled "yes" }} +apiVersion: batch/v1 +kind: Job +metadata: + name: "{{ .Values.vsn_name_0 }}-test" + labels: + vnf-name: {{ .Values.vnf_name }} + vf-module-name: {{ .Values.vsn_name_0 }} + release: {{ .Release.Name }} + chart: {{ .Chart.Name }} + annotations: + "helm.sh/hook": test-success +spec: + completions: 1 + template: + metadata: + annotations: + k8s.v1.cni.cncf.io/networks: "{{ .Values.net_attachment_definition }}" + k8s.plugin.opnfv.org/nfn-network: | + { "type": "ovn4nfv", + "interface": [ + { + "name": {{ .Values.int_private2_net_id | quote }}, + "interface": "eth1" , + "defaultGateway": "false" + } + ] + } + spec: + restartPolicy: Never + containers: + - name: "ping-test-eth1" + image: busybox + command: + - /bin/sh + - -exc + - "ping -c {{ .Values.Tests.ping_count }} -I eth1 {{ .Values.vsn_int_private2_ip_0 }}" +{{- end -}} diff --git a/heat/vFW_CNF_CDS/templates/helm/vsn/values.yaml b/heat/vFW_CNF_CDS/templates/helm/vsn/values.yaml index 6d12c514..44f0ba98 100644 --- a/heat/vFW_CNF_CDS/templates/helm/vsn/values.yaml +++ b/heat/vFW_CNF_CDS/templates/helm/vsn/values.yaml @@ -24,3 +24,8 @@ vsn_onap_private_ip_0: 10.10.100.4 # Env Variables int_private2_gw_ip: 192.168.20.1 int_private1_net_cidr: 192.168.10.0/24 + +# Tests +Tests: + enabled: "yes" + ping_count: 4 -- 2.16.6