Skip to content

Commit

Permalink
use real upstream instead of upstream id
Browse files Browse the repository at this point in the history
  • Loading branch information
shreemaan-abhishek committed Sep 27, 2023
1 parent cb2e367 commit 1acc511
Showing 1 changed file with 12 additions and 21 deletions.
33 changes: 12 additions & 21 deletions t/plugin/traffic-split2.t
Original file line number Diff line number Diff line change
Expand Up @@ -809,32 +809,25 @@ failed to find upstream by id: invalid-id
local json = require("toolkit.json")
local t = require("lib.test_admin")
local code, body = t.test('/apisix/admin/upstreams/1',
ngx.HTTP_PUT,
[[{
"nodes": {
"127.0.0.1:1983": 1
},
"type": "roundrobin",
"desc": "port 1983 is served under https",
"scheme": "https"
}]]
)
if code >= 300 then
ngx.status = code
ngx.say(body)
end
local data = {
uri = "/hello",
plugins = {
["traffic-split"] = {
rules = {
{
match = { {
vars = { { "arg_scheme", "==", "https" } }
} },
weighted_upstreams = {
{
upstream_id = 1,
upstream = {
type = "roundrobin",
pass_host = "node",
nodes = {
["127.0.0.1:1983"] = 1,
},
scheme = "https"
},
weight = 1
}
}
Expand Down Expand Up @@ -867,7 +860,5 @@ passed
=== TEST 22: hit route
--- request
GET /hello
GET /hello?scheme=https
--- error_code: 200
--- response_body
hello world

0 comments on commit 1acc511

Please sign in to comment.