Skip to content

Commit a3caf89

Browse files
committed
add test case
1 parent 410ae8e commit a3caf89

File tree

1 file changed

+21
-9
lines changed

1 file changed

+21
-9
lines changed

t/discovery/consul.t

Lines changed: 21 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -853,10 +853,22 @@ location /sleep {
853853
854854
855855
=== TEST 17: dynamic etcd update with consul discovery (metadata_match)
856-
--- yaml_config eval: $::yaml_config
857-
--- apisix_yaml
858-
# 保持初始为空,由 /add 动态创建
856+
--- yaml_config
857+
apisix:
858+
node_listen: 1984
859+
deployment:
860+
admin:
861+
admin_key: null
862+
discovery:
863+
consul:
864+
servers:
865+
- "http://127.0.0.1:8500"
859866
#END
867+
--- extra_init_by_lua
868+
local health_check = require("resty.etcd.health_check")
869+
health_check.get_target_status = function()
870+
return true
871+
end
860872
--- config
861873
location /v1/agent {
862874
proxy_pass http://127.0.0.1:8500;
@@ -927,16 +939,16 @@ location /sleep {
927939
--- pipelined_requests eval
928940
[
929941
# 1. 注册服务实例(四个版本)
930-
"PUT /v1/agent/service/register\n" . "{\"ID\":\"service-b1\",\"Name\":\"service-b\",\"Address\":\"127.0.0.1\",\"Port\":30611,\"Meta\":{\"version\":\"v1\"}}",
931-
"PUT /v1/agent/service/register\n" . "{\"ID\":\"service-b2\",\"Name\":\"service-b\",\"Address\":\"127.0.0.1\",\"Port\":30612,\"Meta\":{\"version\":\"v2\"}}",
932-
"PUT /v1/agent/service/register\n" . "{\"ID\":\"service-b3\",\"Name\":\"service-b\",\"Address\":\"127.0.0.1\",\"Port\":30613,\"Meta\":{\"version\":\"v3\"}}",
933-
"PUT /v1/agent/service/register\n" . "{\"ID\":\"service-b4\",\"Name\":\"service-b\",\"Address\":\"127.0.0.1\",\"Port\":30614,\"Meta\":{\"version\":\"v4\"}}",
942+
"PUT /v1/agent/service/register\n" . "{\"ID\":\"service-b1\",\"Name\":\"service-b\",\"Address\":\"127.0.0.1\",\"Port\":30511,\"Meta\":{\"version\":\"v1\"}}",
943+
"PUT /v1/agent/service/register\n" . "{\"ID\":\"service-b2\",\"Name\":\"service-b\",\"Address\":\"127.0.0.1\",\"Port\":30512,\"Meta\":{\"version\":\"v2\"}}",
944+
"PUT /v1/agent/service/register\n" . "{\"ID\":\"service-b3\",\"Name\":\"service-b\",\"Address\":\"127.0.0.1\",\"Port\":30513,\"Meta\":{\"version\":\"v3\"}}",
945+
"PUT /v1/agent/service/register\n" . "{\"ID\":\"service-b4\",\"Name\":\"service-b\",\"Address\":\"127.0.0.1\",\"Port\":30514,\"Meta\":{\"version\":\"v4\"}}",
934946
935947
"GET /sleep",
936948
937949
"GET /add",
938-
"GET /hello?first",
939-
"GET /hello?second",
950+
"GET /hello?run1",
951+
"GET /hello?run2",
940952
941953
"GET /update",
942954
"GET /hello?updated",

0 commit comments

Comments
 (0)