janiussyafiq commented on code in PR #13065:
URL: https://github.com/apache/apisix/pull/13065#discussion_r2890949820
##########
t/admin/routes-array-nodes.t:
##########
@@ -113,3 +113,60 @@ passed
GET /t
--- response_body
passed
+
+
+
+=== TEST 3: PATCH route from array nodes to hash table nodes
+--- config
+ location /t {
+ content_by_lua_block {
+ local t = require("lib.test_admin").test
+
+ local code, body = t('/apisix/admin/routes/1',
+ ngx.HTTP_PUT,
+ [[{
+ "uri": "/index.html",
+ "upstream": {
+ "nodes": [{
+ "host": "127.0.0.1",
+ "port": 8080,
+ "weight": 1
+ }],
+ "type": "roundrobin"
+ }
+ }]]
+ )
+
+ code, body = t('/apisix/admin/routes/1',
+ ngx.HTTP_PATCH,
+ [[{
+ "upstream": {
+ "nodes": {
+ "127.0.0.1:9200": 1
+ }
+ }
+ }]]
+ )
+
+ code, body = t('/apisix/admin/routes/1',
+ ngx.HTTP_PATCH,
+ [[{
+ "upstream": {
+ "nodes": [{
+ "host": "127.0.0.1",
+ "port": 8080,
+ "weight": 1
+ }],
+ "type": "roundrobin"
+ }
+ }]]
+ )
+
+ ngx.status = code
+ ngx.say(body)
+ }
+ }
+--- request
+GET /t
+--- response_bodu
Review Comment:
fixed
##########
t/admin/routes-array-nodes.t:
##########
@@ -113,3 +113,60 @@ passed
GET /t
--- response_body
passed
+
+
+
+=== TEST 3: PATCH route from array nodes to hash table nodes
+--- config
+ location /t {
+ content_by_lua_block {
+ local t = require("lib.test_admin").test
+
+ local code, body = t('/apisix/admin/routes/1',
+ ngx.HTTP_PUT,
+ [[{
+ "uri": "/index.html",
+ "upstream": {
+ "nodes": [{
+ "host": "127.0.0.1",
+ "port": 8080,
+ "weight": 1
+ }],
+ "type": "roundrobin"
+ }
+ }]]
+ )
+
+ code, body = t('/apisix/admin/routes/1',
+ ngx.HTTP_PATCH,
+ [[{
+ "upstream": {
+ "nodes": {
+ "127.0.0.1:9200": 1
+ }
+ }
+ }]]
+ )
+
+ code, body = t('/apisix/admin/routes/1',
+ ngx.HTTP_PATCH,
+ [[{
+ "upstream": {
+ "nodes": [{
+ "host": "127.0.0.1",
+ "port": 8080,
+ "weight": 1
+ }],
+ "type": "roundrobin"
+ }
+ }]]
+ )
Review Comment:
fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]