Skip to content

Commit c8ae8df

Browse files
K8SPSMDB-1491 Add GCS native support to incremental backup tests (#2210)
* Split incremental backup tests and add GCS support to them * Fix log function --------- Co-authored-by: Viacheslav Sarzhan <slava.sarzhan@percona.com>
1 parent 4f8bf98 commit c8ae8df

File tree

85 files changed

+5894
-166
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

85 files changed

+5894
-166
lines changed

e2e-tests/demand-backup-incremental-sharded/compare/find.json renamed to e2e-tests/demand-backup-incremental-aws/compare/find.json

File renamed without changes.

e2e-tests/demand-backup-incremental/compare/statefulset_some-name-rs0_restore-oc.yml renamed to e2e-tests/demand-backup-incremental-aws/compare/statefulset_some-name-rs0_restore-oc.yml

File renamed without changes.

e2e-tests/demand-backup-incremental/compare/statefulset_some-name-rs0_restore.yml renamed to e2e-tests/demand-backup-incremental-aws/compare/statefulset_some-name-rs0_restore.yml

File renamed without changes.
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
apiVersion: psmdb.percona.com/v1
2+
kind: PerconaServerMongoDBBackup
3+
metadata:
4+
finalizers:
5+
- percona.com/delete-backup
6+
name:
7+
spec:
8+
type: incremental-base
9+
clusterName: some-name
10+
storageName:

e2e-tests/demand-backup-incremental-sharded/conf/restore.yml renamed to e2e-tests/demand-backup-incremental-aws/conf/restore.yml

File renamed without changes.

e2e-tests/demand-backup-incremental/conf/secrets.yml renamed to e2e-tests/demand-backup-incremental-aws/conf/secrets.yml

File renamed without changes.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
apiVersion: psmdb.percona.com/v1
2+
kind: PerconaServerMongoDB
3+
metadata:
4+
finalizers:
5+
- percona.com/delete-psmdb-pvc
6+
name: some-name
7+
spec:
8+
#platform: openshift
9+
image:
10+
imagePullPolicy: Always
11+
backup:
12+
enabled: true
13+
image:
14+
storages:
15+
aws-s3:
16+
type: s3
17+
s3:
18+
credentialsSecret: aws-s3-secret
19+
region: us-east-1
20+
bucket: operator-testing
21+
prefix: psmdb-demand-backup-incremental-aws
22+
insecureSkipTLSVerify: false
23+
replsets:
24+
- name: rs0
25+
affinity:
26+
antiAffinityTopologyKey: none
27+
resources:
28+
limits:
29+
cpu: 500m
30+
memory: 1G
31+
requests:
32+
cpu: 100m
33+
memory: 0.1G
34+
volumeSpec:
35+
persistentVolumeClaim:
36+
resources:
37+
requests:
38+
storage: 3Gi
39+
expose:
40+
enabled: false
41+
type: ClusterIP
42+
size: 3
43+
configuration: |
44+
operationProfiling:
45+
mode: slowOp
46+
slowOpThresholdMs: 100
47+
security:
48+
enableEncryption: true
49+
redactClientLogData: false
50+
setParameter:
51+
ttlMonitorSleepSecs: 60
52+
wiredTigerConcurrentReadTransactions: 128
53+
wiredTigerConcurrentWriteTransactions: 128
54+
storage:
55+
engine: wiredTiger
56+
wiredTiger:
57+
collectionConfig:
58+
blockCompressor: snappy
59+
engineConfig:
60+
directoryForIndexes: false
61+
journalCompressor: snappy
62+
indexConfig:
63+
prefixCompression: true
64+
secrets:
65+
users: some-users
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/bin/bash
2+
3+
set -o errexit
4+
5+
test_dir=$(realpath "$(dirname "$0")")
6+
. "${test_dir}/../functions"
7+
set_debug
8+
9+
if [ ! -z "$SKIP_BACKUPS_TO_AWS_GCP_AZURE" ]; then
10+
log "Skipping cloud backups"
11+
exit 0
12+
fi
13+
14+
create_infra "${namespace}"
15+
apply_s3_storage_secrets
16+
17+
desc 'Testing on not sharded cluster'
18+
19+
log "Creating PSMDB cluster"
20+
cluster="some-name"
21+
kubectl_bin apply -f "${test_dir}/conf/secrets.yml"
22+
apply_cluster "${test_dir}/conf/${cluster}.yml"
23+
kubectl_bin apply -f "${conf_dir}/client_with_tls.yml"
24+
25+
log "check if all pods started"
26+
wait_for_running ${cluster}-rs0 3
27+
wait_cluster_consistency ${cluster}
28+
29+
log 'writing test data'
30+
run_mongo \
31+
'db.createUser({user:"myApp",pwd:"myPass",roles:[{db:"myApp",role:"readWrite"}]})' \
32+
"userAdmin:userAdmin123456@${cluster}-rs0.${namespace}"
33+
sleep 1
34+
run_mongo \
35+
'use myApp\n db.test.insert({ x: 100500 })' \
36+
"myApp:myPass@${cluster}-rs0.${namespace}"
37+
sleep 5
38+
compare_mongo_cmd "find" "myApp:myPass@${cluster}-rs0-0.${cluster}-rs0.${namespace}"
39+
compare_mongo_cmd "find" "myApp:myPass@${cluster}-rs0-1.${cluster}-rs0.${namespace}"
40+
compare_mongo_cmd "find" "myApp:myPass@${cluster}-rs0-2.${cluster}-rs0.${namespace}"
41+
42+
log 'running backup'
43+
backup_name_aws="backup-aws-s3"
44+
run_backup aws-s3 ${backup_name_aws} incremental-base
45+
wait_backup "${backup_name_aws}"
46+
check_backup_in_storage ${backup_name_aws} s3 rs0
47+
48+
log "drop collection"
49+
run_mongo 'use myApp\n db.test.drop()' "myApp:myPass@${cluster}-rs0.${namespace}"
50+
log "check backup and restore -- $backup_name"
51+
52+
log 'running restore'
53+
run_restore "${backup_name_aws}"
54+
run_recovery_check "${backup_name_aws}"
55+
56+
desc 'test passed'
57+
58+
destroy "$namespace"

e2e-tests/demand-backup-incremental/compare/find.json renamed to e2e-tests/demand-backup-incremental-azure/compare/find.json

File renamed without changes.

0 commit comments

Comments
 (0)