fix(性能测试): 查询 service 区分端口

This commit is contained in:
Captain.B 2021-04-16 17:09:26 +08:00 committed by 刘瑞斌
parent 1db9dadbfd
commit b95ce0a221
1 changed files with 5 additions and 3 deletions

View File

@ -80,7 +80,9 @@ public class CatalogApiController {
.body(JSON.parseArray("[]"));
}
String[] ipAndPort = service.split("-");
int i = service.lastIndexOf("-");
String address = service.substring(0, i);
String port = service.substring(i);
String result = "[\n" +
" {\n" +
" \"Node\": {\n" +
@ -106,9 +108,9 @@ public class CatalogApiController {
" \"Tags\": [\n" +
" \"test\"\n" +
" ],\n" +
" \"Address\": \"" + ipAndPort[0] + "\",\n" +
" \"Address\": \"" + address + "\",\n" +
" \"Meta\": null,\n" +
" \"Port\": " + ipAndPort[1] + ",\n" +
" \"Port\": " + port + ",\n" +
" \"Weights\": {\n" +
" \"Passing\": 1,\n" +
" \"Warning\": 1\n" +