Skip to content

Commit

Permalink
tests(with_resty-events) increased sleeps
Browse files Browse the repository at this point in the history
  • Loading branch information
locao committed Jun 24, 2022
1 parent 78ead9e commit 677991a
Show file tree
Hide file tree
Showing 9 changed files with 79 additions and 79 deletions.
6 changes: 3 additions & 3 deletions t/with_resty-events/03-get_target_status.t
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down
16 changes: 8 additions & 8 deletions t/with_resty-events/04-report_success.t
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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
}
}
Expand Down
12 changes: 6 additions & 6 deletions t/with_resty-events/05-report_failure.t
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
Expand Down
28 changes: 14 additions & 14 deletions t/with_resty-events/06-report_http_status.t
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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")
Expand All @@ -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
}
Expand Down Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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")
}
}
Expand Down
12 changes: 6 additions & 6 deletions t/with_resty-events/07-report_tcp_failure.t
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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
}
}
Expand Down
12 changes: 6 additions & 6 deletions t/with_resty-events/08-report_timeout.t
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
}
}
Expand Down Expand Up @@ -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
}
}
Expand Down
Loading

0 comments on commit 677991a

Please sign in to comment.