Skip to content

Commit 30e7db5

Browse files
committed
Normalizing file names and extensions & Updates
- Updating naming and formatting - Normalizing testing naming - Added reasoning for not testing parameters with feature checker
1 parent a99d327 commit 30e7db5

File tree

5 files changed

+53
-50
lines changed

5 files changed

+53
-50
lines changed

bin/ghe-host-check

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,8 @@ if [[ "$CALLING_SCRIPT" == "ghe-backup" ]]; then
153153
. "$(dirname "${BASH_SOURCE[0]}")/../share/github-backup-utils/requirements.txt"
154154

155155
#source disk size file
156-
# shellcheck source=share/github-backup-utils/ghe-rsync-size.sh
157-
. "$(dirname "${BASH_SOURCE[0]}")/../share/github-backup-utils/ghe-rsync-size.sh"
156+
# shellcheck source=share/github-backup-utils/ghe-rsync-size
157+
. "$(dirname "${BASH_SOURCE[0]}")/../share/github-backup-utils/ghe-rsync-size"
158158

159159
#Display dir requirements for repositories and mysql
160160
echo "Checking host for sufficient space for a backup..." 1>&2

share/github-backup-utils/ghe-rsync

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ set -o pipefail
1111
# shellcheck source=share/github-backup-utils/ghe-backup-config
1212
. "$( dirname "${BASH_SOURCE[0]}" )/ghe-backup-config"
1313

14+
# Don't use the feature checker for expected parameters as it can cause issues with server paths
1415
# Check for --ignore-missing-args parameter support and remove if unavailable.
1516
if rsync -h | grep '\-\-ignore-missing-args' >/dev/null 2>&1; then
1617
parameters=("$@")
@@ -20,19 +21,21 @@ else
2021
done
2122
fi
2223

23-
# This prepends `--trust-sender` to the parameters if supported by the current version of rsync to mitigate the degradation of performance due to the resolution of CVE-2022-29154
24-
# shellcheck source=share/github-backup-utils/ghe-rsync-feature-checker.sh
24+
# This prepends `--trust-sender` to the parameters if supported by the current version of rsync
25+
# to mitigate the degradation of performance due to the resolution of CVE-2022-29154
26+
# shellcheck source=share/github-backup-utils/ghe-rsync-feature-checker
2527
# shellcheck disable=SC2046
26-
if [ "$($( dirname "${BASH_SOURCE[0]}" )/ghe-rsync-feature-checker.sh --trust-sender)" == "true" ]; then
28+
if [ "$($( dirname "${BASH_SOURCE[0]}" )/ghe-rsync-feature-checker --trust-sender)" == "true" ]; then
2729
parameters=("--trust-sender" "${parameters[@]}")
2830
fi
2931

30-
# This loads the $GHE_EXTRA_RSYNC_OPTS from the config file if available then adds them to the parameters and skip adding if already present in the parameters
31-
# shellcheck source=share/github-backup-utils/ghe-rsync-feature-checker.sh
32+
# This loads the $GHE_EXTRA_RSYNC_OPTS from the config file if available then adds them
33+
# to the parameters and skip adding if already present in the parameters
34+
# shellcheck source=share/github-backup-utils/ghe-rsync-feature-checker
3235
# shellcheck disable=SC2046
3336
if [ -n "$GHE_EXTRA_RSYNC_OPTS" ]; then
3437
for extra_opt in $GHE_EXTRA_RSYNC_OPTS; do
35-
if [ "$($( dirname "${BASH_SOURCE[0]}" )/ghe-rsync-feature-checker.sh "$extra_opt")" == "true" ]; then
38+
if [ "$($( dirname "${BASH_SOURCE[0]}" )/ghe-rsync-feature-checker "$extra_opt")" == "true" ]; then
3639
parameters+=("$extra_opt")
3740
fi
3841
done
Lines changed: 42 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
# ghe-rsync-feature-checker.sh command tests
2+
# ghe-rsync-feature-checker command tests
33

44
TESTS_DIR="$PWD/$(dirname "$0")"
55
# Bring in testlib.
@@ -8,121 +8,121 @@ TESTS_DIR="$PWD/$(dirname "$0")"
88

99
## testing for known supported command help with and without leading dashes
1010

11-
begin_test "ghe-rsync-feature-checker.sh for known supported command --help"
11+
begin_test "Testing ghe-rsync-feature-checker for known supported command --help"
1212
(
1313
set -e
1414

15-
# Test ghe-rsync-feature-checker.sh command
16-
ghe-rsync-feature-checker.sh --help | grep -q "true"
15+
# Test ghe-rsync-feature-checker command
16+
ghe-rsync-feature-checker --help | grep -q "true"
1717
)
1818
end_test
1919

20-
begin_test "ghe-rsync-feature-checker.sh for known supported command help"
20+
begin_test "Testing ghe-rsync-feature-checker with known supported command help"
2121
(
2222
set -e
2323

24-
# Test ghe-rsync-feature-checker.sh command
25-
ghe-rsync-feature-checker.sh help | grep -q "true"
24+
# Test ghe-rsync-feature-checker command
25+
ghe-rsync-feature-checker help | grep -q "true"
2626
)
2727
end_test
2828

29-
## testing for known unsupported command not-an-actual-feature with and without leading dashes
29+
## testing with known unsupported command not-an-actual-feature with and without leading dashes
3030

31-
begin_test "ghe-rsync-feature-checker.sh for known unsupported command --not-an-actual-feature"
31+
begin_test "Testing ghe-rsync-feature-checker with known unsupported command --not-an-actual-feature"
3232
(
3333
set -e
3434

35-
# Test ghe-rsync-feature-checker.sh command
36-
ghe-rsync-feature-checker.sh --not-an-actual-feature | grep -q "false"
35+
# Test ghe-rsync-feature-checker command
36+
ghe-rsync-feature-checker --not-an-actual-feature | grep -q "false"
3737

3838
)
3939
end_test
4040

41-
begin_test "ghe-rsync-feature-checker.sh for known unsupported command not-an-actual-feature"
41+
begin_test "Testing ghe-rsync-feature-checker with known unsupported command not-an-actual-feature"
4242
(
4343
set -e
4444

45-
# Test ghe-rsync-feature-checker.sh command
46-
ghe-rsync-feature-checker.sh not-an-actual-feature | grep -q "false"
45+
# Test ghe-rsync-feature-checker command
46+
ghe-rsync-feature-checker not-an-actual-feature | grep -q "false"
4747
)
4848
end_test
4949

50-
## testing for known supported command partial with and without leading dashes
50+
## testing with known supported command partial with and without leading dashes
5151

52-
begin_test "ghe-rsync-feature-checker.sh for known supported command --partial"
52+
begin_test "Testing ghe-rsync-feature-checker with known supported command --partial"
5353
(
5454
set -e
5555

56-
# Test ghe-rsync-feature-checker.sh command
57-
ghe-rsync-feature-checker.sh --partial | grep -q "true"
56+
# Test ghe-rsync-feature-checker command
57+
ghe-rsync-feature-checker --partial | grep -q "true"
5858
)
5959
end_test
6060

61-
begin_test "ghe-rsync-feature-checker.sh for known supported command partial"
61+
begin_test "Testing ghe-rsync-feature-checker with known supported command partial"
6262
(
6363
set -e
6464

65-
# Test ghe-rsync-feature-checker.sh command
66-
ghe-rsync-feature-checker.sh partial | grep -q "true"
65+
# Test ghe-rsync-feature-checker command
66+
ghe-rsync-feature-checker partial | grep -q "true"
6767
)
6868
end_test
6969

70-
## testing for known supported command -v with and without leading dashes
70+
## testing with known supported command -v with and without leading dashes
7171

72-
begin_test "ghe-rsync-feature-checker.sh for known supported command -v"
72+
begin_test "Testing ghe-rsync-feature-checker with known supported command -v"
7373
(
7474
set -e
7575

76-
# Test ghe-rsync-feature-checker.sh command
77-
ghe-rsync-feature-checker.sh -v | grep -q "true"
76+
# Test ghe-rsync-feature-checker command
77+
ghe-rsync-feature-checker -v | grep -q "true"
7878
)
7979
end_test
8080

81-
begin_test "ghe-rsync-feature-checker.sh for known supported command v"
81+
begin_test "Testing ghe-rsync-feature-checker with known supported command v"
8282
(
8383
set -e
8484

85-
# Test ghe-rsync-feature-checker.sh command
86-
ghe-rsync-feature-checker.sh v | grep -q "true"
85+
# Test ghe-rsync-feature-checker command
86+
ghe-rsync-feature-checker v | grep -q "true"
8787
)
8888
end_test
8989

90-
## testing for known supported command --verbose with and without leading dashes
90+
## testing with known supported command --verbose with and without leading dashes
9191

92-
begin_test "ghe-rsync-feature-checker.sh for known supported command --verbose"
92+
begin_test "Testing ghe-rsync-feature-checker with known supported command --verbose"
9393
(
9494
set -e
9595

96-
# Test ghe-rsync-feature-checker.sh command
97-
ghe-rsync-feature-checker.sh --verbose | grep -q "true"
96+
# Test ghe-rsync-feature-checker command
97+
ghe-rsync-feature-checker --verbose | grep -q "true"
9898
)
9999
end_test
100100

101-
begin_test "ghe-rsync-feature-checker.sh for known supported command verbose"
101+
begin_test "Testing ghe-rsync-feature-checker with known supported command verbose"
102102
(
103103
set -e
104104

105-
# Test ghe-rsync-feature-checker.sh command
106-
ghe-rsync-feature-checker.sh verbose | grep -q "true"
105+
# Test ghe-rsync-feature-checker command
106+
ghe-rsync-feature-checker verbose | grep -q "true"
107107
)
108108
end_test
109109

110-
## testing for known supported command ignore-missing-args with and without leading dashes
110+
## testing with known supported command ignore-missing-args with and without leading dashes
111111

112-
begin_test "ghe-rsync-feature-checker.sh for known supported command --ignore-missing-args"
112+
begin_test "Testing ghe-rsync-feature-checker with known supported command --ignore-missing-args"
113113
(
114114
set -e
115115

116-
# Test ghe-rsync-feature-checker.sh command
117-
ghe-rsync-feature-checker.sh "--ignore-missing-args" | grep -q "true"
116+
# Test ghe-rsync-feature-checker command
117+
ghe-rsync-feature-checker "--ignore-missing-args" | grep -q "true"
118118
)
119119
end_test
120120

121-
begin_test "ghe-rsync-feature-checker.sh for known supported command ignore-missing-args"
121+
begin_test "Testing ghe-rsync-feature-checker with known supported command ignore-missing-args"
122122
(
123123
set -e
124124

125-
# Test ghe-rsync-feature-checker.sh command
126-
ghe-rsync-feature-checker.sh "ignore-missing-args" | grep -q "true"
125+
# Test ghe-rsync-feature-checker command
126+
ghe-rsync-feature-checker "ignore-missing-args" | grep -q "true"
127127
)
128128
end_test

0 commit comments

Comments
 (0)