-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
br: add option to test encryption for all br int tests #56434
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
1fa9521
try to fix aws tests, load balance br int tests
Tristan1900 b0c87ce
fix typo
Tristan1900 1a0203e
run encryption everywhere, disable aws tests
Tristan1900 1b192f2
skip compat tests
Tristan1900 8b42327
fix test
Tristan1900 b10ccfe
add debug log for br-pitr
Tristan1900 aeca72c
test local master key
Tristan1900 2c4622f
better version to check on files
Tristan1900 4f4571f
fix style
Tristan1900 835d8ea
fix style
Tristan1900 720b7db
another try
Tristan1900 de48d89
suppress link
Tristan1900 c18be90
address comments
Tristan1900 c4a502d
move around test to see if fails
Tristan1900 af6394d
don't move br_other, see if it still fails
Tristan1900 7c6cf33
revert back to original, no idea what's going on
Tristan1900 fcfa309
finally figure out what's going on...
Tristan1900 9d2dc50
forgot to revert
Tristan1900 28005d7
confirm fixed
Tristan1900 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
load("@io_bazel_rules_go//go:def.bzl", "go_binary", "go_library") | ||
|
||
go_library( | ||
name = "tests_lib", | ||
srcs = ["utils.go"], | ||
importpath = "github.com/pingcap/tidb/br/tests", | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"@com_github_klauspost_compress//zstd", | ||
"@com_github_spf13_cobra//:cobra", | ||
], | ||
) | ||
|
||
go_binary( | ||
name = "tests", | ||
embed = [":tests_lib"], | ||
visibility = ["//visibility:public"], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
#!/bin/sh | ||
|
||
# Copyright 2024 PingCAP, Inc. Licensed under Apache-2.0. | ||
|
||
set -eux | ||
|
||
main() { | ||
# Call the original run.sh script | ||
"$UTILS_DIR/run_br" "$@" $ENCRYPTION_ARGS | ||
|
||
# Check if encryption validation is enabled | ||
if [ "${ENABLE_ENCRYPTION_CHECK:-false}" != "true" ]; then | ||
echo "Encryption check is disabled. Skipping backup file encryption validation." | ||
exit 0 | ||
fi | ||
|
||
echo "Starting backup file encryption validation..." | ||
|
||
# Capture the output of the validation command | ||
output=$(bin/utils validateBackupFiles --command="$*" --encryption="$ENCRYPTION_ARGS") | ||
exit_code=$? | ||
|
||
if [ $exit_code -ne 0 ]; then | ||
echo "Validation failed. Exiting with status 1." | ||
exit 1 | ||
fi | ||
|
||
# Check if validation is needed | ||
# strings are from utils.go | ||
if echo "$output" | grep -q "No need to validate"; then | ||
echo "Validation not required. Skipping." | ||
exit 0 | ||
fi | ||
|
||
# Check for expected strings in the output | ||
if [ -n "$ENCRYPTION_ARGS" ]; then | ||
# strings are from utils.go | ||
if ! echo "$output" | grep -q "All files in .* are encrypted, as expected with encryption"; then | ||
echo "Error: Expected 'All files are encrypted' message not found in output with encryption" | ||
exit 1 | ||
fi | ||
else | ||
# strings are from utils.go | ||
if ! echo "$output" | grep -q "All files in .* are not encrypted, as expected without encryption"; then | ||
echo "Error: Expected 'All files are not encrypted' message not found in output without encryption" | ||
exit 1 | ||
fi | ||
fi | ||
|
||
echo "Validation completed successfully." | ||
} | ||
|
||
# Execute the main function | ||
main "$@" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Maybe remove this if it isn't needed.
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.
this is sort of a placeholder if we want to test the plaintext case, we can uncomment it and run the test. The entire tests will be run as needed, not by default for every commit per discussion with Brian, but I don't think it will hurt if we just enable encryption by default, let me know your thoughts.!
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.
Perhaps add some hints about when and hot to use it(Say,
# If you want to specify a plaintext data key, uncomment and modify this as you like.
? Or it looks pretty like temporary code during developing...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.
sounds good!