From 677991aebf94c28781c89fcb4713a970f8ae7c77 Mon Sep 17 00:00:00 2001 From: Vinicius Mignot Date: Fri, 24 Jun 2022 11:27:58 -0300 Subject: [PATCH] tests(with_resty-events) increased sleeps --- t/with_resty-events/03-get_target_status.t | 6 ++-- t/with_resty-events/04-report_success.t | 16 +++++------ t/with_resty-events/05-report_failure.t | 12 ++++---- t/with_resty-events/06-report_http_status.t | 28 +++++++++---------- t/with_resty-events/07-report_tcp_failure.t | 12 ++++---- t/with_resty-events/08-report_timeout.t | 12 ++++---- t/with_resty-events/12-set_target_status.t | 26 ++++++++--------- .../15-get_virtualhost_target_status.t | 20 ++++++------- .../16-set_all_target_statuses_for_hostname.t | 26 ++++++++--------- 9 files changed, 79 insertions(+), 79 deletions(-) diff --git a/t/with_resty-events/03-get_target_status.t b/t/with_resty-events/03-get_target_status.t index 6b8e795c..f85e7d3a 100644 --- a/t/with_resty-events/03-get_target_status.t +++ b/t/with_resty-events/03-get_target_status.t @@ -83,15 +83,15 @@ qq{ } }) local ok, err = checker:add_target("127.0.0.1", 2115, nil, true) - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2115)) -- true checker:report_tcp_failure("127.0.0.1", 2115) - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2115)) -- false checker:report_success("127.0.0.1", 2115) - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2115)) -- true } } diff --git a/t/with_resty-events/04-report_success.t b/t/with_resty-events/04-report_success.t index f60dee2e..06952980 100644 --- a/t/with_resty-events/04-report_success.t +++ b/t/with_resty-events/04-report_success.t @@ -87,14 +87,14 @@ events_module = "resty.events", }) local ok, err = checker:add_target("127.0.0.1", 2116, nil, false) local ok, err = checker:add_target("127.0.0.1", 2118, nil, false) - ngx.sleep(0.002) + ngx.sleep(0.01) checker:report_success("127.0.0.1", 2116, nil, "active") checker:report_success("127.0.0.1", 2118, nil, "passive") checker:report_success("127.0.0.1", 2116, nil, "active") checker:report_success("127.0.0.1", 2118, nil, "passive") checker:report_success("127.0.0.1", 2116, nil, "active") checker:report_success("127.0.0.1", 2118, nil, "passive") - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2116)) -- true ngx.say(checker:get_target_status("127.0.0.1", 2118)) -- true } @@ -162,14 +162,14 @@ events_module = "resty.events", }) local ok, err = checker:add_target("127.0.0.1", 2116, nil, false) local ok, err = checker:add_target("127.0.0.1", 2118, nil, false) - ngx.sleep(0.002) + ngx.sleep(0.01) checker:report_success("127.0.0.1", 2116, nil, "active") checker:report_success("127.0.0.1", 2118, nil, "passive") checker:report_success("127.0.0.1", 2116, nil, "active") checker:report_success("127.0.0.1", 2118, nil, "passive") checker:report_success("127.0.0.1", 2116, nil, "active") checker:report_success("127.0.0.1", 2118, nil, "passive") - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2116)) -- true ngx.say(checker:get_target_status("127.0.0.1", 2118)) -- true } @@ -235,11 +235,11 @@ events_module = "resty.events", } }) local ok, err = checker:add_target("127.0.0.1", 2116, nil, false) - ngx.sleep(0.002) + ngx.sleep(0.01) checker:report_success("127.0.0.1", 2116, nil, "active") checker:report_success("127.0.0.1", 2116, nil, "active") checker:report_success("127.0.0.1", 2116, nil, "active") - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2116)) -- false } } @@ -299,11 +299,11 @@ events_module = "resty.events", } }) local ok, err = checker:add_target("127.0.0.1", 2118, nil, false) - ngx.sleep(0.002) + ngx.sleep(0.01) checker:report_success("127.0.0.1", 2118, nil, "passive") checker:report_success("127.0.0.1", 2118, nil, "passive") checker:report_success("127.0.0.1", 2118, nil, "passive") - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2118, nil)) -- false } } diff --git a/t/with_resty-events/05-report_failure.t b/t/with_resty-events/05-report_failure.t index 9f50b217..229c20a0 100644 --- a/t/with_resty-events/05-report_failure.t +++ b/t/with_resty-events/05-report_failure.t @@ -87,14 +87,14 @@ qq{ }) local ok, err = checker:add_target("127.0.0.1", 2117, nil, true) local ok, err = checker:add_target("127.0.0.1", 2113, nil, true) - ngx.sleep(0.002) + ngx.sleep(0.01) checker:report_failure("127.0.0.1", 2117, nil, "active") checker:report_failure("127.0.0.1", 2113, nil, "passive") checker:report_failure("127.0.0.1", 2117, nil, "active") checker:report_failure("127.0.0.1", 2113, nil, "passive") checker:report_failure("127.0.0.1", 2117, nil, "active") checker:report_failure("127.0.0.1", 2113, nil, "passive") - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2117, nil)) -- false ngx.say(checker:get_target_status("127.0.0.1", 2113, nil)) -- false } @@ -162,14 +162,14 @@ qq{ }) local ok, err = checker:add_target("127.0.0.1", 2117, nil, true) local ok, err = checker:add_target("127.0.0.1", 2113, nil, true) - ngx.sleep(0.002) + ngx.sleep(0.01) checker:report_failure("127.0.0.1", 2117, nil, "active") checker:report_failure("127.0.0.1", 2113, nil, "passive") checker:report_failure("127.0.0.1", 2117, nil, "active") checker:report_failure("127.0.0.1", 2113, nil, "passive") checker:report_failure("127.0.0.1", 2117, nil, "active") checker:report_failure("127.0.0.1", 2113, nil, "passive") - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2117, nil)) -- false ngx.say(checker:get_target_status("127.0.0.1", 2113, nil)) -- false } @@ -235,14 +235,14 @@ qq{ }) local ok, err = checker:add_target("127.0.0.1", 2117, nil, true) local ok, err = checker:add_target("127.0.0.1", 2113, nil, true) - ngx.sleep(0.002) + ngx.sleep(0.01) checker:report_failure("127.0.0.1", 2117, nil, "active") checker:report_failure("127.0.0.1", 2113, nil, "passive") checker:report_failure("127.0.0.1", 2117, nil, "active") checker:report_failure("127.0.0.1", 2113, nil, "passive") checker:report_failure("127.0.0.1", 2117, nil, "active") checker:report_failure("127.0.0.1", 2113, nil, "passive") - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2117, nil)) -- true ngx.say(checker:get_target_status("127.0.0.1", 2113, nil)) -- true } diff --git a/t/with_resty-events/06-report_http_status.t b/t/with_resty-events/06-report_http_status.t index 2f134271..6686682b 100644 --- a/t/with_resty-events/06-report_http_status.t +++ b/t/with_resty-events/06-report_http_status.t @@ -87,14 +87,14 @@ events_module = "resty.events", }) local ok, err = checker:add_target("127.0.0.1", 2119, nil, true) local ok, err = checker:add_target("127.0.0.1", 2113, nil, true) - ngx.sleep(0.002) + ngx.sleep(0.01) checker:report_http_status("127.0.0.1", 2119, nil, 500, "active") checker:report_http_status("127.0.0.1", 2113, nil, 500, "passive") checker:report_http_status("127.0.0.1", 2119, nil, 500, "active") checker:report_http_status("127.0.0.1", 2113, nil, 500, "passive") checker:report_http_status("127.0.0.1", 2119, nil, 500, "active") checker:report_http_status("127.0.0.1", 2113, nil, 500, "passive") - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2119)) -- false ngx.say(checker:get_target_status("127.0.0.1", 2113)) -- false } @@ -163,7 +163,7 @@ events_module = "resty.events", }) local ok, err = checker:add_target("127.0.0.1", 2119, nil, false) local ok, err = checker:add_target("127.0.0.1", 2113, nil, false) - ngx.sleep(0.002) + ngx.sleep(0.01) checker:report_http_status("127.0.0.1", 2119, nil, 200, "active") checker:report_http_status("127.0.0.1", 2113, nil, 200, "passive") checker:report_http_status("127.0.0.1", 2119, nil, 200, "active") @@ -172,7 +172,7 @@ events_module = "resty.events", checker:report_http_status("127.0.0.1", 2113, nil, 200, "passive") checker:report_http_status("127.0.0.1", 2119, nil, 200, "active") checker:report_http_status("127.0.0.1", 2113, nil, 200, "passive") - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2119)) -- true ngx.say(checker:get_target_status("127.0.0.1", 2113)) -- true } @@ -241,12 +241,12 @@ events_module = "resty.events", } }) local ok, err = checker:add_target("127.0.0.1", 2119, nil, false) - ngx.sleep(0.002) + ngx.sleep(0.01) checker:report_http_status("127.0.0.1", 2119, nil, 200, "passive") checker:report_http_status("127.0.0.1", 2119, nil, 200, "passive") checker:report_http_status("127.0.0.1", 2119, nil, 200, "passive") checker:report_http_status("127.0.0.1", 2119, nil, 200, "passive") - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2119, nil)) -- false } } @@ -305,12 +305,12 @@ events_module = "resty.events", } }) local ok, err = checker:add_target("127.0.0.1", 2119, nil, false) - ngx.sleep(0.002) + ngx.sleep(0.01) checker:report_http_status("127.0.0.1", 2119, nil, 200, "active") checker:report_http_status("127.0.0.1", 2119, nil, 200, "active") checker:report_http_status("127.0.0.1", 2119, nil, 200, "active") checker:report_http_status("127.0.0.1", 2119, nil, 200, "active") - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2119, nil)) -- false } } @@ -369,12 +369,12 @@ events_module = "resty.events", } }) local ok, err = checker:add_target("127.0.0.1", 2119, nil, true) - ngx.sleep(0.002) + ngx.sleep(0.01) checker:report_http_status("127.0.0.1", 2119, nil, 500, "passive") checker:report_http_status("127.0.0.1", 2119, nil, 500, "passive") checker:report_http_status("127.0.0.1", 2119, nil, 500, "passive") checker:report_http_status("127.0.0.1", 2119, nil, 500, "passive") - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2119)) -- true } } @@ -433,12 +433,12 @@ events_module = "resty.events", } }) local ok, err = checker:add_target("127.0.0.1", 2119, nil, true) - ngx.sleep(0.002) + ngx.sleep(0.01) checker:report_http_status("127.0.0.1", 2119, nil, 500, "active") checker:report_http_status("127.0.0.1", 2119, nil, 500, "active") checker:report_http_status("127.0.0.1", 2119, nil, 500, "active") checker:report_http_status("127.0.0.1", 2119, nil, 500, "active") - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2119, nil)) -- true } } @@ -481,13 +481,13 @@ events_module = "resty.events", } }) local ok, err = checker:add_target("127.0.0.1", 2119, nil, true) - ngx.sleep(0.002) + ngx.sleep(0.01) checker:report_http_status("127.0.0.1", 2119, nil, 500, "passive") checker:report_http_status("127.0.0.1", 2119, nil, 500, "passive") checker:report_http_status("127.0.0.1", 2119, nil, 500, "passive") checker:report_http_status("127.0.0.1", 2119, nil, 500, "passive") checker:report_http_status("127.0.0.1", 2119, nil, 500, "passive") - ngx.sleep(0.002) + ngx.sleep(0.01) checker:report_http_status("127.0.0.1", 2119, nil, 500, "passive") } } diff --git a/t/with_resty-events/07-report_tcp_failure.t b/t/with_resty-events/07-report_tcp_failure.t index 468eede9..f6dd4898 100644 --- a/t/with_resty-events/07-report_tcp_failure.t +++ b/t/with_resty-events/07-report_tcp_failure.t @@ -87,14 +87,14 @@ events_module = "resty.events", }) local ok, err = checker:add_target("127.0.0.1", 2120, nil, true) local ok, err = checker:add_target("127.0.0.1", 2113, nil, true) - ngx.sleep(0.002) + ngx.sleep(0.01) checker:report_tcp_failure("127.0.0.1", 2120, nil, nil, "active") checker:report_tcp_failure("127.0.0.1", 2113, nil, nil, "passive") checker:report_tcp_failure("127.0.0.1", 2120, nil, nil, "active") checker:report_tcp_failure("127.0.0.1", 2113, nil, nil, "passive") checker:report_tcp_failure("127.0.0.1", 2120, nil, nil, "active") checker:report_tcp_failure("127.0.0.1", 2113, nil, nil, "passive") - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2120)) -- false ngx.say(checker:get_target_status("127.0.0.1", 2113)) -- false } @@ -161,11 +161,11 @@ events_module = "resty.events", } }) local ok, err = checker:add_target("127.0.0.1", 2120, nil, true) - ngx.sleep(0.002) + ngx.sleep(0.01) checker:report_tcp_failure("127.0.0.1", 2120, nil, nil, "active") checker:report_tcp_failure("127.0.0.1", 2120, nil, nil, "active") checker:report_tcp_failure("127.0.0.1", 2120, nil, nil, "active") - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2120)) -- true } } @@ -225,11 +225,11 @@ events_module = "resty.events", } }) local ok, err = checker:add_target("127.0.0.1", 2120, nil, true) - ngx.sleep(0.002) + ngx.sleep(0.01) checker:report_tcp_failure("127.0.0.1", 2120, nil, nil, "passive") checker:report_tcp_failure("127.0.0.1", 2120, nil, nil, "passive") checker:report_tcp_failure("127.0.0.1", 2120, nil, nil, "passive") - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2120)) -- true } } diff --git a/t/with_resty-events/08-report_timeout.t b/t/with_resty-events/08-report_timeout.t index 84966f3e..b418baa5 100644 --- a/t/with_resty-events/08-report_timeout.t +++ b/t/with_resty-events/08-report_timeout.t @@ -89,12 +89,12 @@ events_module = "resty.events", }) local ok, err = checker:add_target("127.0.0.1", 2122, nil, true) local ok, err = checker:add_target("127.0.0.1", 2113, nil, true) - ngx.sleep(0.002) + ngx.sleep(0.01) checker:report_timeout("127.0.0.1", 2122, nil, "active") checker:report_timeout("127.0.0.1", 2113, nil, "passive") checker:report_timeout("127.0.0.1", 2122, nil, "active") checker:report_timeout("127.0.0.1", 2113, nil, "passive") - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2122)) -- false ngx.say(checker:get_target_status("127.0.0.1", 2113)) -- false } @@ -161,11 +161,11 @@ events_module = "resty.events", } }) local ok, err = checker:add_target("127.0.0.1", 2122, nil, true) - ngx.sleep(0.002) + ngx.sleep(0.01) checker:report_timeout("127.0.0.1", 2122, nil, "active") checker:report_timeout("127.0.0.1", 2122, nil, "active") checker:report_timeout("127.0.0.1", 2122, nil, "active") - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2122)) -- true } } @@ -227,11 +227,11 @@ events_module = "resty.events", } }) local ok, err = checker:add_target("127.0.0.1", 2122, nil, true) - ngx.sleep(0.002) + ngx.sleep(0.01) checker:report_timeout("127.0.0.1", 2122, nil, "passive") checker:report_timeout("127.0.0.1", 2122, nil, "passive") checker:report_timeout("127.0.0.1", 2122, nil, "passive") - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2122)) -- true } } diff --git a/t/with_resty-events/12-set_target_status.t b/t/with_resty-events/12-set_target_status.t index f725b278..9576f7d0 100644 --- a/t/with_resty-events/12-set_target_status.t +++ b/t/with_resty-events/12-set_target_status.t @@ -53,13 +53,13 @@ qq{ events_module = "resty.events", }) local ok, err = checker:add_target("127.0.0.1", 2112, nil, true) - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2112)) -- true checker:set_target_status("127.0.0.1", 2112, nil, false) - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2112)) -- false checker:set_target_status("127.0.0.1", 2112, nil, true) - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2112)) -- true } } @@ -94,14 +94,14 @@ events_module = "resty.events", } }) local ok, err = checker:add_target("127.0.0.1", 2112, nil, true) - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2112)) -- true checker:report_http_status("127.0.0.1", 2112, nil, 500) checker:report_http_status("127.0.0.1", 2112, nil, 500) - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2112)) -- false checker:set_target_status("127.0.0.1", 2112, nil, true) - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2112)) -- true } } @@ -139,15 +139,15 @@ events_module = "resty.events", } }) local ok, err = checker:add_target("127.0.0.1", 2112, nil, true) - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2112)) -- true checker:report_http_status("127.0.0.1", 2112, nil, 500) checker:set_target_status("127.0.0.1", 2112, nil, true) checker:report_http_status("127.0.0.1", 2112, nil, 500) - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2112)) -- true checker:report_http_status("127.0.0.1", 2112, nil, 500) - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2112)) -- false } } @@ -185,17 +185,17 @@ qq{ } }) local ok, err = checker:add_target("127.0.0.1", 2112, nil, true) - ngx.sleep(0.002) + ngx.sleep(0.01) checker:set_target_status("127.0.0.1", 2112, nil, false) - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2112)) -- false checker:report_http_status("127.0.0.1", 2112, nil, 200) checker:set_target_status("127.0.0.1", 2112, nil, false) checker:report_http_status("127.0.0.1", 2112, nil, 200) - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2112)) -- false checker:report_http_status("127.0.0.1", 2112, nil, 200) - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2112)) -- true } } diff --git a/t/with_resty-events/15-get_virtualhost_target_status.t b/t/with_resty-events/15-get_virtualhost_target_status.t index 4dc0e332..2921a397 100644 --- a/t/with_resty-events/15-get_virtualhost_target_status.t +++ b/t/with_resty-events/15-get_virtualhost_target_status.t @@ -77,20 +77,20 @@ events_module = "resty.events", }) local ok, err = checker:add_target("127.0.0.1", 2115, "ahostname", true) local ok, err = checker:add_target("127.0.0.1", 2115, "otherhostname", true) - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2115, "ahostname")) -- true ngx.say(checker:get_target_status("127.0.0.1", 2115, "otherhostname")) -- true checker:report_http_status("127.0.0.1", 2115, "otherhostname", 500, "passive") - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2115, "otherhostname")) -- true checker:report_http_status("127.0.0.1", 2115, "otherhostname", 500, "passive") - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2115, "otherhostname")) -- false checker:report_success("127.0.0.1", 2115, "otherhostname") - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2115, "otherhostname")) -- true checker:report_tcp_failure("127.0.0.1", 2115, "otherhostname") - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2115, "otherhostname")) -- false ngx.say(checker:get_target_status("127.0.0.1", 2115, "ahostname")) -- true local _, err = checker:get_target_status("127.0.0.1", 2115) @@ -154,11 +154,11 @@ events_module = "resty.events", }) local ok, err = checker:add_target("127.0.0.1", 2116, "ahostname", true) local ok, err = checker:add_target("127.0.0.1", 2116, nil, true) - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2116, "ahostname")) -- true ngx.say(checker:get_target_status("127.0.0.1", 2116)) -- true checker:report_http_status("127.0.0.1", 2116, nil, 500, "passive") - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2116, "ahostname")) -- true ngx.say(checker:get_target_status("127.0.0.1", 2116)) -- false } @@ -281,19 +281,19 @@ events_module = "resty.events", }) local ok, err = checker:add_target("127.0.0.1", 2118, "127.0.0.1", true) local ok, err = checker:add_target("127.0.0.1", 2119, nil, true) - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2118, "127.0.0.1")) -- true ngx.say(checker:get_target_status("127.0.0.1", 2119)) -- true ngx.say(checker:get_target_status("127.0.0.1", 2118)) -- true ngx.say(checker:get_target_status("127.0.0.1", 2119, "127.0.0.1")) -- true checker:report_http_status("127.0.0.1", 2118, nil, 500, "passive") - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2118, "127.0.0.1")) -- false ngx.say(checker:get_target_status("127.0.0.1", 2119)) -- true ngx.say(checker:get_target_status("127.0.0.1", 2118)) -- false ngx.say(checker:get_target_status("127.0.0.1", 2119, "127.0.0.1")) -- true checker:report_http_status("127.0.0.1", 2119, "127.0.0.1", 500, "passive") - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2118, "127.0.0.1")) -- false ngx.say(checker:get_target_status("127.0.0.1", 2119)) -- false ngx.say(checker:get_target_status("127.0.0.1", 2118)) -- false diff --git a/t/with_resty-events/16-set_all_target_statuses_for_hostname.t b/t/with_resty-events/16-set_all_target_statuses_for_hostname.t index d627a9c6..1385e611 100644 --- a/t/with_resty-events/16-set_all_target_statuses_for_hostname.t +++ b/t/with_resty-events/16-set_all_target_statuses_for_hostname.t @@ -54,15 +54,15 @@ events_module = "resty.events", }) checker:add_target("127.0.0.1", 2112, "rush", true) checker:add_target("127.0.0.2", 2112, "rush", true) - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2112, "rush")) -- true ngx.say(checker:get_target_status("127.0.0.2", 2112, "rush")) -- true checker:set_all_target_statuses_for_hostname("rush", 2112, false) - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2112, "rush")) -- false ngx.say(checker:get_target_status("127.0.0.2", 2112, "rush")) -- false checker:set_all_target_statuses_for_hostname("rush", 2112, true) - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2112, "rush")) -- true ngx.say(checker:get_target_status("127.0.0.2", 2112, "rush")) -- true } @@ -102,15 +102,15 @@ events_module = "resty.events", }) checker:add_target("127.0.0.1", 2112, "rush", true) checker:add_target("127.0.0.2", 2112, "rush", true) - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2112, "rush")) -- true ngx.say(checker:get_target_status("127.0.0.2", 2112, "rush")) -- true checker:report_http_status("127.0.0.1", 2112, "rush", 500) checker:report_http_status("127.0.0.1", 2112, "rush", 500) - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2112, "rush")) -- false checker:set_all_target_statuses_for_hostname("rush", 2112, true) - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2112, "rush")) -- true ngx.say(checker:get_target_status("127.0.0.2", 2112, "rush")) -- true } @@ -152,17 +152,17 @@ events_module = "resty.events", }) checker:add_target("127.0.0.1", 2112, "rush", true) checker:add_target("127.0.0.2", 2112, "rush", true) - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2112, "rush")) -- true ngx.say(checker:get_target_status("127.0.0.2", 2112, "rush")) -- true checker:report_http_status("127.0.0.1", 2112, "rush", 500) checker:set_all_target_statuses_for_hostname("rush", 2112, true) checker:report_http_status("127.0.0.1", 2112, "rush", 500) - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2112, "rush")) -- true ngx.say(checker:get_target_status("127.0.0.2", 2112, "rush")) -- true checker:report_http_status("127.0.0.1", 2112, "rush", 500) - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2112, "rush")) -- false ngx.say(checker:get_target_status("127.0.0.2", 2112, "rush")) -- true } @@ -205,19 +205,19 @@ qq{ }) checker:add_target("127.0.0.1", 2112, "rush", true) checker:add_target("127.0.0.2", 2112, "rush", true) - ngx.sleep(0.002) + ngx.sleep(0.01) checker:set_all_target_statuses_for_hostname("rush", 2112, false) - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2112, "rush")) -- false ngx.say(checker:get_target_status("127.0.0.2", 2112, "rush")) -- false checker:report_http_status("127.0.0.1", 2112, "rush", 200) checker:set_all_target_statuses_for_hostname("rush", 2112, false) checker:report_http_status("127.0.0.1", 2112, "rush", 200) - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2112, "rush")) -- false ngx.say(checker:get_target_status("127.0.0.2", 2112, "rush")) -- false checker:report_http_status("127.0.0.1", 2112, "rush", 200) - ngx.sleep(0.002) + ngx.sleep(0.01) ngx.say(checker:get_target_status("127.0.0.1", 2112, "rush")) -- true ngx.say(checker:get_target_status("127.0.0.2", 2112, "rush")) -- false }