Skip to content

Commit fed3f43

Browse files
authored
fix flaky global rate limit test (#433)
* fix flaky global rate limit test Signed-off-by: Huabing (Robin) Zhao <[email protected]> * fix yaml lint Signed-off-by: Huabing (Robin) Zhao <[email protected]> --------- Signed-off-by: Huabing (Robin) Zhao <[email protected]>
1 parent 7b5d651 commit fed3f43

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

.github/mergify.yml

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
---
12
queue_rules:
23
- name: default
34
queue_conditions:

test/e2e/metaprotocol/metaprotocol_test.go

+15-2
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,20 @@ func TestGlobalRateLimit(t *testing.T) {
211211
log.Info("Waiting for rules to propagate ...")
212212
time.Sleep(1 * time.Minute)
213213
consumerPod, _ := util.GetPodName("metaprotocol", "app=dubbo-sample-consumer", "")
214+
214215
success := 0
216+
for {
217+
dubboResponse, _ := util.PodExec("metaprotocol", consumerPod, "dubbo-sample-consumer",
218+
"curl -s 127.0.0.1:9009/hello", false, "")
219+
response := "response from dubbo-sample-provider"
220+
log.Info(dubboResponse)
221+
if strings.Contains(dubboResponse, response) {
222+
success++
223+
break
224+
}
225+
time.Sleep(1 * time.Second)
226+
}
227+
215228
for i := 0; i < 10; i++ {
216229
dubboResponse, _ := util.PodExec("metaprotocol", consumerPod, "dubbo-sample-consumer",
217230
"curl -s 127.0.0.1:9009/hello", false, "")
@@ -222,8 +235,8 @@ func TestGlobalRateLimit(t *testing.T) {
222235
}
223236
}
224237

225-
if success != 2 {
226-
t.Errorf("global rate limit failed, want: %v got:%v ", 2, success)
238+
if success != 5 {
239+
t.Errorf("global rate limit failed, want: %v got:%v ", 5, success)
227240
} else {
228241
t.Logf("%v requests have been sent to server", success)
229242
}

test/e2e/metaprotocol/testdata/rate-limit-server/config.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,5 +24,5 @@ data:
2424
- key: method
2525
value: "sayHello"
2626
rate_limit:
27-
unit: minute
28-
requests_per_unit: 2
27+
unit: hour
28+
requests_per_unit: 5

0 commit comments

Comments
 (0)