Skip to content

Commit

Permalink
modify changelog, replace the wait loop with ngx.sleep() and append i…
Browse files Browse the repository at this point in the history
…t to the first test case
  • Loading branch information
liverpool8056 committed Jan 6, 2023
1 parent 4724fe1 commit bf0d789
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 21 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@
[#9877](https://github.com/Kong/kong/pull/9877)
- **JWT**: Deny requests that have different tokens in the jwt token search locations. Thanks Jackson 'Che-Chun' Kuo from Latacora for reporting this issue.
[#9946](https://github.com/Kong/kong/pull/9946)
- **Statsd**: Fix a bug that the batch queue in statsd can't get the right result when processing batch entries produced by this plugin.
- **Statsd**: Fix a bug in the StatsD plugin batch queue processing where metrics are published multiple times.
[#10052](https://github.com/Kong/kong/pull/10052)

### Dependencies
Expand Down
30 changes: 10 additions & 20 deletions spec/03-plugins/06-statsd/01-log_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,15 @@ for _, strategy in helpers.each_strategy() do
},
}

bp.key_auth_plugins:insert { route = { id = routes[31].id } }
bp.statsd_plugins:insert {
route = { id = routes[31].id },
config = {
host = "127.0.0.1",
port = UDP_PORT,
},
}

for i = 100, 103 do
local service = bp.services:insert {
protocol = helpers.mock_upstream_protocol,
Expand Down Expand Up @@ -637,15 +646,6 @@ for _, strategy in helpers.each_strategy() do
},
}

bp.key_auth_plugins:insert { route = { id = routes[31].id } }
bp.statsd_plugins:insert {
route = { id = routes[31].id },
config = {
host = "127.0.0.1",
port = UDP_PORT,
},
}

assert(helpers.start_kong({
database = strategy,
nginx_conf = "spec/fixtures/custom_nginx.template",
Expand Down Expand Up @@ -683,17 +683,7 @@ for _, strategy in helpers.each_strategy() do
local ok, metrics, err = thread:join()
assert(ok, metrics)
assert(#metrics == metrics_count, err)
end)

-- wait until shdict metrics could be sent again
-- so that next test case can pass
it("wait until shdict metrics could be sent again", function()
local t1 = ngx.now()
repeat
ngx.sleep(10)
ngx.update_time()
local t2 = ngx.now() - t1
until t2 > DEFAULT_SHDICT_METRICS_SEND_THRESHOLD + 1
ngx.sleep(DEFAULT_SHDICT_METRICS_SEND_THRESHOLD + 1)
end)

it("logs over UDP with default metrics", function()
Expand Down

0 comments on commit bf0d789

Please sign in to comment.