restructure addon tests

This commit is contained in:
Kjeld Schouten-Lebbing
2023-02-18 19:42:05 +01:00
parent 0668682d36
commit 5db4614a28
2 changed files with 196 additions and 0 deletions

View File

@@ -0,0 +1,47 @@
suite: addon codeserver
templates:
- common.yaml
tests:
- it: default should pass
asserts:
- hasDocuments:
count: 3
- documentIndex: 1
isKind:
of: Service
- documentIndex: &DeploymentDocument 0
isKind:
of: Deployment
- documentIndex: *DeploymentDocument
notEqual:
path: spec.template.spec.containers[0].name
value: RELEASE-NAME-common-test-additional-codeserver
- it: addon enabled should pass
set:
addons:
codeserver:
enabled: true
volumeMounts:
- name: "config"
mountPath: "/data/config"
asserts:
- hasDocuments:
count: 4
- documentIndex: 2
isKind:
of: Service
- documentIndex: &DeploymentDocument 0
isKind:
of: Deployment
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[1].name
value: RELEASE-NAME-common-test-additional-codeserver
- documentIndex: &AddonServiceDocument 1
isKind:
of: Service
- documentIndex: *AddonServiceDocument
equal:
path: metadata.name
value: RELEASE-NAME-common-test-codeserver

View File

@@ -0,0 +1,149 @@
suite: addon vpn
templates:
- common.yaml
tests:
- it: default should pass
asserts:
- hasDocuments:
count: 3
- documentIndex: &DeploymentDocument 0
isKind:
of: Deployment
- documentIndex: 1
isKind:
of: Service
- documentIndex: *DeploymentDocument
notEqual:
path: spec.template.spec.containers[0].name
value: RELEASE-NAME-common-test-additional-vpn
- it: addon enabled with configFile should pass
set:
addons:
vpn:
type: openvpn
configFile:
enabled: true
asserts:
- hasDocuments:
count: 4
- documentIndex: &AddonVPNConfigSecretDocument 0
isKind:
of: Secret
- documentIndex: &DeploymentDocument 1
isKind:
of: Deployment
- documentIndex: *DeploymentDocument
contains:
path: spec.template.spec.containers[1].volumeMounts
content:
mountPath: /vpn/vpn.conf
name: vpnconfig
- documentIndex: *DeploymentDocument
contains:
path: spec.template.spec.volumes
content:
name: vpnconfig
hostPath:
path: /vpn/vpn.conf
type: File
- documentIndex: *AddonVPNConfigSecretDocument
equal:
path: metadata.name
value: RELEASE-NAME-common-test-openvpn
- it: addon enabled with managed secret should pass
set:
addons:
vpn:
type: openvpn
openvpn:
username: something
password: something
asserts:
- hasDocuments:
count: 4
- documentIndex: &SecretDocument 0
isKind:
of: Secret
- documentIndex: 2
isKind:
of: Service
- documentIndex: &DeploymentDocument 1
isKind:
of: Deployment
- documentIndex: *DeploymentDocument
notEqual:
path: spec.template.spec.containers[0].name
value: vpn
- it: tailscale addon enabled with authkey should pass
set:
addons:
vpn:
type: tailscale
tailscale:
authkey: something
asserts:
- hasDocuments:
count: 4
- documentIndex: &ServiceDocument 2
isKind:
of: Service
- documentIndex: &SecretDocument 0
isKind:
of: Secret
- documentIndex: *SecretDocument
isNotNull:
path: data.TS_AUTH_KEY
- documentIndex: *SecretDocument
equal:
path: metadata.name
value: RELEASE-NAME-common-test-tailscale-secret
- documentIndex: &DeploymentDocument 1
isKind:
of: Deployment
- documentIndex: *DeploymentDocument
notEqual:
path: spec.template.spec.containers[0].name
value: RELEASE-NAME-common-test-additional-tailscale
- documentIndex: *DeploymentDocument
equal:
path: spec.template.spec.containers[1].name
value: RELEASE-NAME-common-test-additional-tailscale
- documentIndex: *DeploymentDocument
contains:
path: spec.template.spec.containers[1].env
content:
name: TS_KUBE_SECRET
value: ""
- documentIndex: *DeploymentDocument
contains:
path: spec.template.spec.containers[1].env
content:
name: TS_SOCKET
value: /var/run/tailscale/tailscaled.sock
- documentIndex: *DeploymentDocument
contains:
path: spec.template.spec.containers[1].env
content:
name: TS_STATE_DIR
value: /var/lib/tailscale
- documentIndex: *DeploymentDocument
contains:
path: spec.template.spec.containers[1].env
content:
name: TS_AUTH_ONCE
value: "true"
- documentIndex: *DeploymentDocument
contains:
path: spec.template.spec.containers[1].env
content:
name: TS_USERSPACE
value: "true"
- documentIndex: *DeploymentDocument
contains:
path: spec.template.spec.containers[1].env
content:
name: TS_ACCEPT_DNS
value: "false"