@@ -16,73 +16,27 @@ Describe "Pulsar Bookies Member Leave Bash Script Tests"
1616 }
1717 BeforeAll " init"
1818
19- Describe " format_bookie()"
20- It " formats bookie with force and deleteCookie"
21- bin/bookkeeper () {
22- if [ " $1 " = " shell" ] && [ " $2 " = " bookieformat" ] && [ " $3 " = " -nonInteractive" ] && [ " $4 " = " -force" ] && [ " $5 " = " -deleteCookie" ]; then
23- echo " Bookie formatted with force and deleteCookie"
24- return 0
25- fi
26- return 1
27- }
28-
29- When call format_bookie " true" " true"
30- The output should include " Formatting Bookie..."
31- The output should include " Bookie formatted with force and deleteCookie"
32- The status should be success
33- End
34-
35- It " formats bookie without force and deleteCookie"
36- bin/bookkeeper () {
37- if [ " $1 " = " shell" ] && [ " $2 " = " bookieformat" ] && [ " $3 " = " -nonInteractive" ]; then
38- echo " Bookie formatted"
39- return 0
40- fi
41- return 1
42- }
43-
44- When call format_bookie " false" " false"
45- The output should include " Formatting Bookie..."
46- The output should include " Bookie formatted"
47- The status should be success
48- End
49- End
50-
51- Describe " should_format_bookie()"
52- It " returns true when pod index is greater than or equal to replicas"
53- When call should_format_bookie " pod-3" " 2"
54- The status should be success
55- End
56-
57- It " returns false when pod index is less than replicas"
58- When call should_format_bookie " pod-1" " 2"
59- The status should be failure
60- End
61- End
19+ bin/bookkeeper () {
20+ return 0
21+ }
6222
6323 Describe " bookies_member_leave()"
64- setup () {
65- export CURRENT_POD_NAME=" pod-3"
66- export BOOKKEEPER_COMP_REPLICAS=" 2"
67- }
68-
6924 It " formats bookie when condition is met"
70- setup
71-
72- format_bookie () {
73- echo " format_bookie called with $1 $2 "
74- }
25+ export CURRENT_POD_NAME=" pod-3"
26+ export KB_LEAVE_MEMBER_POD_NAME=" pod-3"
7527
7628 When call bookies_member_leave
77- The output should include " format_bookie called with true true"
29+ The output should include " Formatting Bookie..."
30+ The output should include " Bookie formatted"
7831 End
7932
8033 It " skips formatting when condition is not met"
8134 export CURRENT_POD_NAME=" pod-1"
82- export BOOKKEEPER_COMP_REPLICAS= " 2"
35+ export KB_LEAVE_MEMBER_POD_NAME= " pod- 2"
8336
8437 When call bookies_member_leave
85- The output should include " Skipping Bookie formatting"
38+ The output should include " Member to leave is not current pod, skipping Bookie formatting"
39+ The status should be failure
8640 End
8741 End
8842End
0 commit comments