From 5292ef8eb03ad3a0b3ac837721a01169dcadde59 Mon Sep 17 00:00:00 2001 From: Stavros kois Date: Sun, 19 May 2024 15:43:01 +0300 Subject: [PATCH] add credentials list test --- .../tests/lists/credentialsList_test.yaml | 146 ++++++++++++++++++ 1 file changed, 146 insertions(+) create mode 100644 library/common-test/tests/lists/credentialsList_test.yaml diff --git a/library/common-test/tests/lists/credentialsList_test.yaml b/library/common-test/tests/lists/credentialsList_test.yaml new file mode 100644 index 000000000..3728d3d9f --- /dev/null +++ b/library/common-test/tests/lists/credentialsList_test.yaml @@ -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