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 2021/03/16 07:09:47 UTC

[GitHub] [apisix-dashboard] starsz opened a new pull request #1598: feat: check if the service is using by route when deleting

starsz opened a new pull request #1598:
URL: https://github.com/apache/apisix-dashboard/pull/1598


   Please answer these questions before submitting a pull request
   
   - Why submit this pull request?
   - [ ] Bugfix
   - [x] New feature provided
   - [ ] Improve performance
   - [ ] Backport patches
   
   ### New feature or improvement
   - Describe the details and related test reports.
   
   Now, when deleting a route, we don't check whether there is a route using it.
   This may lead to the DP error if the user deletes the service by mistake.
   
   So, we should check if the service is using by route when deleting.
   If the service is using, we return 400 to guarantee the DP works well.
   
   ___
   ### Please add the corresponding test cases if necessary.
   
   Added.
   ___


----------------------------------------------------------------
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-dashboard] juzhiyuan commented on a change in pull request #1598: feat: check if the service is used by route when deleting

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on a change in pull request #1598:
URL: https://github.com/apache/apisix-dashboard/pull/1598#discussion_r596720207



##########
File path: api/internal/handler/service/service.go
##########
@@ -218,8 +220,34 @@ type BatchDelete struct {
 
 func (h *Handler) BatchDelete(c droplet.Context) (interface{}, error) {
 	input := c.Input().(*BatchDelete)
+	ids := strings.Split(input.IDs, ",")
+	mp := make(map[string]struct{})
+	for _, id := range ids {
+		mp[id] = struct{}{}
+	}
+
+	ret, err := h.routeStore.List(c.Context(), store.ListInput{
+		Predicate: func(obj interface{}) bool {
+			route := obj.(*entity.Route)
+			if _, exist := mp[utils.InterfaceToString(route.ServiceID)]; exist {
+				return true
+			}
+
+			return false
+		},
+		PageSize:   0,
+		PageNumber: 0,

Review comment:
       In restful APIs, when we omit `size` or `number`, it means to fetch all resources. If we pass `0`, it should return an empty array IMO.
   
   cc @imjoey @tokers to confirm




----------------------------------------------------------------
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-dashboard] starsz commented on a change in pull request #1598: feat: check if the service is using by route when deleting

Posted by GitBox <gi...@apache.org>.
starsz commented on a change in pull request #1598:
URL: https://github.com/apache/apisix-dashboard/pull/1598#discussion_r595886265



##########
File path: api/internal/handler/service/service.go
##########
@@ -218,8 +220,34 @@ type BatchDelete struct {
 
 func (h *Handler) BatchDelete(c droplet.Context) (interface{}, error) {
 	input := c.Input().(*BatchDelete)
+	ids := strings.Split(input.IDs, ",")
+	mp := make(map[string]struct{})
+	for _, id := range ids {
+		mp[id] = struct{}{}
+	}
+
+	ret, err := h.routeStore.List(c.Context(), store.ListInput{
+		Predicate: func(obj interface{}) bool {
+			route := obj.(*entity.Route)
+			if _, exist := mp[utils.InterfaceToString(route.ServiceID)]; exist {
+				return true
+			}
+
+			return false
+		},
+		PageSize:   0,
+		PageNumber: 0,

Review comment:
       We need to list all routes.




----------------------------------------------------------------
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-dashboard] starsz commented on a change in pull request #1598: feat: check if the service is using by route when deleting

Posted by GitBox <gi...@apache.org>.
starsz commented on a change in pull request #1598:
URL: https://github.com/apache/apisix-dashboard/pull/1598#discussion_r596039455



##########
File path: api/test/e2enew/service/service_test.go
##########
@@ -82,9 +83,9 @@ var _ = ginkgo.Describe("create service without plugin", func() {
 			Method: http.MethodPut,
 			Path:   "/apisix/admin/routes/r1",
 			Body: `{
-				"uri": "/server_port",
-				"service_id": "s1"
-			}`,
+ 				"uri": "/server_port",

Review comment:
       I can't found it out.




----------------------------------------------------------------
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-dashboard] tokers commented on a change in pull request #1598: feat: check if the service is using by route when deleting

Posted by GitBox <gi...@apache.org>.
tokers commented on a change in pull request #1598:
URL: https://github.com/apache/apisix-dashboard/pull/1598#discussion_r595950219



##########
File path: api/test/e2enew/service/service_test.go
##########
@@ -82,9 +83,9 @@ var _ = ginkgo.Describe("create service without plugin", func() {
 			Method: http.MethodPut,
 			Path:   "/apisix/admin/routes/r1",
 			Body: `{
-				"uri": "/server_port",
-				"service_id": "s1"
-			}`,
+ 				"uri": "/server_port",

Review comment:
       Seems that you added some empty spaces?




----------------------------------------------------------------
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-dashboard] moonming commented on a change in pull request #1598: feat: check if the service is using by route when deleting

Posted by GitBox <gi...@apache.org>.
moonming commented on a change in pull request #1598:
URL: https://github.com/apache/apisix-dashboard/pull/1598#discussion_r596079402



##########
File path: api/test/e2enew/service/service_test.go
##########
@@ -462,3 +463,83 @@ var _ = ginkgo.Describe("service update use patch method", func() {
 		})
 	})
 })
+
+var _ = ginkgo.Describe("test service delete", func() {
+	t := ginkgo.GinkgoT()
+	var createServiceBody map[string]interface{} = map[string]interface{}{
+		"name": "testservice",
+		"upstream": map[string]interface{}{
+			"type": "roundrobin",
+			"nodes": []map[string]interface{}{
+				{
+					"host":   base.UpstreamIp,
+					"port":   1980,
+					"weight": 1,
+				},
+			},
+		},
+	}
+	_createServiceBody, err := json.Marshal(createServiceBody)
+	assert.Nil(t, err)
+
+	table.DescribeTable("test service delete",
+		func(tc base.HttpTestCase) {
+			base.RunTestCase(tc)
+		},
+		table.Entry("create service without plugin", base.HttpTestCase{
+			Desc:         "create service without plugin",
+			Object:       base.ManagerApiExpect(),
+			Method:       http.MethodPut,
+			Path:         "/apisix/admin/services/s1",
+			Headers:      map[string]string{"Authorization": base.GetToken()},
+			Body:         string(_createServiceBody),
+			ExpectStatus: http.StatusOK,
+			ExpectBody:   "\"name\":\"testservice\",\"upstream\":{\"nodes\":[{\"host\":\"" + base.UpstreamIp + "\",\"port\":1980,\"weight\":1}],\"type\":\"roundrobin\"}}",
+		}),
+		table.Entry("create route use service s1", base.HttpTestCase{
+			Desc:   "create route use service s1",
+			Object: base.ManagerApiExpect(),
+			Method: http.MethodPut,
+			Path:   "/apisix/admin/routes/r1",
+			Body: `{
+				"id": "r1",
+				"name": "route1",
+				"uri": "/hello",
+				"upstream": {
+						"type": "roundrobin",
+						"nodes": {
+								"` + base.UpstreamIp + `:1980": 1
+						}
+				},
+				"service_id": "s1"
+			}`,
+			Headers:      map[string]string{"Authorization": base.GetToken()},
+			ExpectStatus: http.StatusOK,
+			ExpectBody:   "\"service_id\":\"s1\"",
+		}),
+		table.Entry("delete service failed", base.HttpTestCase{
+			Desc:         "delete service failed",
+			Object:       base.ManagerApiExpect(),
+			Method:       http.MethodDelete,
+			Path:         "/apisix/admin/services/s1",
+			Headers:      map[string]string{"Authorization": base.GetToken()},
+			ExpectStatus: http.StatusBadRequest,
+			ExpectBody:   "route: route1 is using this service",
+		}),
+		table.Entry("delete route first", base.HttpTestCase{
+			Desc:         "delete route first",
+			Object:       base.ManagerApiExpect(),
+			Method:       http.MethodDelete,
+			Path:         "/apisix/admin/routes/r1",
+			Headers:      map[string]string{"Authorization": base.GetToken()},
+			ExpectStatus: http.StatusOK,
+		}),

Review comment:
       big +1




----------------------------------------------------------------
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-dashboard] LiteSun commented on pull request #1598: feat: check if the service is using by route when deleting

Posted by GitBox <gi...@apache.org>.
LiteSun commented on pull request #1598:
URL: https://github.com/apache/apisix-dashboard/pull/1598#issuecomment-801541755


   > @LiteSun Please have a look at Frontend CI.
   
   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:
users@infra.apache.org



[GitHub] [apisix-dashboard] codecov-io edited a comment on pull request #1598: feat: check if the service is using by route when deleting

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #1598:
URL: https://github.com/apache/apisix-dashboard/pull/1598#issuecomment-800084435


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=h1) Report
   > Merging [#1598](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=desc) (056ca61) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/38cf0ba32264d5a7bb4f22bd40ce037e2f66a939?el=desc) (38cf0ba) will **decrease** coverage by `20.22%`.
   > The diff coverage is `87.50%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff             @@
   ##           master    #1598       +/-   ##
   ===========================================
   - Coverage   71.65%   51.42%   -20.23%     
   ===========================================
     Files         133       38       -95     
     Lines        5429     2623     -2806     
     Branches      592        0      -592     
   ===========================================
   - Hits         3890     1349     -2541     
   + Misses       1296     1086      -210     
   + Partials      243      188       -55     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | backend-e2e-test | `?` | |
   | backend-e2e-test-ginkgo | `?` | |
   | backend-unit-test | `51.42% <87.50%> (+0.20%)` | :arrow_up: |
   | frontend-e2e-test | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [api/internal/handler/service/service.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvc2VydmljZS9zZXJ2aWNlLmdv) | `68.69% <87.50%> (-23.31%)` | :arrow_down: |
   | [api/internal/utils/version.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL3V0aWxzL3ZlcnNpb24uZ28=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [api/internal/filter/request\_id.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2ZpbHRlci9yZXF1ZXN0X2lkLmdv) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [api/internal/core/entity/entity.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvZW50aXR5L2VudGl0eS5nbw==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [api/internal/core/store/storehub.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvc3RvcmVodWIuZ28=) | `0.00% <0.00%> (-71.03%)` | :arrow_down: |
   | [api/internal/filter/cors.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2ZpbHRlci9jb3JzLmdv) | `0.00% <0.00%> (-66.67%)` | :arrow_down: |
   | [api/internal/filter/schema.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2ZpbHRlci9zY2hlbWEuZ28=) | `0.00% <0.00%> (-55.47%)` | :arrow_down: |
   | [api/internal/utils/consts/api\_error.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL3V0aWxzL2NvbnN0cy9hcGlfZXJyb3IuZ28=) | `0.00% <0.00%> (-50.00%)` | :arrow_down: |
   | [api/internal/handler/data\_loader/route\_import.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvZGF0YV9sb2FkZXIvcm91dGVfaW1wb3J0Lmdv) | `27.41% <0.00%> (-37.50%)` | :arrow_down: |
   | [api/internal/handler/handler.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvaGFuZGxlci5nbw==) | `42.59% <0.00%> (-35.19%)` | :arrow_down: |
   | ... and [120 more](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=footer). Last update [38cf0ba...056ca61](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
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-dashboard] moonming commented on a change in pull request #1598: feat: check if the service is using by route when deleting

Posted by GitBox <gi...@apache.org>.
moonming commented on a change in pull request #1598:
URL: https://github.com/apache/apisix-dashboard/pull/1598#discussion_r596047023



##########
File path: api/test/e2enew/service/service_test.go
##########
@@ -462,3 +463,83 @@ var _ = ginkgo.Describe("service update use patch method", func() {
 		})
 	})
 })
+
+var _ = ginkgo.Describe("test service delete", func() {
+	t := ginkgo.GinkgoT()
+	var createServiceBody map[string]interface{} = map[string]interface{}{
+		"name": "testservice",
+		"upstream": map[string]interface{}{
+			"type": "roundrobin",
+			"nodes": []map[string]interface{}{
+				{
+					"host":   base.UpstreamIp,
+					"port":   1980,
+					"weight": 1,
+				},
+			},
+		},
+	}
+	_createServiceBody, err := json.Marshal(createServiceBody)
+	assert.Nil(t, err)
+
+	table.DescribeTable("test service delete",

Review comment:
       not test DP for this new 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:
users@infra.apache.org



[GitHub] [apisix-dashboard] starsz commented on a change in pull request #1598: feat: check if the service is using by route when deleting

Posted by GitBox <gi...@apache.org>.
starsz commented on a change in pull request #1598:
URL: https://github.com/apache/apisix-dashboard/pull/1598#discussion_r596113566



##########
File path: api/test/e2enew/service/service_test.go
##########
@@ -82,9 +83,9 @@ var _ = ginkgo.Describe("create service without plugin", func() {
 			Method: http.MethodPut,
 			Path:   "/apisix/admin/routes/r1",
 			Body: `{
-				"uri": "/server_port",
-				"service_id": "s1"
-			}`,
+ 				"uri": "/server_port",

Review comment:
       Change the space to tab.




----------------------------------------------------------------
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-dashboard] starsz commented on a change in pull request #1598: feat: check if the service is using by route when deleting

Posted by GitBox <gi...@apache.org>.
starsz commented on a change in pull request #1598:
URL: https://github.com/apache/apisix-dashboard/pull/1598#discussion_r596045939



##########
File path: api/test/e2enew/service/service_test.go
##########
@@ -82,9 +83,9 @@ var _ = ginkgo.Describe("create service without plugin", func() {
 			Method: http.MethodPut,
 			Path:   "/apisix/admin/routes/r1",
 			Body: `{
-				"uri": "/server_port",
-				"service_id": "s1"
-			}`,
+ 				"uri": "/server_port",

Review comment:
       Let me check the difference.




----------------------------------------------------------------
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-dashboard] starsz commented on a change in pull request #1598: feat: check if the service is using by route when deleting

Posted by GitBox <gi...@apache.org>.
starsz commented on a change in pull request #1598:
URL: https://github.com/apache/apisix-dashboard/pull/1598#discussion_r596035649



##########
File path: api/test/e2enew/service/service_test.go
##########
@@ -462,3 +463,83 @@ var _ = ginkgo.Describe("service update use patch method", func() {
 		})
 	})
 })
+
+var _ = ginkgo.Describe("test service delete", func() {
+	t := ginkgo.GinkgoT()
+	var createServiceBody map[string]interface{} = map[string]interface{}{
+		"name": "testservice",
+		"upstream": map[string]interface{}{
+			"type": "roundrobin",
+			"nodes": []map[string]interface{}{
+				{
+					"host":   base.UpstreamIp,
+					"port":   1980,
+					"weight": 1,
+				},
+			},
+		},
+	}
+	_createServiceBody, err := json.Marshal(createServiceBody)
+	assert.Nil(t, err)
+
+	table.DescribeTable("test service delete",

Review comment:
       Yes.The DP test are here, you can see:
   
   https://github.com/apache/apisix-dashboard/blob/01c952803d256c53ac411ca52d1c90a2263879fc/api/test/e2e/route_service_upstream_test.go#L93




----------------------------------------------------------------
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-dashboard] codecov-io commented on pull request #1598: feat: check if the service is using by route when deleting

Posted by GitBox <gi...@apache.org>.
codecov-io commented on pull request #1598:
URL: https://github.com/apache/apisix-dashboard/pull/1598#issuecomment-800084435


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=h1) Report
   > Merging [#1598](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=desc) (a189506) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/01c952803d256c53ac411ca52d1c90a2263879fc?el=desc) (01c9528) will **increase** coverage by `1.12%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #1598      +/-   ##
   ==========================================
   + Coverage   71.46%   72.58%   +1.12%     
   ==========================================
     Files         132       86      -46     
     Lines        5375     2356    -3019     
     Branches      592      592              
   ==========================================
   - Hits         3841     1710    -2131     
   + Misses       1290      646     -644     
   + Partials      244        0     -244     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | backend-e2e-test | `?` | |
   | backend-e2e-test-ginkgo | `?` | |
   | backend-unit-test | `?` | |
   | frontend-e2e-test | `72.58% <ø> (ø)` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [api/internal/core/store/validate\_mock.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvdmFsaWRhdGVfbW9jay5nbw==) | | |
   | [...pi/internal/handler/plugin\_config/plugin\_config.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvcGx1Z2luX2NvbmZpZy9wbHVnaW5fY29uZmlnLmdv) | | |
   | [api/internal/utils/version.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL3V0aWxzL3ZlcnNpb24uZ28=) | | |
   | [...l/handler/route\_online\_debug/route\_online\_debug.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvcm91dGVfb25saW5lX2RlYnVnL3JvdXRlX29ubGluZV9kZWJ1Zy5nbw==) | | |
   | [api/internal/core/entity/format.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvZW50aXR5L2Zvcm1hdC5nbw==) | | |
   | [api/internal/handler/ssl/ssl.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvc3NsL3NzbC5nbw==) | | |
   | [api/internal/filter/request\_id.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2ZpbHRlci9yZXF1ZXN0X2lkLmdv) | | |
   | [api/cmd/manager/main.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2NtZC9tYW5hZ2VyL21haW4uZ28=) | | |
   | [api/internal/filter/schema.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2ZpbHRlci9zY2hlbWEuZ28=) | | |
   | [api/internal/utils/closer.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL3V0aWxzL2Nsb3Nlci5nbw==) | | |
   | ... and [35 more](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=footer). Last update [01c9528...a189506](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
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-dashboard] juzhiyuan commented on a change in pull request #1598: feat: check if the service is used by route when deleting

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on a change in pull request #1598:
URL: https://github.com/apache/apisix-dashboard/pull/1598#discussion_r596720207



##########
File path: api/internal/handler/service/service.go
##########
@@ -218,8 +220,34 @@ type BatchDelete struct {
 
 func (h *Handler) BatchDelete(c droplet.Context) (interface{}, error) {
 	input := c.Input().(*BatchDelete)
+	ids := strings.Split(input.IDs, ",")
+	mp := make(map[string]struct{})
+	for _, id := range ids {
+		mp[id] = struct{}{}
+	}
+
+	ret, err := h.routeStore.List(c.Context(), store.ListInput{
+		Predicate: func(obj interface{}) bool {
+			route := obj.(*entity.Route)
+			if _, exist := mp[utils.InterfaceToString(route.ServiceID)]; exist {
+				return true
+			}
+
+			return false
+		},
+		PageSize:   0,
+		PageNumber: 0,

Review comment:
       In restful APIs, when we omit `size` & `page`, it means to fetch all resources. If we pass `0`, it should return an empty array IMO.
   
   cc @imjoey @tokers to confirm

##########
File path: api/internal/handler/service/service.go
##########
@@ -218,8 +220,34 @@ type BatchDelete struct {
 
 func (h *Handler) BatchDelete(c droplet.Context) (interface{}, error) {
 	input := c.Input().(*BatchDelete)
+	ids := strings.Split(input.IDs, ",")
+	mp := make(map[string]struct{})
+	for _, id := range ids {
+		mp[id] = struct{}{}
+	}
+
+	ret, err := h.routeStore.List(c.Context(), store.ListInput{
+		Predicate: func(obj interface{}) bool {
+			route := obj.(*entity.Route)
+			if _, exist := mp[utils.InterfaceToString(route.ServiceID)]; exist {
+				return true
+			}
+
+			return false
+		},
+		PageSize:   0,
+		PageNumber: 0,

Review comment:
       `offset = abs(page - 1) * pageSize`




----------------------------------------------------------------
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-dashboard] starsz commented on pull request #1598: feat: check if the service is using by route when deleting

Posted by GitBox <gi...@apache.org>.
starsz commented on pull request #1598:
URL: https://github.com/apache/apisix-dashboard/pull/1598#issuecomment-801705128


   > @starsz
   > I think you should sync codes from branch master to see if there is conflict in e2e test cases.
   
   I think @LiteSun had done this before.


----------------------------------------------------------------
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-dashboard] starsz commented on a change in pull request #1598: feat: check if the service is using by route when deleting

Posted by GitBox <gi...@apache.org>.
starsz commented on a change in pull request #1598:
URL: https://github.com/apache/apisix-dashboard/pull/1598#discussion_r596629140



##########
File path: api/test/e2enew/service/service_test.go
##########
@@ -462,3 +463,83 @@ var _ = ginkgo.Describe("service update use patch method", func() {
 		})
 	})
 })
+
+var _ = ginkgo.Describe("test service delete", func() {
+	t := ginkgo.GinkgoT()
+	var createServiceBody map[string]interface{} = map[string]interface{}{
+		"name": "testservice",
+		"upstream": map[string]interface{}{
+			"type": "roundrobin",
+			"nodes": []map[string]interface{}{
+				{
+					"host":   base.UpstreamIp,
+					"port":   1980,
+					"weight": 1,
+				},
+			},
+		},
+	}
+	_createServiceBody, err := json.Marshal(createServiceBody)
+	assert.Nil(t, err)
+
+	table.DescribeTable("test service delete",

Review comment:
       Add test DP for this 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:
users@infra.apache.org



[GitHub] [apisix-dashboard] codecov-io edited a comment on pull request #1598: feat: check if the service is using by route when deleting

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #1598:
URL: https://github.com/apache/apisix-dashboard/pull/1598#issuecomment-800084435


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=h1) Report
   > Merging [#1598](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=desc) (00f9b15) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/01c952803d256c53ac411ca52d1c90a2263879fc?el=desc) (01c9528) will **decrease** coverage by `19.70%`.
   > The diff coverage is `87.50%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff             @@
   ##           master    #1598       +/-   ##
   ===========================================
   - Coverage   71.46%   51.75%   -19.71%     
   ===========================================
     Files         132       37       -95     
     Lines        5375     2570     -2805     
     Branches      592        0      -592     
   ===========================================
   - Hits         3841     1330     -2511     
   + Misses       1290     1059      -231     
   + Partials      244      181       -63     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | backend-e2e-test | `?` | |
   | backend-e2e-test-ginkgo | `?` | |
   | backend-unit-test | `51.75% <87.50%> (+0.20%)` | :arrow_up: |
   | frontend-e2e-test | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [api/internal/handler/service/service.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvc2VydmljZS9zZXJ2aWNlLmdv) | `70.64% <87.50%> (-20.85%)` | :arrow_down: |
   | [api/internal/utils/version.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL3V0aWxzL3ZlcnNpb24uZ28=) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [api/internal/filter/request\_id.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2ZpbHRlci9yZXF1ZXN0X2lkLmdv) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [api/internal/core/entity/entity.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvZW50aXR5L2VudGl0eS5nbw==) | `0.00% <0.00%> (-100.00%)` | :arrow_down: |
   | [api/internal/core/store/storehub.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvc3RvcmVodWIuZ28=) | `0.00% <0.00%> (-74.77%)` | :arrow_down: |
   | [api/internal/filter/cors.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2ZpbHRlci9jb3JzLmdv) | `0.00% <0.00%> (-66.67%)` | :arrow_down: |
   | [api/internal/filter/schema.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2ZpbHRlci9zY2hlbWEuZ28=) | `0.00% <0.00%> (-55.47%)` | :arrow_down: |
   | [api/internal/utils/consts/api\_error.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL3V0aWxzL2NvbnN0cy9hcGlfZXJyb3IuZ28=) | `0.00% <0.00%> (-50.00%)` | :arrow_down: |
   | [api/internal/handler/data\_loader/route\_import.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvZGF0YV9sb2FkZXIvcm91dGVfaW1wb3J0Lmdv) | `27.41% <0.00%> (-37.50%)` | :arrow_down: |
   | [api/internal/handler/server\_info/server\_info.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvc2VydmVyX2luZm8vc2VydmVyX2luZm8uZ28=) | `57.14% <0.00%> (-33.34%)` | :arrow_down: |
   | ... and [119 more](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=footer). Last update [01c9528...00f9b15](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
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-dashboard] juzhiyuan commented on a change in pull request #1598: feat: check if the service is used by route when deleting

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on a change in pull request #1598:
URL: https://github.com/apache/apisix-dashboard/pull/1598#discussion_r596720207



##########
File path: api/internal/handler/service/service.go
##########
@@ -218,8 +220,34 @@ type BatchDelete struct {
 
 func (h *Handler) BatchDelete(c droplet.Context) (interface{}, error) {
 	input := c.Input().(*BatchDelete)
+	ids := strings.Split(input.IDs, ",")
+	mp := make(map[string]struct{})
+	for _, id := range ids {
+		mp[id] = struct{}{}
+	}
+
+	ret, err := h.routeStore.List(c.Context(), store.ListInput{
+		Predicate: func(obj interface{}) bool {
+			route := obj.(*entity.Route)
+			if _, exist := mp[utils.InterfaceToString(route.ServiceID)]; exist {
+				return true
+			}
+
+			return false
+		},
+		PageSize:   0,
+		PageNumber: 0,

Review comment:
       In restful APIs, when we omit `size` or `page`, it means to fetch all resources. If we pass `0`, it should return an empty array IMO.
   
   cc @imjoey @tokers to confirm




----------------------------------------------------------------
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-dashboard] moonming commented on a change in pull request #1598: feat: check if the service is using by route when deleting

Posted by GitBox <gi...@apache.org>.
moonming commented on a change in pull request #1598:
URL: https://github.com/apache/apisix-dashboard/pull/1598#discussion_r596042368



##########
File path: api/test/e2enew/service/service_test.go
##########
@@ -462,3 +463,83 @@ var _ = ginkgo.Describe("service update use patch method", func() {
 		})
 	})
 })
+
+var _ = ginkgo.Describe("test service delete", func() {
+	t := ginkgo.GinkgoT()
+	var createServiceBody map[string]interface{} = map[string]interface{}{
+		"name": "testservice",
+		"upstream": map[string]interface{}{
+			"type": "roundrobin",
+			"nodes": []map[string]interface{}{
+				{
+					"host":   base.UpstreamIp,
+					"port":   1980,
+					"weight": 1,
+				},
+			},
+		},
+	}
+	_createServiceBody, err := json.Marshal(createServiceBody)
+	assert.Nil(t, err)
+
+	table.DescribeTable("test service delete",

Review comment:
       but not in this file




----------------------------------------------------------------
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-dashboard] starsz commented on a change in pull request #1598: feat: check if the service is used by route when deleting

Posted by GitBox <gi...@apache.org>.
starsz commented on a change in pull request #1598:
URL: https://github.com/apache/apisix-dashboard/pull/1598#discussion_r596725110



##########
File path: api/internal/handler/service/service.go
##########
@@ -218,8 +220,34 @@ type BatchDelete struct {
 
 func (h *Handler) BatchDelete(c droplet.Context) (interface{}, error) {
 	input := c.Input().(*BatchDelete)
+	ids := strings.Split(input.IDs, ",")
+	mp := make(map[string]struct{})
+	for _, id := range ids {
+		mp[id] = struct{}{}
+	}
+
+	ret, err := h.routeStore.List(c.Context(), store.ListInput{
+		Predicate: func(obj interface{}) bool {
+			route := obj.(*entity.Route)
+			if _, exist := mp[utils.InterfaceToString(route.ServiceID)]; exist {
+				return true
+			}
+
+			return false
+		},
+		PageSize:   0,
+		PageNumber: 0,

Review comment:
       You can see here:
   
   https://github.com/apache/apisix-dashboard/blob/38cf0ba32264d5a7bb4f22bd40ce037e2f66a939/api/internal/core/store/store.go#L210-L225




----------------------------------------------------------------
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-dashboard] juzhiyuan commented on a change in pull request #1598: feat: check if the service is used by route when deleting

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on a change in pull request #1598:
URL: https://github.com/apache/apisix-dashboard/pull/1598#discussion_r596720207



##########
File path: api/internal/handler/service/service.go
##########
@@ -218,8 +220,34 @@ type BatchDelete struct {
 
 func (h *Handler) BatchDelete(c droplet.Context) (interface{}, error) {
 	input := c.Input().(*BatchDelete)
+	ids := strings.Split(input.IDs, ",")
+	mp := make(map[string]struct{})
+	for _, id := range ids {
+		mp[id] = struct{}{}
+	}
+
+	ret, err := h.routeStore.List(c.Context(), store.ListInput{
+		Predicate: func(obj interface{}) bool {
+			route := obj.(*entity.Route)
+			if _, exist := mp[utils.InterfaceToString(route.ServiceID)]; exist {
+				return true
+			}
+
+			return false
+		},
+		PageSize:   0,
+		PageNumber: 0,

Review comment:
       In restful APIs, when we omit `size` or `number`, it means to fetch all resources. If we pass `0`, there should return an empty array IMO.
   
   cc @imjoey @tokers to confirm




----------------------------------------------------------------
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-dashboard] nic-chen commented on pull request #1598: feat: check if the service is using by route when deleting

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


   @starsz 
   I think you should sync codes from branch master to see if there is conflict in e2e test cases.
   


----------------------------------------------------------------
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-dashboard] juzhiyuan commented on pull request #1598: feat: check if the service is used by route when deleting

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on pull request #1598:
URL: https://github.com/apache/apisix-dashboard/pull/1598#issuecomment-801807824


   cc @guoqqqi to check this failed CI


----------------------------------------------------------------
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-dashboard] starsz commented on pull request #1598: feat: check if the service is using by route when deleting

Posted by GitBox <gi...@apache.org>.
starsz commented on pull request #1598:
URL: https://github.com/apache/apisix-dashboard/pull/1598#issuecomment-801540904


   @LiteSun Please have a look at Frontend CI.


----------------------------------------------------------------
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-dashboard] Jaycean commented on a change in pull request #1598: feat: check if the service is using by route when deleting

Posted by GitBox <gi...@apache.org>.
Jaycean commented on a change in pull request #1598:
URL: https://github.com/apache/apisix-dashboard/pull/1598#discussion_r596069427



##########
File path: api/test/e2enew/service/service_test.go
##########
@@ -462,3 +463,83 @@ var _ = ginkgo.Describe("service update use patch method", func() {
 		})
 	})
 })
+
+var _ = ginkgo.Describe("test service delete", func() {
+	t := ginkgo.GinkgoT()
+	var createServiceBody map[string]interface{} = map[string]interface{}{
+		"name": "testservice",
+		"upstream": map[string]interface{}{
+			"type": "roundrobin",
+			"nodes": []map[string]interface{}{
+				{
+					"host":   base.UpstreamIp,
+					"port":   1980,
+					"weight": 1,
+				},
+			},
+		},
+	}
+	_createServiceBody, err := json.Marshal(createServiceBody)
+	assert.Nil(t, err)
+
+	table.DescribeTable("test service delete",
+		func(tc base.HttpTestCase) {
+			base.RunTestCase(tc)
+		},
+		table.Entry("create service without plugin", base.HttpTestCase{
+			Desc:         "create service without plugin",
+			Object:       base.ManagerApiExpect(),
+			Method:       http.MethodPut,
+			Path:         "/apisix/admin/services/s1",
+			Headers:      map[string]string{"Authorization": base.GetToken()},
+			Body:         string(_createServiceBody),
+			ExpectStatus: http.StatusOK,
+			ExpectBody:   "\"name\":\"testservice\",\"upstream\":{\"nodes\":[{\"host\":\"" + base.UpstreamIp + "\",\"port\":1980,\"weight\":1}],\"type\":\"roundrobin\"}}",
+		}),
+		table.Entry("create route use service s1", base.HttpTestCase{
+			Desc:   "create route use service s1",
+			Object: base.ManagerApiExpect(),
+			Method: http.MethodPut,
+			Path:   "/apisix/admin/routes/r1",
+			Body: `{
+				"id": "r1",
+				"name": "route1",
+				"uri": "/hello",
+				"upstream": {
+						"type": "roundrobin",
+						"nodes": {
+								"` + base.UpstreamIp + `:1980": 1
+						}
+				},
+				"service_id": "s1"
+			}`,
+			Headers:      map[string]string{"Authorization": base.GetToken()},
+			ExpectStatus: http.StatusOK,
+			ExpectBody:   "\"service_id\":\"s1\"",
+		}),
+		table.Entry("delete service failed", base.HttpTestCase{
+			Desc:         "delete service failed",
+			Object:       base.ManagerApiExpect(),
+			Method:       http.MethodDelete,
+			Path:         "/apisix/admin/services/s1",
+			Headers:      map[string]string{"Authorization": base.GetToken()},
+			ExpectStatus: http.StatusBadRequest,
+			ExpectBody:   "route: route1 is using this service",
+		}),
+		table.Entry("delete route first", base.HttpTestCase{
+			Desc:         "delete route first",
+			Object:       base.ManagerApiExpect(),
+			Method:       http.MethodDelete,
+			Path:         "/apisix/admin/routes/r1",
+			Headers:      map[string]string{"Authorization": base.GetToken()},
+			ExpectStatus: http.StatusOK,
+		}),

Review comment:
       IMHO, we should add test cases that verify the data is deleted after deleting route data and services data




----------------------------------------------------------------
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-dashboard] starsz merged pull request #1598: feat: check if the service is used by route when deleting

Posted by GitBox <gi...@apache.org>.
starsz merged pull request #1598:
URL: https://github.com/apache/apisix-dashboard/pull/1598


   


-- 
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-dashboard] starsz commented on a change in pull request #1598: feat: check if the service is using by route when deleting

Posted by GitBox <gi...@apache.org>.
starsz commented on a change in pull request #1598:
URL: https://github.com/apache/apisix-dashboard/pull/1598#discussion_r596043452



##########
File path: api/test/e2enew/service/service_test.go
##########
@@ -462,3 +463,83 @@ var _ = ginkgo.Describe("service update use patch method", func() {
 		})
 	})
 })
+
+var _ = ginkgo.Describe("test service delete", func() {
+	t := ginkgo.GinkgoT()
+	var createServiceBody map[string]interface{} = map[string]interface{}{
+		"name": "testservice",
+		"upstream": map[string]interface{}{
+			"type": "roundrobin",
+			"nodes": []map[string]interface{}{
+				{
+					"host":   base.UpstreamIp,
+					"port":   1980,
+					"weight": 1,
+				},
+			},
+		},
+	}
+	_createServiceBody, err := json.Marshal(createServiceBody)
+	assert.Nil(t, err)
+
+	table.DescribeTable("test service delete",

Review comment:
       And here, there are in this file: 
   
   https://github.com/apache/apisix-dashboard/blob/01c952803d256c53ac411ca52d1c90a2263879fc/api/test/e2enew/service/service_test.go#L93
   
   https://github.com/apache/apisix-dashboard/blob/01c952803d256c53ac411ca52d1c90a2263879fc/api/test/e2enew/service/service_test.go#L193
   
   https://github.com/apache/apisix-dashboard/blob/01c952803d256c53ac411ca52d1c90a2263879fc/api/test/e2enew/service/service_test.go#L310




----------------------------------------------------------------
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-dashboard] starsz commented on a change in pull request #1598: feat: check if the service is using by route when deleting

Posted by GitBox <gi...@apache.org>.
starsz commented on a change in pull request #1598:
URL: https://github.com/apache/apisix-dashboard/pull/1598#discussion_r596100142



##########
File path: api/test/e2enew/service/service_test.go
##########
@@ -462,3 +463,83 @@ var _ = ginkgo.Describe("service update use patch method", func() {
 		})
 	})
 })
+
+var _ = ginkgo.Describe("test service delete", func() {
+	t := ginkgo.GinkgoT()
+	var createServiceBody map[string]interface{} = map[string]interface{}{
+		"name": "testservice",
+		"upstream": map[string]interface{}{
+			"type": "roundrobin",
+			"nodes": []map[string]interface{}{
+				{
+					"host":   base.UpstreamIp,
+					"port":   1980,
+					"weight": 1,
+				},
+			},
+		},
+	}
+	_createServiceBody, err := json.Marshal(createServiceBody)
+	assert.Nil(t, err)
+
+	table.DescribeTable("test service delete",
+		func(tc base.HttpTestCase) {
+			base.RunTestCase(tc)
+		},
+		table.Entry("create service without plugin", base.HttpTestCase{
+			Desc:         "create service without plugin",
+			Object:       base.ManagerApiExpect(),
+			Method:       http.MethodPut,
+			Path:         "/apisix/admin/services/s1",
+			Headers:      map[string]string{"Authorization": base.GetToken()},
+			Body:         string(_createServiceBody),
+			ExpectStatus: http.StatusOK,
+			ExpectBody:   "\"name\":\"testservice\",\"upstream\":{\"nodes\":[{\"host\":\"" + base.UpstreamIp + "\",\"port\":1980,\"weight\":1}],\"type\":\"roundrobin\"}}",
+		}),
+		table.Entry("create route use service s1", base.HttpTestCase{
+			Desc:   "create route use service s1",
+			Object: base.ManagerApiExpect(),
+			Method: http.MethodPut,
+			Path:   "/apisix/admin/routes/r1",
+			Body: `{
+				"id": "r1",
+				"name": "route1",
+				"uri": "/hello",
+				"upstream": {
+						"type": "roundrobin",
+						"nodes": {
+								"` + base.UpstreamIp + `:1980": 1
+						}
+				},
+				"service_id": "s1"
+			}`,
+			Headers:      map[string]string{"Authorization": base.GetToken()},
+			ExpectStatus: http.StatusOK,
+			ExpectBody:   "\"service_id\":\"s1\"",
+		}),
+		table.Entry("delete service failed", base.HttpTestCase{
+			Desc:         "delete service failed",
+			Object:       base.ManagerApiExpect(),
+			Method:       http.MethodDelete,
+			Path:         "/apisix/admin/services/s1",
+			Headers:      map[string]string{"Authorization": base.GetToken()},
+			ExpectStatus: http.StatusBadRequest,
+			ExpectBody:   "route: route1 is using this service",
+		}),
+		table.Entry("delete route first", base.HttpTestCase{
+			Desc:         "delete route first",
+			Object:       base.ManagerApiExpect(),
+			Method:       http.MethodDelete,
+			Path:         "/apisix/admin/routes/r1",
+			Headers:      map[string]string{"Authorization": base.GetToken()},
+			ExpectStatus: http.StatusOK,
+		}),

Review comment:
       Good capture. Let me add it.




----------------------------------------------------------------
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-dashboard] moonming commented on a change in pull request #1598: feat: check if the service is using by route when deleting

Posted by GitBox <gi...@apache.org>.
moonming commented on a change in pull request #1598:
URL: https://github.com/apache/apisix-dashboard/pull/1598#discussion_r595949852



##########
File path: api/test/e2enew/service/service_test.go
##########
@@ -462,3 +463,83 @@ var _ = ginkgo.Describe("service update use patch method", func() {
 		})
 	})
 })
+
+var _ = ginkgo.Describe("test service delete", func() {
+	t := ginkgo.GinkgoT()
+	var createServiceBody map[string]interface{} = map[string]interface{}{
+		"name": "testservice",
+		"upstream": map[string]interface{}{
+			"type": "roundrobin",
+			"nodes": []map[string]interface{}{
+				{
+					"host":   base.UpstreamIp,
+					"port":   1980,
+					"weight": 1,
+				},
+			},
+		},
+	}
+	_createServiceBody, err := json.Marshal(createServiceBody)
+	assert.Nil(t, err)
+
+	table.DescribeTable("test service delete",

Review comment:
       is there any test for DP?




----------------------------------------------------------------
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-dashboard] gxthrj commented on a change in pull request #1598: feat: check if the service is using by route when deleting

Posted by GitBox <gi...@apache.org>.
gxthrj commented on a change in pull request #1598:
URL: https://github.com/apache/apisix-dashboard/pull/1598#discussion_r595881924



##########
File path: api/internal/handler/service/service.go
##########
@@ -218,8 +220,34 @@ type BatchDelete struct {
 
 func (h *Handler) BatchDelete(c droplet.Context) (interface{}, error) {
 	input := c.Input().(*BatchDelete)
+	ids := strings.Split(input.IDs, ",")
+	mp := make(map[string]struct{})
+	for _, id := range ids {
+		mp[id] = struct{}{}
+	}
+
+	ret, err := h.routeStore.List(c.Context(), store.ListInput{
+		Predicate: func(obj interface{}) bool {
+			route := obj.(*entity.Route)
+			if _, exist := mp[utils.InterfaceToString(route.ServiceID)]; exist {
+				return true
+			}
+
+			return false
+		},
+		PageSize:   0,
+		PageNumber: 0,

Review comment:
       why both `pagesize` and `pagenumber` are 0 ?




----------------------------------------------------------------
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-dashboard] starsz commented on a change in pull request #1598: feat: check if the service is using by route when deleting

Posted by GitBox <gi...@apache.org>.
starsz commented on a change in pull request #1598:
URL: https://github.com/apache/apisix-dashboard/pull/1598#discussion_r596082431



##########
File path: api/test/e2enew/service/service_test.go
##########
@@ -462,3 +463,83 @@ var _ = ginkgo.Describe("service update use patch method", func() {
 		})
 	})
 })
+
+var _ = ginkgo.Describe("test service delete", func() {
+	t := ginkgo.GinkgoT()
+	var createServiceBody map[string]interface{} = map[string]interface{}{
+		"name": "testservice",
+		"upstream": map[string]interface{}{
+			"type": "roundrobin",
+			"nodes": []map[string]interface{}{
+				{
+					"host":   base.UpstreamIp,
+					"port":   1980,
+					"weight": 1,
+				},
+			},
+		},
+	}
+	_createServiceBody, err := json.Marshal(createServiceBody)
+	assert.Nil(t, err)
+
+	table.DescribeTable("test service delete",

Review comment:
       IMO, different test cases test different features.
   The former case tests the feature of creating a service and test it in DP.
   This test case is testing for the relation of service and upstream (we can't delete service when the service is used by routes.
   
   If this case tests the DP, I think the former test doesn't have mean to exist.

##########
File path: api/test/e2enew/service/service_test.go
##########
@@ -462,3 +463,83 @@ var _ = ginkgo.Describe("service update use patch method", func() {
 		})
 	})
 })
+
+var _ = ginkgo.Describe("test service delete", func() {
+	t := ginkgo.GinkgoT()
+	var createServiceBody map[string]interface{} = map[string]interface{}{
+		"name": "testservice",
+		"upstream": map[string]interface{}{
+			"type": "roundrobin",
+			"nodes": []map[string]interface{}{
+				{
+					"host":   base.UpstreamIp,
+					"port":   1980,
+					"weight": 1,
+				},
+			},
+		},
+	}
+	_createServiceBody, err := json.Marshal(createServiceBody)
+	assert.Nil(t, err)
+
+	table.DescribeTable("test service delete",

Review comment:
       IMO, different test cases test different features.
   The former case tests the feature of creating a service and test it in DP.
   This test case is testing for the relation of service and upstream (we can't delete service when the service is used by routes.
   
   If this case tests the DP, I think the former test doesn't have means to exist.




----------------------------------------------------------------
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-dashboard] juzhiyuan commented on a change in pull request #1598: feat: check if the service is used by route when deleting

Posted by GitBox <gi...@apache.org>.
juzhiyuan commented on a change in pull request #1598:
URL: https://github.com/apache/apisix-dashboard/pull/1598#discussion_r596719006



##########
File path: api/internal/handler/service/service.go
##########
@@ -218,8 +220,34 @@ type BatchDelete struct {
 
 func (h *Handler) BatchDelete(c droplet.Context) (interface{}, error) {
 	input := c.Input().(*BatchDelete)
+	ids := strings.Split(input.IDs, ",")
+	mp := make(map[string]struct{})
+	for _, id := range ids {
+		mp[id] = struct{}{}
+	}
+
+	ret, err := h.routeStore.List(c.Context(), store.ListInput{
+		Predicate: func(obj interface{}) bool {
+			route := obj.(*entity.Route)
+			if _, exist := mp[utils.InterfaceToString(route.ServiceID)]; exist {
+				return true
+			}
+
+			return false
+		},
+		PageSize:   0,
+		PageNumber: 0,

Review comment:
       `0` means all?




----------------------------------------------------------------
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-dashboard] codecov-io edited a comment on pull request #1598: feat: check if the service is using by route when deleting

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #1598:
URL: https://github.com/apache/apisix-dashboard/pull/1598#issuecomment-800084435


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=h1) Report
   > Merging [#1598](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=desc) (5097a85) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/38cf0ba32264d5a7bb4f22bd40ce037e2f66a939?el=desc) (38cf0ba) will **increase** coverage by `0.92%`.
   > The diff coverage is `n/a`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master    #1598      +/-   ##
   ==========================================
   + Coverage   71.65%   72.58%   +0.92%     
   ==========================================
     Files         133       86      -47     
     Lines        5429     2356    -3073     
     Branches      592      592              
   ==========================================
   - Hits         3890     1710    -2180     
   + Misses       1296      646     -650     
   + Partials      243        0     -243     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | backend-e2e-test | `?` | |
   | backend-e2e-test-ginkgo | `?` | |
   | backend-unit-test | `?` | |
   | frontend-e2e-test | `72.58% <ø> (-0.09%)` | :arrow_down: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [...ages/Route/components/DebugViews/DebugDrawView.tsx](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-d2ViL3NyYy9wYWdlcy9Sb3V0ZS9jb21wb25lbnRzL0RlYnVnVmlld3MvRGVidWdEcmF3Vmlldy50c3g=) | `75.38% <0.00%> (-1.54%)` | :arrow_down: |
   | [api/internal/core/entity/format.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvZW50aXR5L2Zvcm1hdC5nbw==) | | |
   | [api/internal/handler/upstream/upstream.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvdXBzdHJlYW0vdXBzdHJlYW0uZ28=) | | |
   | [api/internal/utils/version.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL3V0aWxzL3ZlcnNpb24uZ28=) | | |
   | [api/internal/core/store/store.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvc3RvcmUuZ28=) | | |
   | [api/internal/utils/utils.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL3V0aWxzL3V0aWxzLmdv) | | |
   | [api/internal/handler/route/route.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvcm91dGUvcm91dGUuZ28=) | | |
   | [api/internal/handler/consumer/consumer.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvY29uc3VtZXIvY29uc3VtZXIuZ28=) | | |
   | [api/internal/handler/data\_loader/route\_export.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvZGF0YV9sb2FkZXIvcm91dGVfZXhwb3J0Lmdv) | | |
   | [api/internal/filter/logging.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2ZpbHRlci9sb2dnaW5nLmdv) | | |
   | ... and [37 more](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=footer). Last update [38cf0ba...5097a85](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


----------------------------------------------------------------
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-dashboard] starsz commented on a change in pull request #1598: feat: check if the service is using by route when deleting

Posted by GitBox <gi...@apache.org>.
starsz commented on a change in pull request #1598:
URL: https://github.com/apache/apisix-dashboard/pull/1598#discussion_r596043452



##########
File path: api/test/e2enew/service/service_test.go
##########
@@ -462,3 +463,83 @@ var _ = ginkgo.Describe("service update use patch method", func() {
 		})
 	})
 })
+
+var _ = ginkgo.Describe("test service delete", func() {
+	t := ginkgo.GinkgoT()
+	var createServiceBody map[string]interface{} = map[string]interface{}{
+		"name": "testservice",
+		"upstream": map[string]interface{}{
+			"type": "roundrobin",
+			"nodes": []map[string]interface{}{
+				{
+					"host":   base.UpstreamIp,
+					"port":   1980,
+					"weight": 1,
+				},
+			},
+		},
+	}
+	_createServiceBody, err := json.Marshal(createServiceBody)
+	assert.Nil(t, err)
+
+	table.DescribeTable("test service delete",

Review comment:
       And here,they are in this file: 
   
   https://github.com/apache/apisix-dashboard/blob/01c952803d256c53ac411ca52d1c90a2263879fc/api/test/e2enew/service/service_test.go#L93
   
   https://github.com/apache/apisix-dashboard/blob/01c952803d256c53ac411ca52d1c90a2263879fc/api/test/e2enew/service/service_test.go#L193
   
   https://github.com/apache/apisix-dashboard/blob/01c952803d256c53ac411ca52d1c90a2263879fc/api/test/e2enew/service/service_test.go#L310




----------------------------------------------------------------
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-dashboard] codecov-io edited a comment on pull request #1598: feat: check if the service is used by route when deleting

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #1598:
URL: https://github.com/apache/apisix-dashboard/pull/1598#issuecomment-800084435


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=h1) Report
   > Merging [#1598](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=desc) (182ce58) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/e6872470abc1eef27aa37d8d25a7daff4c57b24c?el=desc) (e687247) will **decrease** coverage by `13.11%`.
   > The diff coverage is `75.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff             @@
   ##           master    #1598       +/-   ##
   ===========================================
   - Coverage   71.68%   58.56%   -13.12%     
   ===========================================
     Files         133      133               
     Lines        5456     5471       +15     
     Branches      592      592               
   ===========================================
   - Hits         3911     3204      -707     
   - Misses       1301     1984      +683     
   - Partials      244      283       +39     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | backend-e2e-test | `?` | |
   | backend-e2e-test-ginkgo | `47.96% <75.00%> (+0.15%)` | :arrow_up: |
   | backend-unit-test | `?` | |
   | frontend-e2e-test | `72.58% <ø> (+0.08%)` | :arrow_up: |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [api/internal/handler/service/service.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvc2VydmljZS9zZXJ2aWNlLmdv) | `62.60% <75.00%> (-29.40%)` | :arrow_down: |
   | [api/internal/handler/label/label.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvbGFiZWwvbGFiZWwuZ28=) | `9.43% <0.00%> (-72.65%)` | :arrow_down: |
   | [api/internal/handler/data\_loader/route\_export.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvZGF0YV9sb2FkZXIvcm91dGVfZXhwb3J0Lmdv) | `3.38% <0.00%> (-65.79%)` | :arrow_down: |
   | [api/internal/utils/runtime/runtime.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL3V0aWxzL3J1bnRpbWUvcnVudGltZS5nbw==) | `0.00% <0.00%> (-64.29%)` | :arrow_down: |
   | [api/internal/handler/global\_rule/global\_rule.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvZ2xvYmFsX3J1bGUvZ2xvYmFsX3J1bGUuZ28=) | `27.41% <0.00%> (-56.46%)` | :arrow_down: |
   | [api/internal/core/store/validate\_mock.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvdmFsaWRhdGVfbW9jay5nbw==) | `0.00% <0.00%> (-50.00%)` | :arrow_down: |
   | [api/internal/filter/authentication.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2ZpbHRlci9hdXRoZW50aWNhdGlvbi5nbw==) | `36.11% <0.00%> (-41.67%)` | :arrow_down: |
   | [api/internal/handler/data\_loader/route\_import.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvZGF0YV9sb2FkZXIvcm91dGVfaW1wb3J0Lmdv) | `27.41% <0.00%> (-37.50%)` | :arrow_down: |
   | [api/internal/core/store/store.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvc3RvcmUuZ28=) | `57.22% <0.00%> (-30.73%)` | :arrow_down: |
   | ... and [20 more](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=footer). Last update [e687247...182ce58](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


-- 
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-dashboard] codecov-io edited a comment on pull request #1598: feat: check if the service is used by route when deleting

Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #1598:
URL: https://github.com/apache/apisix-dashboard/pull/1598#issuecomment-800084435


   # [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=h1) Report
   > Merging [#1598](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=desc) (182ce58) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/e6872470abc1eef27aa37d8d25a7daff4c57b24c?el=desc) (e687247) will **decrease** coverage by `23.72%`.
   > The diff coverage is `75.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/graphs/tree.svg?width=650&height=150&src=pr&token=Q1HERXN96P)](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff             @@
   ##           master    #1598       +/-   ##
   ===========================================
   - Coverage   71.68%   47.96%   -23.73%     
   ===========================================
     Files         133       47       -86     
     Lines        5456     3115     -2341     
     Branches      592        0      -592     
   ===========================================
   - Hits         3911     1494     -2417     
   - Misses       1301     1338       +37     
   - Partials      244      283       +39     
   ```
   
   | Flag | Coverage Δ | |
   |---|---|---|
   | backend-e2e-test | `?` | |
   | backend-e2e-test-ginkgo | `47.96% <75.00%> (+0.15%)` | :arrow_up: |
   | backend-unit-test | `?` | |
   | frontend-e2e-test | `?` | |
   
   Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags#carryforward-flags-in-the-pull-request-comment) to find out more.
   
   | [Impacted Files](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [api/internal/handler/service/service.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvc2VydmljZS9zZXJ2aWNlLmdv) | `62.60% <75.00%> (-29.40%)` | :arrow_down: |
   | [api/internal/handler/label/label.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvbGFiZWwvbGFiZWwuZ28=) | `9.43% <0.00%> (-72.65%)` | :arrow_down: |
   | [api/internal/handler/data\_loader/route\_export.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvZGF0YV9sb2FkZXIvcm91dGVfZXhwb3J0Lmdv) | `3.38% <0.00%> (-65.79%)` | :arrow_down: |
   | [api/internal/utils/runtime/runtime.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL3V0aWxzL3J1bnRpbWUvcnVudGltZS5nbw==) | `0.00% <0.00%> (-64.29%)` | :arrow_down: |
   | [api/internal/handler/global\_rule/global\_rule.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvZ2xvYmFsX3J1bGUvZ2xvYmFsX3J1bGUuZ28=) | `27.41% <0.00%> (-56.46%)` | :arrow_down: |
   | [api/internal/core/store/validate\_mock.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvdmFsaWRhdGVfbW9jay5nbw==) | `0.00% <0.00%> (-50.00%)` | :arrow_down: |
   | [api/internal/filter/authentication.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2ZpbHRlci9hdXRoZW50aWNhdGlvbi5nbw==) | `36.11% <0.00%> (-41.67%)` | :arrow_down: |
   | [api/internal/handler/data\_loader/route\_import.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvZGF0YV9sb2FkZXIvcm91dGVfaW1wb3J0Lmdv) | `27.41% <0.00%> (-37.50%)` | :arrow_down: |
   | [api/internal/core/store/store.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvc3RvcmUuZ28=) | `57.22% <0.00%> (-30.73%)` | :arrow_down: |
   | ... and [105 more](https://codecov.io/gh/apache/apisix-dashboard/pull/1598/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=footer). Last update [e687247...182ce58](https://codecov.io/gh/apache/apisix-dashboard/pull/1598?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


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