Skip to content

Commit 35da3d2

Browse files
authored
K8SPS-400: add failed backup test case (#1068)
1 parent 8793f3b commit 35da3d2

File tree

164 files changed

+1024
-317
lines changed

Some content is hidden

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

164 files changed

+1024
-317
lines changed

deploy/backup.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ spec:
1010
# sourcePod: ps-cluster1-mysql-1
1111
# containerOptions:
1212
# env:
13-
# - name: VERIFY_TLS
13+
# - name: CUSTOM_VAR
1414
# value: "false"
1515
# args:
1616
# xtrabackup:

deploy/cr.yaml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ spec:
5858
mysql:
5959
clusterType: group-replication
6060
autoRecovery: true
61-
image: perconalab/percona-server-mysql-operator:main-psmysql8.0
61+
image: perconalab/percona-server-mysql-operator:main-psmysql8.4
6262
imagePullPolicy: Always
6363
# runtimeClassName: image-rc
6464
# tolerations:
@@ -93,9 +93,9 @@ spec:
9393
# minAvailable: 0
9494
resources:
9595
requests:
96-
memory: 2G
96+
memory: 2Gi
9797
limits:
98-
memory: 4G
98+
memory: 4Gi
9999

100100
# readinessProbe:
101101
# initialDelaySeconds: 30
@@ -167,7 +167,7 @@ spec:
167167
# accessModes: [ "ReadWriteOnce" ]
168168
resources:
169169
requests:
170-
storage: 2G
170+
storage: 2Gi
171171
gracePeriod: 600
172172
# configuration: |
173173
# max_connections=250
@@ -198,7 +198,7 @@ spec:
198198
# spec:
199199
# resources:
200200
# requests:
201-
# storage: 1G
201+
# storage: 1Gi
202202
# containerSecurityContext:
203203
# privileged: true
204204
# podSecurityContext:
@@ -228,10 +228,10 @@ spec:
228228
# minAvailable: 0
229229
resources:
230230
requests:
231-
memory: 1G
231+
memory: 1Gi
232232
cpu: 600m
233233
# limits:
234-
# memory: 1G
234+
# memory: 1Gi
235235
# cpu: 700m
236236

237237
# env:
@@ -332,7 +332,7 @@ spec:
332332

333333
router:
334334
enabled: false
335-
image: perconalab/percona-server-mysql-operator:main-router8.0
335+
image: perconalab/percona-server-mysql-operator:main-router8.4
336336
imagePullPolicy: Always
337337
# runtimeClassName: image-rc
338338
# tolerations:
@@ -539,7 +539,7 @@ spec:
539539
backup:
540540
enabled: true
541541
# sourcePod: ps-cluster1-mysql-1
542-
image: perconalab/percona-server-mysql-operator:main-backup8.0
542+
image: perconalab/percona-server-mysql-operator:main-backup8.4
543543
# schedule:
544544
# - name: "sat-night-backup"
545545
# schedule: "0 0 * * 6"
@@ -585,7 +585,7 @@ spec:
585585
# backupWorker: 'True'
586586
# resources:
587587
# requests:
588-
# memory: 1G
588+
# memory: 1Gi
589589
# cpu: 600m
590590
# affinity:
591591
# nodeAffinity:
@@ -622,7 +622,7 @@ spec:
622622
# runtimeClassName: image-rc
623623
# containerOptions:
624624
# env:
625-
# - name: VERIFY_TLS
625+
# - name: CUSTOM_VAR
626626
# value: "false"
627627
# args:
628628
# xtrabackup:

deploy/restore.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ spec:
77
backupName: backup1
88
# containerOptions:
99
# env:
10-
# - name: VERIFY_TLS
10+
# - name: CUSTOM_VAR
1111
# value: "false"
1212
# args:
1313
# xtrabackup:

e2e-tests/functions

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
ROOT_REPO=${ROOT_REPO:-$(realpath ../../..)}
55
test_name=$(basename "$(pwd)")
66
source "${ROOT_REPO}/e2e-tests/vars.sh"
7+
sed=$(which gsed || which sed)
78

89
if oc get projects 2>/dev/null; then
910
OPENSHIFT=4
@@ -176,7 +177,7 @@ get_pmm_server_token() {
176177
-w "\n%{http_code}")
177178

178179
create_status_code=$(echo "$create_response" | tail -n1)
179-
create_json_response=$(echo "$create_response" | sed '$ d')
180+
create_json_response=$(echo "$create_response" | $sed '$ d')
180181

181182
if [[ $create_status_code -ne 201 ]]; then
182183
echo "Error: Failed to create PMM service account. HTTP Status: $create_status_code" >&2
@@ -200,7 +201,7 @@ get_pmm_server_token() {
200201
-w "\n%{http_code}")
201202

202203
token_status_code=$(echo "$token_response" | tail -n1)
203-
token_json_response=$(echo "$token_response" | sed '$ d')
204+
token_json_response=$(echo "$token_response" | $sed '$ d')
204205

205206
if [[ $token_status_code -ne 200 ]]; then
206207
echo "Error: Failed to create token. HTTP Status: $token_status_code" >&2
@@ -234,7 +235,7 @@ delete_pmm_server_token() {
234235
-w "\n%{http_code}")
235236

236237
service_accounts_status=$(echo "$service_accounts_response" | tail -n1)
237-
service_accounts_json=$(echo "$service_accounts_response" | sed '$ d')
238+
service_accounts_json=$(echo "$service_accounts_response" | $sed '$ d')
238239

239240
if [[ $service_accounts_status -ne 200 ]]; then
240241
echo "Error: Failed to fetch service accounts. HTTP Status: $service_accounts_status" >&2
@@ -256,7 +257,7 @@ delete_pmm_server_token() {
256257
-w "\n%{http_code}")
257258

258259
tokens_status=$(echo "$tokens_response" | tail -n1)
259-
tokens_json=$(echo "$tokens_response" | sed '$ d')
260+
tokens_json=$(echo "$tokens_response" | $sed '$ d')
260261

261262
if [[ $tokens_status -ne 200 ]]; then
262263
echo "Error: Failed to fetch tokens. HTTP Status: $tokens_status" >&2
@@ -533,17 +534,17 @@ deploy_vault() {
533534
fi
534535

535536
cat ${secret} \
536-
| sed -e "s/#token/$token/" \
537-
| sed -e "s/#vault_url/$protocol:\/\/$name.$name.svc.cluster.local:8200/" \
538-
| sed -e "s/#secret/secret/" >"${tmp_dir}/vault-secret.yaml"
537+
| $sed -e "s/#token/$token/" \
538+
| $sed -e "s/#vault_url/$protocol:\/\/$name.$name.svc.cluster.local:8200/" \
539+
| $sed -e "s/#secret/secret/" >"${tmp_dir}/vault-secret.yaml"
539540

540541
if [ $protocol == "https" ]; then
541-
sed -e 's/^/ /' ${tmp_dir}/vault.ca >${tmp_dir}/vault.new.ca
542-
sed -i "s/#vault_ca/vault_ca/" "${tmp_dir}/vault-secret.yaml"
543-
sed -i "/#certVal/r ${tmp_dir}/vault.new.ca" "${tmp_dir}/vault-secret.yaml"
544-
sed -i "/#certVal/d" "${tmp_dir}/vault-secret.yaml"
542+
$sed -e 's/^/ /' ${tmp_dir}/vault.ca >${tmp_dir}/vault.new.ca
543+
$sed -i "s/#vault_ca/vault_ca/" "${tmp_dir}/vault-secret.yaml"
544+
$sed -i "/#certVal/r ${tmp_dir}/vault.new.ca" "${tmp_dir}/vault-secret.yaml"
545+
$sed -i "/#certVal/d" "${tmp_dir}/vault-secret.yaml"
545546
else
546-
sed -i "/#vault_ca/d" "${tmp_dir}/vault-secret.yaml"
547+
$sed -i "/#vault_ca/d" "${tmp_dir}/vault-secret.yaml"
547548
fi
548549

549550
kubectl apply -n "${NAMESPACE}" -f ${tmp_dir}/vault-secret.yaml
@@ -613,7 +614,7 @@ run_mysql() {
613614

614615
kubectl -n "${NAMESPACE}" exec "${pod:-mysql-client}" -- \
615616
bash -c "printf '%s\n' \"${command}\" | mysql -sN $uri" 2>&1 \
616-
| sed -e 's/mysql: //' \
617+
| $sed -e 's/mysql: //' \
617618
| (grep -v 'Using a password on the command line interface can be insecure.' || :)
618619
}
619620

@@ -676,7 +677,7 @@ get_gr_status() {
676677
client_pod=$(get_client_pod)
677678

678679
kubectl -n "${NAMESPACE}" exec "${pod:-mysql-client}" -- mysqlsh --js --uri $uri --cluster --result-format json -- cluster status \
679-
| sed -e 's/mysql: //' \
680+
| $sed -e 's/mysql: //' \
680681
| (grep -v 'Using a password on the command line interface can be insecure.' || :)
681682
}
682683

@@ -776,7 +777,7 @@ get_qan20_values() {
776777
EOF
777778
)
778779

779-
run_curl -XPOST -d "'$(echo ${payload} | sed 's/\n//g')'" "-H 'Authorization: Bearer ${token}'" "https://${user_pass}@${endpoint}/v1/qan/metrics:getReport" \
780+
run_curl -XPOST -d "'$(echo ${payload} | $sed 's/\n//g')'" "-H 'Authorization: Bearer ${token}'" "https://${user_pass}@${endpoint}/v1/qan/metrics:getReport" \
780781
| jq '.rows[].fingerprint'
781782
}
782783

@@ -1069,7 +1070,7 @@ deploy_chaos_mesh() {
10691070
}
10701071

10711072
destroy_chaos_mesh() {
1072-
local chaos_mesh_ns=$(helm list --all-namespaces --filter chaos-mesh | tail -n1 | awk -F' ' '{print $2}' | sed 's/NAMESPACE//')
1073+
local chaos_mesh_ns=$(helm list --all-namespaces --filter chaos-mesh | tail -n1 | awk -F' ' '{print $2}' | $sed 's/NAMESPACE//')
10731074

10741075
if [ -n "${chaos_mesh_ns}" ]; then
10751076
helm uninstall --wait --timeout 60s chaos-mesh --namespace ${chaos_mesh_ns} || :
@@ -1252,7 +1253,7 @@ check_primary_chaos() {
12521253
| jq .defaultReplicaSet.topology[].status \
12531254
| grep ONLINE \
12541255
| wc -l \
1255-
| sed 's/ //g')
1256+
| $sed 's/ //g')
12561257

12571258
if [[ ${online_members} != 3 ]]; then
12581259
echo "expected 3 online members, got ${online_members}"
@@ -1285,7 +1286,7 @@ renew_certificate() {
12851286
deploy_cmctl() {
12861287
local service_account="cmctl"
12871288

1288-
sed -e "s/percona-server-mysql-operator/$service_account/g" "${DEPLOY_DIR}/rbac.yaml" \
1289+
$sed -e "s/percona-server-mysql-operator/$service_account/g" "${DEPLOY_DIR}/rbac.yaml" \
12891290
| yq '(select(.rules).rules[] | select(contains({"apiGroups": ["cert-manager.io"]}))).resources += "certificates/status"' \
12901291
| kubectl apply -n "${NAMESPACE}" -f -
12911292
kubectl apply -n "${NAMESPACE}" -f "${TESTS_CONFIG_DIR}/cmctl.yml"

e2e-tests/run-distro.csv

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
auto-config
22
config
33
config-router
4-
demand-backup
5-
gr-demand-backup
4+
demand-backup-minio
5+
demand-backup-cloud
6+
gr-demand-backup-minio
7+
gr-demand-backup-cloud
68
gr-demand-backup-haproxy
79
gr-finalizer
810
gr-haproxy

e2e-tests/run-minikube.csv

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
auto-config
22
config
33
config-router
4-
demand-backup
5-
gr-demand-backup
4+
demand-backup-minio
5+
demand-backup-cloud
6+
gr-demand-backup-minio
7+
gr-demand-backup-cloud
68
gr-demand-backup-haproxy
79
gr-haproxy
810
gr-init-deploy

e2e-tests/run-pr.csv

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ async-global-metadata
44
auto-config
55
config
66
config-router
7-
demand-backup
7+
demand-backup-minio
8+
demand-backup-cloud
89
async-data-at-rest-encryption
910
gr-global-metadata
1011
gr-data-at-rest-encryption
11-
gr-demand-backup
12+
gr-demand-backup-minio
13+
gr-demand-backup-cloud
1214
gr-demand-backup-haproxy
1315
gr-finalizer
1416
gr-haproxy

e2e-tests/run-release.csv

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ async-global-metadata
44
auto-config
55
config
66
config-router
7-
demand-backup
7+
demand-backup-minio
8+
demand-backup-cloud
89
async-data-at-rest-encryption
910
gr-global-metadata
1011
gr-data-at-rest-encryption
11-
gr-demand-backup
12+
gr-demand-backup-minio
13+
gr-demand-backup-cloud
1214
gr-demand-backup-haproxy
1315
gr-finalizer
1416
gr-haproxy

e2e-tests/tests/auto-config/01-assert.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,6 @@ metadata:
107107
data:
108108
my.cnf: |2-
109109
110-
innodb_buffer_pool_size=1996488704
111-
innodb_buffer_pool_chunk_size=249561088
112-
max_connections=317
110+
innodb_buffer_pool_size=2147483648
111+
innodb_buffer_pool_chunk_size=268435456
112+
max_connections=341

0 commit comments

Comments
 (0)