Skip to content

Commit

Permalink
add credentials list test
Browse files Browse the repository at this point in the history
  • Loading branch information
stavros-k committed May 19, 2024
1 parent 1de2444 commit 5292ef8
Showing 1 changed file with 146 additions and 0 deletions.
146 changes: 146 additions & 0 deletions library/common-test/tests/lists/credentialsList_test.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
suite: credentials list test
templates:
- common.yaml
release:
name: test-release-name
namespace: test-release-namespace
tests:
- it: should generate correct spec with backups (s3) (credentialsList)
set:
credentialsList:
- name: test
type: s3
accessKey: some-access-key
secretKey: some-secret-key
bucket: some-bucket
encrKey: some-encr-key
url: some-url
cnpg:
my-pg:
enabled: true
user: test-user
database: test-db
password: test-password
backups:
enabled: true
target: primary
retentionPolicy: 10d
credentials: test
destinationPath: some-path
asserts:
- documentIndex: &secretDoc 1
isKind:
of: Secret
- documentIndex: *secretDoc
isAPIVersion:
of: v1
- documentIndex: *secretDoc
equal:
path: metadata.name
value: test-release-name-common-test-cnpg-my-pg-provider-backup-s3-creds
- documentIndex: *secretDoc
equal:
path: stringData
value:
ACCESS_KEY_ID: some-access-key
ACCESS_SECRET_KEY: some-secret-key
- documentIndex: &clusterDoc 0
isKind:
of: Cluster
- documentIndex: *clusterDoc
isAPIVersion:
of: postgresql.cnpg.io/v1
- documentIndex: *clusterDoc
equal:
path: metadata.name
value: test-release-name-common-test-cnpg-my-pg
- documentIndex: *clusterDoc
isSubset:
path: spec
content:
backup:
retentionPolicy: 10d
target: primary
barmanObjectStore:
data:
compression: gzip
encryption: AES256
jobs: 2
destinationPath: some-path
endpointURL: some-url
s3Credentials:
accessKeyId:
key: ACCESS_KEY_ID
name: test-release-name-common-test-cnpg-my-pg-provider-backup-s3-creds
secretAccessKey:
key: ACCESS_SECRET_KEY
name: test-release-name-common-test-cnpg-my-pg-provider-backup-s3-creds
serverName: test-release-name-common-test-cnpg-my-pg
wal:
compression: gzip
encryption: AES256

- it: should generate correct spec with volsync (s3) (credentialsList)
set:
persistence:
destbackup:
enabled: true
type: pvc
mountPath: /backedup
volsync:
- name: mybackup1
type: restic
credentials: mys3
dest:
enabled: true
src:
enabled: false
credentialsList:
- name: 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: metadata.name
value: test-release-name-common-test-destbackup-volsync-mybackup1
- 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/destbackup-volsync-mybackup1
- documentIndex: &replicationDestDoc 1
isKind:
of: ReplicationDestination
- documentIndex: *replicationDestDoc
isAPIVersion:
of: volsync.backube/v1alpha1
- documentIndex: *replicationDestDoc
equal:
path: spec
value:
trigger:
manual: restore-once
restic:
repository: test-release-name-common-test-destbackup-volsync-mybackup1
copyMethod: Snapshot
capacity: 100Gi
accessModes:
- ReadWriteOnce
moverSecurityContext:
fsGroup: 568
runAsUser: 568
runAsGroup: 568

0 comments on commit 5292ef8

Please sign in to comment.