Skip to content

Commit 6fa5f95

Browse files
authored
Reformat code style in circuitbreaker/slot_test.cc (#35)
1 parent 951f884 commit 6fa5f95

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

sentinel-core/circuitbreaker/slot_test.cc

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33

44
#include "sentinel-core/test/mock/statistic/node/mock.h"
55

6-
#include "sentinel-core/common/string_resource_wrapper.h"
7-
#include "sentinel-core/circuitbreaker/rule_manager.h"
86
#include "sentinel-core/circuitbreaker/rule.h"
7+
#include "sentinel-core/circuitbreaker/rule_manager.h"
98
#include "sentinel-core/circuitbreaker/slot.h"
9+
#include "sentinel-core/common/string_resource_wrapper.h"
1010

1111
using testing::_;
1212
using testing::InSequence;
@@ -38,7 +38,7 @@ TEST(CircuitBreakerSlotTest, CircuitBreakerErrorRatioTest) {
3838
std::make_shared<StringResourceWrapper>(resource_name, EntryType::OUT);
3939
auto entry = std::make_shared<Entry>(resource, context);
4040
entry->set_cur_node(node);
41-
41+
4242
auto entry_error = std::make_shared<Entry>(resource, context);
4343
entry_error->set_cur_node(node);
4444
entry_error->set_error("test_error");
@@ -50,7 +50,8 @@ TEST(CircuitBreakerSlotTest, CircuitBreakerErrorRatioTest) {
5050

5151
// Test breaker checking when no rule exists.
5252
for (int i = 0; i < 10; i++) {
53-
Entry_And_Exit(slot_checker, slot_complete, entry, resource, node, 1, 0, myParams);
53+
Entry_And_Exit(slot_checker, slot_complete, entry, resource, node, 1, 0,
54+
myParams);
5455
}
5556

5657
Rule rule{resource_name};
@@ -68,7 +69,8 @@ TEST(CircuitBreakerSlotTest, CircuitBreakerErrorRatioTest) {
6869

6970
// Test breaker checking when error entry happens.
7071
for (int i = 0; i < 10; i++) {
71-
Entry_And_Exit(slot_checker, slot_complete, entry_error, resource, node, 1, 0, myParams);
72+
Entry_And_Exit(slot_checker, slot_complete, entry_error, resource, node, 1,
73+
0, myParams);
7274
}
7375

7476
EXPECT_EQ(cbs[0]->CurrentState(), State::kOpen);
@@ -89,7 +91,7 @@ TEST(CircuitBreakerSlotTest, CircuitBreakerErrorRatioTest) {
8991
}
9092

9193
TEST(CircuitBreakerSlotTest, CircuitBreakerSlowRatioTest) {
92-
std::string resource_name{"test_resource"};
94+
std::string resource_name{"test_resource"};
9395
EntryContextSharedPtr context =
9496
std::make_shared<EntryContext>("test_context");
9597
Stat::NodeSharedPtr node = std::make_shared<Stat::MockNode>();
@@ -110,7 +112,8 @@ TEST(CircuitBreakerSlotTest, CircuitBreakerSlowRatioTest) {
110112

111113
// Test breaker checking when no rule exists.
112114
for (int i = 0; i < 10; i++) {
113-
Entry_And_Exit(slot_checker, slot_complete, entry, resource, node, 1, 0, myParams);
115+
Entry_And_Exit(slot_checker, slot_complete, entry, resource, node, 1, 0,
116+
myParams);
114117
}
115118

116119
Rule rule{resource_name};
@@ -129,7 +132,8 @@ TEST(CircuitBreakerSlotTest, CircuitBreakerSlowRatioTest) {
129132

130133
// Test breaker checking when slow entry happens.
131134
for (int i = 0; i < 10; i++) {
132-
Entry_And_Exit(slot_checker, slot_complete, entry_slow, resource, node, 1, 0, myParams);
135+
Entry_And_Exit(slot_checker, slot_complete, entry_slow, resource, node, 1,
136+
0, myParams);
133137
}
134138

135139
EXPECT_EQ(cbs[0]->CurrentState(), State::kOpen);
@@ -149,5 +153,5 @@ TEST(CircuitBreakerSlotTest, CircuitBreakerSlowRatioTest) {
149153
m.LoadRules({});
150154
}
151155

152-
}
153-
}
156+
} // namespace CircuitBreaker
157+
} // namespace Sentinel

0 commit comments

Comments
 (0)