add another fail message

This commit is contained in:
Stavros kois
2022-12-14 15:32:43 +02:00
parent 9162dbe908
commit 67fe7304c7
4 changed files with 34 additions and 20 deletions

View File

@@ -2,15 +2,6 @@ suite: certificate dict test
templates:
- common.yaml
tests:
- it: should fail with no ixCertificates key
set:
scaleCerts:
cert_name:
id: 1
asserts:
- failedTemplate:
errorMessage: Key <ixCertificates> does not exist
- it: should fail with empty ixCertificates key
set:
scaleCerts:

View File

@@ -2,15 +2,6 @@ suite: certificate list test
templates:
- common.yaml
tests:
- it: should fail with no ixCertificates key
set:
scaleCertsList:
- name: cert_name
id: 1
asserts:
- failedTemplate:
errorMessage: Key <ixCertificates> does not exist
- it: should fail with empty ixCertificates key
set:
scaleCertsList:

View File

@@ -104,6 +104,21 @@ tests:
- failedTemplate:
errorMessage: <destination> and <gateway> are required when <staticRoutes> are defined. Interface (ens3s0)
- it: should fail with ixExternalInterfacesConfiguration empty
documentIndex: &externalInterfaceDoc 0
set:
# Only to pass validation
externalInterfaces:
- hostInterface: ens3s0
ipam:
type: dhcp
# Simulate the ix Injected values
ixExternalInterfacesConfiguration:
- '{"cniVersion": "0.3.1", "name": "ix-RELEASE-NAME-0", "type": "macvlan", "master": "ens3s0", "ipam": {"type": "dhcp"}}'
asserts:
- failedTemplate:
errorMessage: There are externalInterfaces defined, but key <ixExternalInterfaceConfigurationNames> is empty.
- it: should pass with externalInterface defined
documentIndex: &externalInterfaceDoc 0
set:
@@ -115,6 +130,8 @@ tests:
# Simulate the ix Injected values
ixExternalInterfacesConfiguration:
- '{"cniVersion": "0.3.1", "name": "ix-RELEASE-NAME-0", "type": "macvlan", "master": "ens3s0", "ipam": {"type": "dhcp"}}'
ixExternalInterfacesConfigurationNames:
- ix-RELEASE-NAME-0
asserts:
- hasDocuments:
count: 4
@@ -196,6 +213,9 @@ tests:
ixExternalInterfacesConfiguration:
- '{"cniVersion": "0.3.1", "name": "ix-RELEASE-NAME-0", "type": "macvlan", "master": "ens3s0", "ipam": {"type": "dhcp"}}'
- '{"cniVersion": "0.3.1", "name": "ix-RELEASE-NAME-1", "type": "macvlan", "master": "ens5s0", "ipam": {"type": "dhcp"}}'
ixExternalInterfacesConfigurationNames:
- ix-RELEASE-NAME-0
- ix-RELEASE-NAME-1
asserts:
- hasDocuments:
count: 5
@@ -253,6 +273,8 @@ tests:
# Simulate the ix Injected values
ixExternalInterfacesConfiguration:
- '{"cniVersion": "0.3.1", "name": "ix-RELEASE-NAME-0", "type": "macvlan", "master": "ens3s0", "ipam": {"type": "dhcp"}}'
ixExternalInterfacesConfigurationNames:
- ix-RELEASE-NAME-0
asserts:
- hasDocuments:
count: 4
@@ -283,6 +305,8 @@ tests:
# Simulate the ix Injected values
ixExternalInterfacesConfiguration:
- '{"cniVersion": "0.3.1", "name": "ix-RELEASE-NAME-0", "type": "macvlan", "master": "ens3s0", "ipam": {"type": "dhcp"}}'
ixExternalInterfacesConfigurationNames:
- ix-RELEASE-NAME-0
asserts:
- hasDocuments:
count: 4
@@ -311,6 +335,8 @@ tests:
# Simulate the ix Injected values
ixExternalInterfacesConfiguration:
- '{"cniVersion": "0.3.1", "name": "ix-RELEASE-NAME-0", "type": "macvlan", "master": "ens3s0", "ipam": {"type": "dhcp"}}'
ixExternalInterfacesConfigurationNames:
- ix-RELEASE-NAME-0
asserts:
- hasDocuments:
count: 4
@@ -349,6 +375,8 @@ tests:
# Simulate the ix Injected values
ixExternalInterfacesConfiguration:
- '{"cniVersion": "0.3.1", "name": "ix-RELEASE-NAME-0", "type": "macvlan", "master": "ens3s0", "ipam": {"type": "dhcp"}}'
ixExternalInterfacesConfigurationNames:
- ix-RELEASE-NAME-0
asserts:
- hasDocuments:
count: 4

View File

@@ -13,9 +13,13 @@ These annotations will be applied to all "workload" "spec" objects
Rendered under ".spec.template.metadata.annotations"
*/}}
{{- define "ix.v1.common.annotations.workload.spec" -}}
{{- if .Values.ixExternalInterfacesConfigurationNames }}
{{- if .Values.ixExternalInterfacesConfiguration -}}
{{- if .Values.ixExternalInterfacesConfigurationNames }}
k8s.v1.cni.cncf.io/networks: {{ join ", " .Values.ixExternalInterfacesConfigurationNames }}
{{- end }}
{{- else -}}
{{- fail "There are externalInterfaces defined, but key <ixExternalInterfaceConfigurationNames> is empty." -}}
{{- end }}
{{- end -}}
{{- end -}}
{{/*