-
Notifications
You must be signed in to change notification settings - Fork 5.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
br: add option to test encryption for all br int tests (#56434)
close #56433
- Loading branch information
1 parent
0f6bddd
commit 99080c8
Showing
15 changed files
with
394 additions
and
21 deletions.
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.