@@ -70,7 +70,7 @@ describe("load upstreams", function()
70
70
it (" invalid healthckecks.active.headers produces error" , function ()
71
71
local ok , errs = validate ({ healthchecks = { active = { headers = { 114514 } } } } )
72
72
assert .falsy (ok )
73
- assert .truthy (errs .healthchecks .active .http_path )
73
+ assert .truthy (errs .healthchecks .active .headers )
74
74
end )
75
75
76
76
it (" invalid healthckecks.active.http_path produces error" , function ()
@@ -276,11 +276,12 @@ describe("load upstreams", function()
276
276
local pos_integer = " value should be between 1 and 2147483648"
277
277
local zero_integer = " value should be between 0 and 255"
278
278
local status_code = " value should be between 100 and 999"
279
- local string = " expected a string"
280
- local empty_string = " vaule must be non-empty string"
281
279
local integer = " expected an integer"
282
280
local boolean = " expected a boolean"
283
281
local number = " expected a number"
282
+ local array = " expected an array"
283
+ local string = " expected a string"
284
+ local len_min_default = " length must be at least 1"
284
285
local invalid_host = " invalid value: "
285
286
local invalid_host_port = " must not have a port"
286
287
local invalid_ip = " must not be an IP"
@@ -291,7 +292,7 @@ describe("load upstreams", function()
291
292
{{ active = { concurrency = 0.5 }}, integer },
292
293
{{ active = { concurrency = 0 }}, pos_integer },
293
294
{{ active = { concurrency = - 10 }}, pos_integer },
294
- {{ active = { http_path = " " }}, " length must be at least 1 " },
295
+ {{ active = { http_path = " " }}, len_min_default },
295
296
{{ active = { http_path = " ovo" }}, " should start with: /" },
296
297
{{ active = { https_sni = " 127.0.0.1" , }}, invalid_ip },
297
298
{{ active = { https_sni = " 127.0.0.1:8080" , }}, invalid_ip },
@@ -306,13 +307,14 @@ describe("load upstreams", function()
306
307
{{ active = { https_sni = " hello-.example.com" , }}, invalid_host },
307
308
{{ active = { https_sni = " example.com:1234" , }}, invalid_host_port },
308
309
{{ active = { https_verify_certificate = " ovo" , }}, boolean },
309
- {{ active = { headers = 0 , }}, " expected an array" },
310
+ {{ active = { headers = 0 , }}, array },
311
+ {{ active = { headers = {}, }}, len_min_default },
310
312
{{ active = { headers = { 0 }, }}, string },
311
- {{ active = { headers = { " " }, }}, empty_string },
312
- {{ active = { headers = { 0 , " example" }, }}, string },
313
+ {{ active = { headers = { " " }, }}, len_min_default },
314
+ {{ active = { headers = { 123 , " example" }, }}, string },
313
315
{{ active = { healthy = { interval = - 1 }}}, seconds },
314
316
{{ active = { healthy = { interval = 1e + 42 }}}, seconds },
315
- {{ active = { healthy = { http_statuses = 404 }}}, " expected an array" },
317
+ {{ active = { healthy = { http_statuses = 404 }}}, array },
316
318
{{ active = { healthy = { http_statuses = { " ovo" }}}}, integer },
317
319
{{ active = { healthy = { http_statuses = { - 1 }}}}, status_code },
318
320
{{ active = { healthy = { http_statuses = { 99 }}}}, status_code },
@@ -328,7 +330,7 @@ describe("load upstreams", function()
328
330
{{ active = { healthy = { successes = 256 }}}, zero_integer },
329
331
{{ active = { unhealthy = { interval = - 1 }}}, seconds },
330
332
{{ active = { unhealthy = { interval = 1e + 42 }}}, seconds },
331
- {{ active = { unhealthy = { http_statuses = 404 }}}, " expected an array" },
333
+ {{ active = { unhealthy = { http_statuses = 404 }}}, array },
332
334
{{ active = { unhealthy = { http_statuses = { " ovo" }}}}, integer },
333
335
{{ active = { unhealthy = { http_statuses = { - 1 }}}}, status_code },
334
336
{{ active = { unhealthy = { http_statuses = { 99 }}}}, status_code },
@@ -344,15 +346,15 @@ describe("load upstreams", function()
344
346
{{ active = { unhealthy = { http_failures = 0.5 }}}, integer },
345
347
{{ active = { unhealthy = { http_failures = - 1 }}}, zero_integer },
346
348
{{ active = { unhealthy = { http_failures = 256 }}}, zero_integer },
347
- {{ passive = { healthy = { http_statuses = 404 }}}, " expected an array" },
349
+ {{ passive = { healthy = { http_statuses = 404 }}}, array },
348
350
{{ passive = { healthy = { http_statuses = { " ovo" }}}}, integer },
349
351
{{ passive = { healthy = { http_statuses = { - 1 }}}}, status_code },
350
352
{{ passive = { healthy = { http_statuses = { 99 }}}}, status_code },
351
353
{{ passive = { healthy = { http_statuses = { 1000 }}}}, status_code },
352
354
{{ passive = { healthy = { successes = 0.5 }}}, integer },
353
355
-- {{ passive = { healthy = { successes = 0 }}}, integer },
354
356
{{ passive = { healthy = { successes = - 1 }}}, zero_integer },
355
- {{ passive = { unhealthy = { http_statuses = 404 }}}, " expected an array" },
357
+ {{ passive = { unhealthy = { http_statuses = 404 }}}, array },
356
358
{{ passive = { unhealthy = { http_statuses = { " ovo" }}}}, integer },
357
359
{{ passive = { unhealthy = { http_statuses = { - 1 }}}}, status_code },
358
360
{{ passive = { unhealthy = { http_statuses = { 99 }}}}, status_code },
0 commit comments