[GitHub] [apisix] Firstsawyou commented on a change in pull request #2209: feature: allow empty `service` object, it does not contain any `upstream` and `plugin`.

2020-09-16 Thread GitBox


Firstsawyou commented on a change in pull request #2209:
URL: https://github.com/apache/apisix/pull/2209#discussion_r489496814



##
File path: t/admin/routes.t
##
@@ -1557,8 +1557,7 @@ location /t {
 ngx.say("code: ", code)
 ngx.say(body)
 
--- etcd v3 would still get the value at 2s, don't know why yet
-ngx.sleep(2.5)
+ngx.sleep(2)

Review comment:
   remember I haven't changed this.





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:
us...@infra.apache.org




[GitHub] [apisix] Firstsawyou commented on a change in pull request #2209: feature: allow empty `service` object, it does not contain any `upstream` and `plugin`.

2020-09-16 Thread GitBox


Firstsawyou commented on a change in pull request #2209:
URL: https://github.com/apache/apisix/pull/2209#discussion_r489452597



##
File path: t/admin/routes.t
##
@@ -2180,3 +2180,65 @@ GET /t
 --- error_code: 400
 --- no_error_log
 [error]
+
+
+
+=== TEST 60: set empty service. (id: 1)(allow empty `service` object)

Review comment:
   ok.





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:
us...@infra.apache.org




[GitHub] [apisix] Firstsawyou commented on a change in pull request #2209: feature: allow empty `service` object, it does not contain any `upstream` and `plugin`.

2020-09-15 Thread GitBox


Firstsawyou commented on a change in pull request #2209:
URL: https://github.com/apache/apisix/pull/2209#discussion_r488819427



##
File path: t/admin/schema.t
##
@@ -37,10 +37,47 @@ qr/"plugins":\{"type":"object"}/
 
 
 === TEST 2: get service schema
+--- config
+location /t {
+content_by_lua_block {
+local t = require("lib.test_admin").test
+local code, body = t('/apisix/admin/schema/service',
+ngx.HTTP_GET,
+"",
+[[{
+"anyOf": [
+{
+"required":[
+"upstream"
+]
+},
+{
+"required":[
+"upstream_id"
+]
+},
+{
+"required":[
+"plugins"
+]
+},
+{
+"required":[
+"script"
+]
+}
+],
+"action": "set"
+}]]

Review comment:
   The way to detect the removal of "anyOf" is wrong, causing the test to 
fail.





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:
us...@infra.apache.org




[GitHub] [apisix] Firstsawyou commented on a change in pull request #2209: feature: allow empty `service` object, it does not contain any `upstream` and `plugin`.

2020-09-15 Thread GitBox


Firstsawyou commented on a change in pull request #2209:
URL: https://github.com/apache/apisix/pull/2209#discussion_r488599115



##
File path: t/admin/services.t
##
@@ -1085,3 +1085,50 @@ GET /t
 --- error_code: 400
 --- no_error_log
 [error]
+
+
+
+=== TEST 31: set service(id: 1)(allow empty `service` object)
+--- config
+location /t {
+content_by_lua_block {
+local t = require("lib.test_admin").test
+local code, body = t('/apisix/admin/services/1',
+ngx.HTTP_PUT,
+[[{
+"desc": "empty service"
+}]]
+)
+
+ngx.status = code
+ngx.say(body)
+}
+}
+--- request
+GET /t
+--- response_body
+passed
+--- no_error_log
+[error]
+
+
+
+=== TEST 32: get service(id: 1)(allow empty `service` object)
+--- config
+location /t {
+content_by_lua_block {
+local t = require("lib.test_admin").test
+local code, body = t('/apisix/admin/services/1',
+ ngx.HTTP_GET
+)

Review comment:
   ok.





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:
us...@infra.apache.org




[GitHub] [apisix] Firstsawyou commented on a change in pull request #2209: feature: allow empty `service` object, it does not contain any `upstream` and `plugin`.

2020-09-13 Thread GitBox


Firstsawyou commented on a change in pull request #2209:
URL: https://github.com/apache/apisix/pull/2209#discussion_r487616802



##
File path: t/admin/services.t
##
@@ -1085,3 +1085,50 @@ GET /t
 --- error_code: 400
 --- no_error_log
 [error]
+
+
+
+=== TEST 31: set service(id: 1)(allow empty `service` object)

Review comment:
   OK, I will add the complete test case.





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:
us...@infra.apache.org




[GitHub] [apisix] Firstsawyou commented on a change in pull request #2209: feature: allow empty `service` object, it does not contain any `upstream` and `plugin`.

2020-09-13 Thread GitBox


Firstsawyou commented on a change in pull request #2209:
URL: https://github.com/apache/apisix/pull/2209#discussion_r487616083



##
File path: t/admin/schema.t
##
@@ -40,7 +40,7 @@ qr/"plugins":\{"type":"object"}/
 --- request
 GET /apisix/admin/schema/service
 --- response_body eval
-qr/"required":\["upstream"\]/
+qr/"required".*additionalProperties/

Review comment:
   Because after removing the "required" of service in the schema_def.lua 
file, it will not match `qr/"required":\["upstream"\]/ `.





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:
us...@infra.apache.org