mirror of
https://github.com/truenas/charts.git
synced 2026-04-05 11:48:55 +08:00
* Empty-Commit * temp commit * make sure that we use the pv * typo * add validation * typo * cleanup validation and add secret for smb * revert * add some tets * add more tests * add more tests * more tests * rename to share * rename * moar tests * clean * add some docs * fix name uniqueness and tests * make mountOptions validation a bit better * update docs
333 lines
8.9 KiB
YAML
333 lines
8.9 KiB
YAML
suite: persistence validation test
|
|
templates:
|
|
- common.yaml
|
|
tests:
|
|
- it: should fail with annotations not a dict
|
|
set:
|
|
persistence:
|
|
volume1:
|
|
enabled: true
|
|
annotations: not-a-dict
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: Persistence - Expected <annotations> to be a dictionary, but got [string]
|
|
|
|
- it: should fail with labels not a dict
|
|
set:
|
|
persistence:
|
|
volume1:
|
|
enabled: true
|
|
labels: not-a-dict
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: Persistence - Expected <labels> to be a dictionary, but got [string]
|
|
|
|
- it: should fail with pod targetSelector not a map
|
|
set:
|
|
workload:
|
|
main:
|
|
enabled: true
|
|
primary: true
|
|
type: Deployment
|
|
podSpec: {}
|
|
persistence:
|
|
volume1:
|
|
enabled: true
|
|
targetSelector: not-a-map
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: Persistence - Expected <targetSelector> to be [dict], but got [string]
|
|
|
|
- it: should fail with invalid type
|
|
set:
|
|
workload:
|
|
main:
|
|
enabled: true
|
|
primary: true
|
|
type: Deployment
|
|
podSpec: {}
|
|
persistence:
|
|
volume1:
|
|
enabled: true
|
|
type: not-a-type
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: Persistence - Expected <type> to be one of [smb-pv-pvc, nfs-pv-pvc, ix-zfs-pvc, pvc, emptyDir, hostPath, ixVolume, secret, configmap, device], but got [not-a-type]
|
|
|
|
- it: should fail with invalid accessMode
|
|
set:
|
|
persistence:
|
|
volume1:
|
|
enabled: true
|
|
type: ix-zfs-pvc
|
|
accessModes:
|
|
- not-an-access-mode
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: Persistent Volume Claim - Expected <accessModes> entry to be one of [ReadWriteOnce, ReadOnlyMany, ReadWriteMany, ReadWriteOncePod], but got [not-an-access-mode]
|
|
|
|
- it: should fail without storageClassName in ixChartContext
|
|
set:
|
|
global:
|
|
ixChartContext:
|
|
storageClassName: ""
|
|
persistence:
|
|
volume1:
|
|
enabled: true
|
|
type: ix-zfs-pvc
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: Persistent Volume Claim - Expected non-empty <global.ixChartContext.storageClassName> on [ix-zfs-pvc] type
|
|
|
|
- it: should fail with non-existent configmap
|
|
set:
|
|
configmap:
|
|
my-configmap:
|
|
enabled: true
|
|
data:
|
|
foo: bar
|
|
persistence:
|
|
volume1:
|
|
enabled: true
|
|
type: configmap
|
|
mountPath: /mnt/volume1
|
|
objectName: my-non-existent-configmap
|
|
image: &image
|
|
repository: nginx
|
|
tag: 1.17.6
|
|
pullPolicy: IfNotPresent
|
|
workload: &workload
|
|
main:
|
|
enabled: true
|
|
primary: true
|
|
type: Deployment
|
|
podSpec:
|
|
containers:
|
|
main:
|
|
enabled: true
|
|
primary: true
|
|
probes:
|
|
liveness:
|
|
enabled: false
|
|
readiness:
|
|
enabled: false
|
|
startup:
|
|
enabled: false
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: Persistence - Expected configmap [my-non-existent-configmap] defined in <objectName> to exist
|
|
|
|
- it: should fail with non-existent secret
|
|
set:
|
|
secret:
|
|
my-secret:
|
|
enabled: true
|
|
data:
|
|
foo: bar
|
|
persistence:
|
|
volume1:
|
|
enabled: true
|
|
type: secret
|
|
mountPath: /mnt/volume1
|
|
objectName: my-non-existent-secret
|
|
image: *image
|
|
workload: *workload
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: Persistence - Expected secret [my-non-existent-secret] defined in <objectName> to exist
|
|
|
|
- it: should fail without server on nfs-pv-pvc
|
|
set:
|
|
persistence:
|
|
volume1:
|
|
enabled: true
|
|
type: nfs-pv-pvc
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: NFS CSI - Expected <server> to be non-empty
|
|
|
|
- it: should fail without share on nfs-pv-pvc
|
|
set:
|
|
persistence:
|
|
volume1:
|
|
enabled: true
|
|
type: nfs-pv-pvc
|
|
server: my-server.local
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: NFS CSI - Expected <share> to be non-empty
|
|
|
|
- it: should fail without server on smb-pv-pvc
|
|
set:
|
|
persistence:
|
|
volume1:
|
|
enabled: true
|
|
type: smb-pv-pvc
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: SMB CSI - Expected <server> to be non-empty
|
|
|
|
- it: should fail without share on smb-pv-pvc
|
|
set:
|
|
persistence:
|
|
volume1:
|
|
enabled: true
|
|
type: smb-pv-pvc
|
|
server: my-server.local
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: SMB CSI - Expected <share> to be non-empty
|
|
|
|
- it: should fail without CSI when in ixChartContext on smb-pv-pvc
|
|
set:
|
|
global:
|
|
ixChartContext: {}
|
|
persistence:
|
|
volume1:
|
|
enabled: true
|
|
type: smb-pv-pvc
|
|
server: my-server.local
|
|
share: share
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: SMB CSI - Not supported CSI
|
|
|
|
- it: should fail without CSI when in ixChartContext on nfs-pv-pvc
|
|
set:
|
|
global:
|
|
ixChartContext: {}
|
|
persistence:
|
|
volume1:
|
|
enabled: true
|
|
type: nfs-pv-pvc
|
|
server: my-server.local
|
|
share: /share
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: NFS CSI - Not supported CSI
|
|
|
|
- it: should fail without username smb-pv-pvc
|
|
set:
|
|
persistence:
|
|
volume1:
|
|
enabled: true
|
|
type: smb-pv-pvc
|
|
server: my-server.local
|
|
share: share
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: SMB CSI - Expected <username> to be non-empty
|
|
|
|
- it: should fail without password on smb-pv-pvc
|
|
set:
|
|
persistence:
|
|
volume1:
|
|
enabled: true
|
|
type: smb-pv-pvc
|
|
server: my-server.local
|
|
share: share
|
|
username: my-user
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: SMB CSI - Expected <password> to be non-empty
|
|
|
|
- it: should fail with server starting with // on smb-pv-pvc
|
|
set:
|
|
persistence:
|
|
volume1:
|
|
enabled: true
|
|
type: smb-pv-pvc
|
|
server: //my-server.local
|
|
share: share
|
|
username: my-user
|
|
password: my-password
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: SMB CSI - Did not expect <server> to start with [//]
|
|
|
|
- it: should fail with share starting with / on smb-pv-pvc
|
|
set:
|
|
persistence:
|
|
volume1:
|
|
enabled: true
|
|
type: smb-pv-pvc
|
|
server: my-server.local
|
|
share: /share
|
|
username: my-user
|
|
password: my-password
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: SMB CSI - Did not expect <share> to start with [/]
|
|
|
|
- it: should fail with share starting with / on nfs-pv-pvc
|
|
set:
|
|
persistence:
|
|
volume1:
|
|
enabled: true
|
|
type: nfs-pv-pvc
|
|
server: my-server.local
|
|
share: share
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: NFS CSI - Expected <share> to start with [/]
|
|
|
|
- it: should fail with empty key on mountOptions in nfs-pv-pvc
|
|
set:
|
|
persistence:
|
|
volume1:
|
|
enabled: true
|
|
type: nfs-pv-pvc
|
|
server: my-server.local
|
|
share: /share
|
|
mountOptions:
|
|
- key: ""
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: NFS CSI - Expected key in <mountOptions> to be non-empty
|
|
|
|
- it: should fail with empty key on mountOptions in smb-pv-pvc
|
|
set:
|
|
persistence:
|
|
volume1:
|
|
enabled: true
|
|
type: smb-pv-pvc
|
|
server: my-server.local
|
|
share: share
|
|
username: my-user
|
|
password: my-password
|
|
mountOptions:
|
|
- key: ""
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: SMB CSI - Expected key in <mountOptions> to be non-empty
|
|
|
|
- it: should fail with item in mountOptions not a map in smb-pv-pvc
|
|
set:
|
|
persistence:
|
|
volume1:
|
|
enabled: true
|
|
type: smb-pv-pvc
|
|
server: my-server.local
|
|
share: share
|
|
username: my-user
|
|
password: my-password
|
|
mountOptions:
|
|
- not-a-map
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: SMB CSI - Expected <mountOption> item to be a dict, but got [string]
|
|
|
|
- it: should fail with item in mountOptions not a map in nfs-pv-pvc
|
|
set:
|
|
persistence:
|
|
volume1:
|
|
enabled: true
|
|
type: nfs-pv-pvc
|
|
server: my-server.local
|
|
share: /share
|
|
mountOptions:
|
|
- not-a-map
|
|
asserts:
|
|
- failedTemplate:
|
|
errorMessage: NFS CSI - Expected <mountOption> item to be a dict, but got [string]
|