add lists

This commit is contained in:
Stavros kois
2023-11-25 23:10:47 +02:00
parent 15a058b0e4
commit d8142e48dc
5 changed files with 147 additions and 1 deletions

View File

@@ -0,0 +1,51 @@
suite: velero backupStorageLocationList test
templates:
- common.yaml
release:
name: test-release-name
namespace: test-release-namespace
tests:
- it: should generate correct spec with aws provider and credential
set:
backupStorageLocationList:
- name: my-snap1
enabled: true
provider: aws
credential:
aws:
id: my-id
key: my-key
objectStorage:
bucket: my-bucket
asserts:
- documentIndex: &secretDoc 0
isKind:
of: Secret
- documentIndex: *secretDoc
isAPIVersion:
of: v1
- documentIndex: *secretDoc
equal:
path: stringData
value:
cloud: |-
[default]
aws_access_key_id=my-id
aws_secret_access_key=my-key
- documentIndex: &backStoreLocDoc 1
isKind:
of: BackupStorageLocation
- documentIndex: *backStoreLocDoc
isAPIVersion:
of: velero.io/v1
- documentIndex: *backStoreLocDoc
equal:
path: spec
value:
provider: velero.io/aws
credential:
name: bsl-test-release-name-common-test-my-snap1
key: cloud
accessMode: ReadWrite
objectStorage:
bucket: my-bucket

View File

@@ -0,0 +1,46 @@
suite: velero volumeSnapshotLocationList spec test
templates:
- common.yaml
release:
name: test-release-name
namespace: test-release-namespace
tests:
- it: should generate correct spec with aws provider and credential
set:
volumeSnapshotLocationList:
- name: my-snap1
enabled: true
provider: aws
credential:
aws:
id: my-id
key: my-key
asserts:
- documentIndex: &secretDoc 0
isKind:
of: Secret
- documentIndex: *secretDoc
isAPIVersion:
of: v1
- documentIndex: *secretDoc
equal:
path: stringData
value:
cloud: |-
[default]
aws_access_key_id=my-id
aws_secret_access_key=my-key
- documentIndex: &volSnapLocDoc 1
isKind:
of: VolumeSnapshotLocation
- documentIndex: *volSnapLocDoc
isAPIVersion:
of: velero.io/v1
- documentIndex: *volSnapLocDoc
equal:
path: spec
value:
provider: velero.io/aws
credential:
name: vsl-test-release-name-common-test-my-snap1
key: cloud

View File

@@ -0,0 +1,43 @@
suite: volumeSnapshotList spec test
templates:
- common.yaml
release:
name: test-release-name
namespace: test-release-namespace
tests:
- it: should generate correct spec
set:
volumeSnapshots:
- name: example1
enabled: true
source:
volumeSnapshotContentName: some-name
- name: example2
enabled: true
source:
persistentVolumeClaimName: some-pvc-name
asserts:
- documentIndex: &volumeSnapshotDoc 0
isKind:
of: VolumeSnapshot
- documentIndex: *volumeSnapshotDoc
isAPIVersion:
of: snapshot.storage.k8s.io/v1
- documentIndex: *volumeSnapshotDoc
equal:
path: spec
value:
source:
volumeSnapshotContentName: some-name
- documentIndex: &otherVolumeSnapshotDoc 1
isKind:
of: VolumeSnapshot
- documentIndex: *otherVolumeSnapshotDoc
isAPIVersion:
of: snapshot.storage.k8s.io/v1
- documentIndex: *otherVolumeSnapshotDoc
equal:
path: spec
value:
source:
persistentVolumeClaimName: some-pvc-name

View File

@@ -10,4 +10,10 @@
{{- include "tc.v1.common.values.ingressList" . -}}
{{- include "tc.v1.common.values.backupStorageLocationList" . -}}
{{- include "tc.v1.common.values.volumeSnapshotLocationList" . -}}
{{- include "tc.v1.common.values.volumeSnapshotList" . -}}
{{- end -}}

View File

@@ -1,4 +1,4 @@
{{- define "tc.v1.common.values.volumeSnapshotList" -}}
{{- define "tc.v1.common.values.volumeSnapshotLocationList" -}}
{{- $rootCtx := . -}}
{{- range $idx, $vslValues := $rootCtx.Values.volumeSnapshotLocationList -}}