Files
library-charts/library/common-test/tests/volsync/replication_src_spec_test.yaml
Stavros Kois ac60ed57db lint
2024-06-18 18:21:20 +03:00

330 lines
9.5 KiB
YAML

suite: volsync replication src spec test
templates:
- common.yaml
chart:
appVersion: &appVer v9.9.9
release:
name: test-release-name
namespace: test-release-namespace
tests:
- it: should generate correct spec
set:
persistence:
srcbackup:
enabled: true
type: pvc
mountPath: /backedup
volsync:
- name: mybackup1
type: restic
credentials: mys3
dest:
enabled: false
src:
enabled: true
credentials: &credentials
mys3:
type: s3
url: some-url
bucket: some-bucket
encrKey: some-key
accessKey: some-access-key
secretKey: some-secret-key
asserts:
- documentIndex: &secretDoc 0
isKind:
of: Secret
- documentIndex: *secretDoc
isAPIVersion:
of: v1
- documentIndex: *secretDoc
equal:
path: stringData
value:
AWS_ACCESS_KEY_ID: some-access-key
AWS_SECRET_ACCESS_KEY: some-secret-key
RESTIC_PASSWORD: some-key
RESTIC_REPOSITORY: s3:some-url/some-bucket/test-release-name/volsync/srcbackup-volsync-mybackup1
- documentIndex: &replicationDestDoc 1
isKind:
of: ReplicationSource
- documentIndex: *replicationDestDoc
isAPIVersion:
of: volsync.backube/v1alpha1
- documentIndex: *replicationDestDoc
isSubset:
path: spec
content:
sourcePVC: test-release-name-common-test-srcbackup
trigger:
schedule: "0 0 * * *"
- documentIndex: *replicationDestDoc
isSubset:
path: spec.restic
content:
repository: test-release-name-common-test-srcbackup-volsync-mybackup1
copyMethod: Snapshot
pruneIntervalDays: 7
retain:
hourly: 24
daily: 7
weekly: 5
accessModes:
- ReadWriteOnce
moverSecurityContext:
fsGroup: 568
runAsUser: 568
runAsGroup: 568
- documentIndex: *replicationDestDoc
matchRegex:
path: spec.restic.unlock
pattern: "^[0-9]{14}$"
- it: should generate correct spec with changed defaults
set:
persistence:
srcbackup:
enabled: true
type: pvc
mountPath: /backedup
volsync:
- name: mybackup1
type: restic
credentials: mys3
copyMethod: Clone
dest:
enabled: false
src:
enabled: true
trigger:
schedule: "1 0 * * *"
retain:
hourly: 20
daily: 5
weekly: 3
pruneIntervalDays: 5
credentials: *credentials
asserts:
- documentIndex: *replicationDestDoc
isKind:
of: ReplicationSource
- documentIndex: *replicationDestDoc
isAPIVersion:
of: volsync.backube/v1alpha1
- documentIndex: *replicationDestDoc
isSubset:
path: spec
content:
sourcePVC: test-release-name-common-test-srcbackup
trigger:
schedule: "1 0 * * *"
- documentIndex: *replicationDestDoc
isSubset:
path: spec.restic
content:
repository: test-release-name-common-test-srcbackup-volsync-mybackup1
copyMethod: Clone
pruneIntervalDays: 5
retain:
hourly: 20
daily: 5
weekly: 3
accessModes:
- ReadWriteOnce
moverSecurityContext:
fsGroup: 568
runAsUser: 568
runAsGroup: 568
- documentIndex: *replicationDestDoc
matchRegex:
path: spec.restic.unlock
pattern: "^[0-9]{14}$"
- it: should generate correct spec with storageClassName
set:
persistence:
srcbackup:
enabled: true
type: pvc
mountPath: /backedup
volsync:
- name: mybackup1
type: restic
credentials: mys3
copyMethod: Clone
dest:
enabled: false
src:
enabled: true
storageClassName: somestorageclass
trigger:
schedule: "1 0 * * *"
retain:
hourly: 20
daily: 5
weekly: 3
pruneIntervalDays: 5
credentials: *credentials
asserts:
- documentIndex: *replicationDestDoc
isKind:
of: ReplicationSource
- documentIndex: *replicationDestDoc
isAPIVersion:
of: volsync.backube/v1alpha1
- documentIndex: *replicationDestDoc
isSubset:
path: spec
content:
sourcePVC: test-release-name-common-test-srcbackup
trigger:
schedule: "1 0 * * *"
- documentIndex: *replicationDestDoc
isSubset:
path: spec.restic
content:
repository: test-release-name-common-test-srcbackup-volsync-mybackup1
copyMethod: Clone
pruneIntervalDays: 5
retain:
hourly: 20
daily: 5
weekly: 3
accessModes:
- ReadWriteOnce
storageClassName: somestorageclass
moverSecurityContext:
fsGroup: 568
runAsUser: 568
runAsGroup: 568
- documentIndex: *replicationDestDoc
matchRegex:
path: spec.restic.unlock
pattern: "^[0-9]{14}$"
- it: should generate correct spec with volumeSnapshotClass
set:
persistence:
srcbackup:
enabled: true
type: pvc
mountPath: /backedup
volsync:
- name: mybackup1
type: restic
credentials: mys3
copyMethod: Clone
dest:
enabled: false
src:
enabled: true
volumeSnapshotClassName: somevsc
trigger:
schedule: "1 0 * * *"
retain:
hourly: 20
daily: 5
weekly: 3
pruneIntervalDays: 5
credentials: *credentials
asserts:
- documentIndex: *replicationDestDoc
isKind:
of: ReplicationSource
- documentIndex: *replicationDestDoc
isAPIVersion:
of: volsync.backube/v1alpha1
- documentIndex: *replicationDestDoc
isSubset:
path: spec
content:
sourcePVC: test-release-name-common-test-srcbackup
trigger:
schedule: "1 0 * * *"
- documentIndex: *replicationDestDoc
isSubset:
path: spec.restic
content:
repository: test-release-name-common-test-srcbackup-volsync-mybackup1
copyMethod: Clone
pruneIntervalDays: 5
retain:
hourly: 20
daily: 5
weekly: 3
accessModes:
- ReadWriteOnce
volumeSnapshotClassName: somevsc
moverSecurityContext:
fsGroup: 568
runAsUser: 568
runAsGroup: 568
- documentIndex: *replicationDestDoc
matchRegex:
path: spec.restic.unlock
pattern: "^[0-9]{14}$"
- it: should generate correct spec with volumeSnapshotClass and StorageClass
set:
persistence:
srcbackup:
enabled: true
type: pvc
mountPath: /backedup
volsync:
- name: mybackup1
type: restic
credentials: mys3
copyMethod: Clone
dest:
enabled: false
src:
enabled: true
storageClassName: somestorageclass
volumeSnapshotClassName: somevsc
trigger:
schedule: "1 0 * * *"
retain:
hourly: 20
daily: 5
weekly: 3
pruneIntervalDays: 5
credentials: *credentials
asserts:
- documentIndex: *replicationDestDoc
isKind:
of: ReplicationSource
- documentIndex: *replicationDestDoc
isAPIVersion:
of: volsync.backube/v1alpha1
- documentIndex: *replicationDestDoc
isSubset:
path: spec
content:
sourcePVC: test-release-name-common-test-srcbackup
trigger:
schedule: "1 0 * * *"
- documentIndex: *replicationDestDoc
isSubset:
path: spec.restic
content:
repository: test-release-name-common-test-srcbackup-volsync-mybackup1
copyMethod: Clone
pruneIntervalDays: 5
retain:
hourly: 20
daily: 5
weekly: 3
accessModes:
- ReadWriteOnce
storageClassName: somestorageclass
volumeSnapshotClassName: somevsc
moverSecurityContext:
fsGroup: 568
runAsUser: 568
runAsGroup: 568
- documentIndex: *replicationDestDoc
matchRegex:
path: spec.restic.unlock
pattern: "^[0-9]{14}$"