You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: t/v3/health_check.t
+63Lines changed: 63 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -509,6 +509,7 @@ qr/update endpoint: http:\/\/127.0.0.1:42379 to unhealthy/
509
509
checked val as expect: abc
510
510
511
511
512
+
512
513
=== TEST 13: test if retry works for request_chunk
513
514
--- http_config eval: $::HttpConfig
514
515
--- config
@@ -564,3 +565,65 @@ qr/1:.*"created":true.*
564
565
2:.*"value":"abc".*
565
566
timeout/
566
567
--- timeout: 5
568
+
569
+
570
+
571
+
=== TEST 14: test retry failure could return correctly
572
+
--- http_config eval: $::HttpConfig
573
+
--- config
574
+
location /v3/auth/authenticate {
575
+
content_by_lua_block { -- mock normal authenticate response
576
+
ngx.print([[{
577
+
body = '{"header":{"cluster_id":"17237436991929493444","member_id":"9372538179322589801","revision":"40","raft_term":"633"},"token":"KicnFPYazDaiMHBG.74"}',
578
+
reason = "OK",
579
+
status = 200
580
+
}]])
581
+
}
582
+
}
583
+
584
+
location /v3/kv/put {
585
+
content_by_lua_block { -- mock abnormal put key response
586
+
ngx.status = 500
587
+
ngx.print([[{
588
+
body = '{"error":"etcdserver: request timed out","message":"etcdserver: request timed out","code":14}',
589
+
reason = "Service Unavailable",
590
+
status = 503,
591
+
}]])
592
+
ngx.say("this is my own error page content")
593
+
ngx.exit(500)
594
+
}
595
+
}
596
+
597
+
location /t {
598
+
content_by_lua_block {
599
+
local health_check, err = require "resty.etcd.health_check" .init({
600
+
shm_name = "etcd_cluster_health_check",
601
+
fail_timeout = 10,
602
+
max_fails = 3,
603
+
retry = true,
604
+
})
605
+
606
+
local etcd, err = require "resty.etcd" .new({
607
+
protocol = "v3",
608
+
http_host = {
609
+
"http://127.0.0.1:12379",
610
+
},
611
+
})
612
+
etcd.endpoints[1].full_prefix="http://127.0.0.1:1984/v3" -- replace the endpoint with mock
0 commit comments