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:02:20 UTC

[GitHub] [apisix] nic-chen opened a new pull request #2444: feature: add managed fields in json schema for resources, such as create_time and update_time

nic-chen opened a new pull request #2444:
URL: https://github.com/apache/apisix/pull/2444


   ### What this PR does / why we need it:
   
   add managed fields in json schema for resources, such as create_time and update_time
   
   ### Pre-submission checklist:
   
   * [x] Did you explain what problem does this PR solve? Or what new features have been added?
   * [x] Have you added corresponding test cases?
   * [ ] Have you modified the corresponding document?
   * [x] Is this PR backward compatible?
   


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



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

Posted by GitBox <gi...@apache.org>.
nic-chen commented on pull request #2444:
URL: https://github.com/apache/apisix/pull/2444#issuecomment-710716402


   add to milestone 2.0 because need these fields to work with new `manager api` #2444 


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



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

Posted by GitBox <gi...@apache.org>.
nic-chen commented on pull request #2444:
URL: https://github.com/apache/apisix/pull/2444#issuecomment-710812564


   > @nic-chen I think you'd better add a link to the question in this PR. The community needs to know which issue is solved.
   
   sure.I have modified the summary。


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



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

Posted by GitBox <gi...@apache.org>.
nic-chen commented on a change in pull request #2444:
URL: https://github.com/apache/apisix/pull/2444#discussion_r506780230



##########
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:
       It's common used in APISIX.

##########
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:
       sure.




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



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

Posted by GitBox <gi...@apache.org>.
membphis commented on pull request #2444:
URL: https://github.com/apache/apisix/pull/2444#issuecomment-710767523


   @nic-chen I think you'd better add a link to the question in this PR. The community needs to know which issue is solved.


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



[GitHub] [apisix] nic-chen merged pull request #2444: feature: add managed fields in json schema for resources, such as create_time and update_time

Posted by GitBox <gi...@apache.org>.
nic-chen merged pull request #2444:
URL: https://github.com/apache/apisix/pull/2444


   


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



[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

Posted by GitBox <gi...@apache.org>.
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