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 2020/10/17 01:35:59 UTC

[GitHub] [apisix] juzhiyuan commented on a change in pull request #2444: feature: add managed fields in json schema for resources, such as create_time and update_time

juzhiyuan commented on a change in pull request #2444:
URL: https://github.com/apache/apisix/pull/2444#discussion_r506778540



##########
File path: t/admin/consumers.t
##########
@@ -322,3 +322,67 @@ GET /t
 {"error_msg":"not supported `POST` method for consumer"}
 --- no_error_log
 [error]
+
+
+
+=== TEST 10: add consumer with create_time and update_time(pony)
+--- config
+    location /t {
+        content_by_lua_block {
+            local t = require("lib.test_admin").test
+            local code, body = t('/apisix/admin/consumers',
+                ngx.HTTP_PUT,
+                [[{
+                     "username":"pony",
+                     "desc": "new consumer",
+                     "create_time": 1602883670,

Review comment:
       So this means the manager api will append create_time & update_time to those POST/PUT requests sent from frontend?

##########
File path: t/admin/routes.t
##########
@@ -2326,3 +2326,77 @@ GET /t
 {"error_msg":"invalid configuration: property \"labels\" validation failed: failed to validate env (matching \".*\"): wrong type: expected string, got table"}
 --- no_error_log
 [error]
+
+
+
+=== TEST 63: create route with create_time and update_time(id : 1)
+--- 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,
+                [[{
+                    "upstream": {
+                        "nodes": {
+                            "127.0.0.1:8080": 1
+                        },
+                        "type": "roundrobin"
+                    },
+                    "uri": "/index.html",
+                    "create_time": 1602883670,
+                    "update_time": 1602893670
+                }]],
+                [[{
+                    "node": {
+                        "value": {
+                            "uri": "/index.html",
+                            "upstream": {
+                                "nodes": {
+                                    "127.0.0.1:8080": 1
+                                },
+                                "type": "roundrobin"
+                            },
+                            "create_time": 1602883670,
+                            "update_time": 1602893670
+                        },
+                        "key": "/apisix/routes/1"
+                    },
+                    "action": "set"
+                }]]
+                )
+
+            ngx.status = code
+            ngx.say(body)
+        }
+    }
+--- request
+GET /t
+--- response_body
+passed
+--- no_error_log
+[error]
+
+
+
+=== TEST 64: delete test route(id : 1)
+--- config
+    location /t {
+        content_by_lua_block {
+            local t = require("lib.test_admin").test
+            local code, message = t('/apisix/admin/routes/1',
+                 ngx.HTTP_DELETE,
+                 nil,
+                 [[{
+                    "action": "delete"
+                }]]

Review comment:
       Codes format




----------------------------------------------------------------
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.

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