Skip to content

Commit f9c353d

Browse files
ADD-SPgithub-actions[bot]
authored andcommitted
tests(correlation-id): fix flaky test (#14176)
KAG-6207 (cherry picked from commit dbc9e8a)
1 parent e38c06b commit f9c353d

1 file changed

Lines changed: 15 additions & 12 deletions

File tree

spec/03-plugins/11-correlation-id/02-schema_spec.lua

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,9 @@ describe("Plugin: correlation-id (schema) #a [#" .. strategy .."]", function()
102102
},
103103
}
104104
local sql = render([[
105-
UPDATE plugins SET route_id='$(ROUTE_ID)',
106-
protocols=ARRAY['grpc','grpcs','http','https'],
107-
cache_key='$(CACHE_KEY)'
105+
UPDATE plugins SET route_id='$(ROUTE_ID)',
106+
protocols=ARRAY['grpc','grpcs','http','https'],
107+
cache_key='$(CACHE_KEY)'
108108
WHERE id='$(ID)';
109109
COMMIT;
110110
]], {
@@ -174,16 +174,19 @@ describe("Plugin: correlation-id (schema) #a [#" .. strategy .."]", function()
174174
assert.equals("uuid#counter", res.config.generator)
175175

176176
local proxy_client = helpers.proxy_client(20000, 9002, "127.0.0.1")
177-
res = assert(proxy_client:send {
178-
method = "GET",
179-
path = "/",
180-
headers = {
181-
["Host"] = "example.com",
182-
}
183-
})
184-
assert.res_status(200, res)
185-
assert.is_not_nil(res.headers["Kong-Request-ID"])
177+
helpers.pwait_until(function()
178+
res = assert(proxy_client:send {
179+
method = "GET",
180+
path = "/",
181+
headers = {
182+
["Host"] = "example.com",
183+
}
184+
})
185+
assert.res_status(200, res)
186+
assert.is_not_nil(res.headers["Kong-Request-ID"])
187+
end, 10)
186188
proxy_client:close()
189+
187190
end)
188191
end)
189192
end -- for inc_sync

0 commit comments

Comments
 (0)