You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/08/25 06:11:40 UTC

[GitHub] [apisix] bzp2010 commented on a diff in pull request #7778: fix: admin api v3 count and list length mismatch

bzp2010 commented on code in PR #7778:
URL: https://github.com/apache/apisix/pull/7778#discussion_r954538559


##########
t/admin/filter.t:
##########
@@ -752,3 +752,129 @@ passed
     }
 --- response_body
 passed
+
+
+
+=== TEST 15: filtered data count
+--- config
+    location /t {
+        content_by_lua_block {
+            local json = require("toolkit.json")
+            local core = require("apisix.core")
+            local t = require("lib.test_admin").test
+
+            local code, body = t('/apisix/admin/routes/1',
+                ngx.HTTP_PUT,
+                [[{
+                    "upstream": {
+                        "nodes": {
+                            "127.0.0.1:1980": 1
+                        },
+                        "type": "roundrobin"
+                    },
+                    "uri": "/hello"
+                }]]
+            )
+            if code >= 300 then
+                ngx.status = code
+                ngx.say(body)
+                return
+            end
+
+            code, body = t('/apisix/admin/routes/2',
+                ngx.HTTP_PUT,
+                [[{
+                    "upstream": {
+                        "nodes": {
+                            "127.0.0.1:1980": 1
+                        },
+                        "type": "roundrobin"
+                    },
+                    "uri": "/hello"
+                }]]
+            )
+            if code >= 300 then
+                ngx.status = code
+                ngx.say(body)
+                return
+            end
+
+            ngx.sleep(0.5)
+
+            local code, body, res = t('/apisix/admin/routes', ngx.HTTP_GET)
+            res = json.decode(res)
+            assert(res.count == #res.list)
+
+            local code, body, res = t('/apisix/admin/routes/?label=', ngx.HTTP_GET)
+            res = json.decode(res)
+            assert(res.count == #res.list)
+
+            ngx.status = code
+            ngx.say(body)
+        }
+    }
+--- response_body
+passed
+
+
+
+=== TEST 16: pagination data count

Review Comment:
   It looks like I made an incorrect copy and overwrote the code. 



-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org