-
Notifications
You must be signed in to change notification settings - Fork 157
K8SPSMDB-1425: Add pitr-to-new-cluster e2e test #2070
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
pbm_binary=/opt/percona/pbm | ||
fi | ||
|
||
kubectl_bin exec ${cluster}-rs0-0 -c ${container} -- ${pbm_binary} config > ${tmp_dir}/pbm_config.yml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[shfmt] reported by reviewdog 🐶
kubectl_bin exec ${cluster}-rs0-0 -c ${container} -- ${pbm_binary} config > ${tmp_dir}/pbm_config.yml | |
kubectl_bin exec ${cluster}-rs0-0 -c ${container} -- ${pbm_binary} config >${tmp_dir}/pbm_config.yml |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds an end-to-end test for K8SPSMDB-1425, specifically testing Point-in-Time Recovery (PITR) to a new cluster. The test validates the ability to restore backups from a source cluster to a completely separate target cluster using both logical and physical backup types.
Key changes:
- Adds a new e2e test
pitr-to-new-cluster
that tests PITR functionality across different clusters - Updates test execution lists to include the new test in release, PR, and backup test suites
- Implements test scenarios for both logical and physical restore operations with PBM configuration validation
Reviewed Changes
Copilot reviewed 17 out of 17 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
e2e-tests/run-release.csv | Adds pitr-to-new-cluster test to release test suite |
e2e-tests/run-pr.csv | Adds pitr-to-new-cluster test to PR test suite |
e2e-tests/run-backups.csv | Adds pitr-to-new-cluster and other backup tests to backup test suite |
e2e-tests/pitr-to-new-cluster/run | Main test script implementing the PITR cross-cluster functionality |
e2e-tests/pitr-to-new-cluster/conf/* | Configuration files for source/target clusters and backup/restore operations |
e2e-tests/pitr-to-new-cluster/compare/* | Expected output files for test validation |
e2e-tests/functions | Updates echo statements to include '.OK' suffix for consistency |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 17 out of 17 changed files in this pull request and generated 2 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
if isResyncNeeded(currentCfg, &main) { | ||
log.Info("resync storage", "storage", mainStgName) | ||
log.V(1).Info("main storage changed", "old", currentCfg.Storage, "new", main.Storage) | ||
log.Info("main storage changed. starting resync", "old", currentCfg.Storage, "new", main.Storage) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The variable currentCfg
may be nil at this point since the code that ensures it's not nil was removed. This could cause a panic when accessing currentCfg.Storage
in the log message.
log.Info("main storage changed. starting resync", "old", currentCfg.Storage, "new", main.Storage) | |
var oldStorage interface{} | |
if currentCfg != nil { | |
oldStorage = currentCfg.Storage | |
} else { | |
oldStorage = nil | |
} | |
log.Info("main storage changed. starting resync", "old", oldStorage, "new", main.Storage) |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't make sense, nil config already handled on line 118
spec: | ||
clusterName: | ||
pitr: | ||
pitrType: latest |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The field pitrType
is being used here but the sed replacement pattern on line 62 of the test script suggests this should be type
. This inconsistency could cause the restore configuration to be malformed.
pitrType: latest | |
type: latest |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests are passing for me, leaving some minor comments
setup_target_cluster | ||
|
||
desc "Case 1: Logical restore" | ||
test_case_1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the function names, I would rather have the purpose than the number of the case we are evaluating. So test_pbm_config_logical
, test_pbm_config_physical
pitr_backup_restore
, or something like that.
sleep_with_log 3 "wait for data to be replicated" | ||
|
||
compare_mongo_cmd "find" "myApp:myPass@${target_cluster}-rs0.${namespace}" "-3rd" \ | ||
".svc.cluster.local" myApp test 'sort( { x: 1 } )' | ||
log "Data is ready for PiTR: OK" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we added retries for the find command, sleeping would be redundant, right?
CHANGE DESCRIPTION
Add e2e test for K8SPSMDB-1425.
Also I fix two problems that I encountered in e2e test:
CHECKLIST
Jira
Needs Doc
) and QA (Needs QA
)?Tests
compare/*-oc.yml
)?Config/Logging/Testability