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/26 07:53:08 UTC
[GitHub] [apisix-dashboard] bisakhmondal opened a new pull request #1675: feat: rewrite e2e test(test-e2e-route-with-method) using ginkgo
bisakhmondal opened a new pull request #1675:
URL: https://github.com/apache/apisix-dashboard/pull/1675
Please answer these questions before submitting a pull request, **or your PR will get closed**.
**Why submit this pull request?**
- [ ] Bugfix
- [x] New feature provided
- [ ] Improve performance
- [ ] Backport patches
**Related issues**
#1500
--
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 pull request #1675: feat: rewrite e2e test(test-e2e-route-with-method) using ginkgo
Posted by GitBox <gi...@apache.org>.
tokers commented on pull request #1675:
URL: https://github.com/apache/apisix-dashboard/pull/1675#issuecomment-808682326
> hi @tokers it's due to exceeding timeout, lol. Going to make a blank commit to retrigger the CIs
I see, I'm triggering the CI actions.
--
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] bisakhmondal commented on a change in pull request #1675: feat: rewrite e2e test(test-e2e-route-with-method) using ginkgo
Posted by GitBox <gi...@apache.org>.
bisakhmondal commented on a change in pull request #1675:
URL: https://github.com/apache/apisix-dashboard/pull/1675#discussion_r602342175
##########
File path: api/test/e2enew/route/route_with_methods_test.go
##########
@@ -110,73 +111,66 @@ func TestRoute_with_methods(t *testing.T) {
}]
}
}`,
- Headers: map[string]string{"Authorization": token},
+ Headers: map[string]string{"Authorization": base.GetToken()},
ExpectStatus: http.StatusOK,
- },
- {
- Desc: "verify route by post",
- Object: APISIXExpect(t),
+ }),
+ table.Entry("verify route by post", base.HttpTestCase{
+ Object: base.APISIXExpect(),
Method: http.MethodPost,
Path: "/hello",
Body: `test=test`,
- Headers: map[string]string{"Authorization": token},
+ Headers: map[string]string{"Authorization": base.GetToken()},
ExpectStatus: http.StatusOK,
ExpectBody: "hello world",
- Sleep: sleepTime,
- },
- {
- Desc: "verify route by put",
- Object: APISIXExpect(t),
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("verify route by put", base.HttpTestCase{
+ Object: base.APISIXExpect(),
Method: http.MethodPut,
Path: "/hello",
Body: `test=test`,
- Headers: map[string]string{"Authorization": token},
+ Headers: map[string]string{"Authorization": base.GetToken()},
ExpectStatus: http.StatusOK,
ExpectBody: "hello world",
- Sleep: sleepTime,
- },
- {
- Desc: "verify route by get",
- Object: APISIXExpect(t),
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("verify route by get", base.HttpTestCase{
+ Object: base.APISIXExpect(),
Method: http.MethodGet,
Path: "/hello",
- Headers: map[string]string{"Authorization": token},
+ Headers: map[string]string{"Authorization": base.GetToken()},
ExpectStatus: http.StatusOK,
ExpectBody: "hello world",
- Sleep: sleepTime,
- },
- {
- Desc: "verify route by delete",
- Object: APISIXExpect(t),
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("verify route by delete", base.HttpTestCase{
+ Object: base.APISIXExpect(),
Method: http.MethodDelete,
Path: "/hello",
- Headers: map[string]string{"Authorization": token},
+ Headers: map[string]string{"Authorization": base.GetToken()},
ExpectStatus: http.StatusOK,
ExpectBody: "hello world",
- Sleep: sleepTime,
- },
- {
- Desc: "verify route by patch",
- Object: APISIXExpect(t),
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("verify route by patch", base.HttpTestCase{
+ Object: base.APISIXExpect(),
Method: http.MethodPatch,
Path: "/hello",
Body: `test=test`,
- Headers: map[string]string{"Authorization": token},
+ Headers: map[string]string{"Authorization": base.GetToken()},
ExpectStatus: http.StatusOK,
ExpectBody: "hello world",
- Sleep: sleepTime,
- },
- {
- Desc: "delete route",
- Object: ManagerApiExpect(t),
+ Sleep: base.SleepTime,
+ }),
Review comment:
looking into 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] gxthrj commented on pull request #1675: feat: rewrite e2e test(test-e2e-route-with-method) using ginkgo
Posted by GitBox <gi...@apache.org>.
gxthrj commented on pull request #1675:
URL: https://github.com/apache/apisix-dashboard/pull/1675#issuecomment-808752038
E2E test is failed.
--
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 #1675: feat: rewrite e2e test(test-e2e-route-with-method) using ginkgo
Posted by GitBox <gi...@apache.org>.
Jaycean commented on a change in pull request #1675:
URL: https://github.com/apache/apisix-dashboard/pull/1675#discussion_r602737847
##########
File path: api/test/e2enew/route/route_with_methods_test.go
##########
@@ -0,0 +1,367 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package route
+
+import (
+ "net/http"
+
+ "github.com/onsi/ginkgo"
+ "github.com/onsi/ginkgo/extensions/table"
+
+ "github.com/apisix/manager-api/test/e2enew/base"
+)
+
+var _ = ginkgo.Describe("route with methods", func() {
+ table.DescribeTable("test route with methods",
+ func(tc base.HttpTestCase) {
+ base.RunTestCase(tc)
+ },
+ table.Entry("add route with invalid method", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodPut,
+ Path: "/apisix/admin/routes/r1",
+ Body: `{
+ "name": "route1",
+ "uri": "/hello",
+ "methods": ["TEST"],
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": [{
+ "host": "172.16.238.20",
Review comment:
nodes host please use the base.UpstreamIp
```
"nodes": {
"` + base.UpstreamIp + `:1980": 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] tokers commented on pull request #1675: feat: rewrite e2e test(test-e2e-route-with-method) using ginkgo
Posted by GitBox <gi...@apache.org>.
tokers commented on pull request #1675:
URL: https://github.com/apache/apisix-dashboard/pull/1675#issuecomment-808679845
@bisakhmondal Please fix the go lint errors :).
--
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 pull request #1675: feat: rewrite e2e test(test-e2e-route-with-method) using ginkgo
Posted by GitBox <gi...@apache.org>.
Jaycean commented on pull request #1675:
URL: https://github.com/apache/apisix-dashboard/pull/1675#issuecomment-808400367
> Hello guys,
>
> Can't we edit the URI of a route after it has been created? We can, right?
>
> It seems when we are editing/adding the existing/new URI nginx putting a 404 error, not the apisix.
>
> it is how apisix put error for forbidden methods or non-existing URI
> (before updating the URI)
>
> 
>
> But here (after editing)
>
> 
>
> Am I missing something here?
> Thanks
I have just tested in my local area, and there is no 404 error, so I think you can create a new issue and write out the created data and process. Let's discuss this problem
--
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] bisakhmondal commented on pull request #1675: feat: rewrite e2e test(test-e2e-route-with-method) using ginkgo
Posted by GitBox <gi...@apache.org>.
bisakhmondal commented on pull request #1675:
URL: https://github.com/apache/apisix-dashboard/pull/1675#issuecomment-808342453
Hello guys,
Can't we edit the URI of a route after it has been created? We can, right?
It seems when we are editing/adding the existing/new URI nginx putting a 404 error, not the apisix.
it is how apisix put error for forbidden methods or non-existing URI
(before updating the URI)

But here (after editing)

Am I missing something here?
Thanks
--
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 edited a comment on pull request #1675: feat: rewrite e2e test(test-e2e-route-with-method) using ginkgo
Posted by GitBox <gi...@apache.org>.
Jaycean edited a comment on pull request #1675:
URL: https://github.com/apache/apisix-dashboard/pull/1675#issuecomment-809023973
> Okay, @Jaycean, I'm opening an issue.
> See the ci is also failing with a 404 for that particular test.
> 
@bisakhmondal
This error is that the URI created by APISIX is forwarded to the upstream, and the corresponding interface is also required. I checked the conf in the upstream image and found that the supporting interface is `hello` `hello1` `hello_` You can change update URI to `hello_`
File path:In the docker container: johz/upstream
/usr/local/openresty/nginx/conf/lua/server.lua
```
function _M.hello()
ngx.say("hello world")
end
function _M.hello1()
ngx.say("hello1 world")
end
function _M.hello_()
ngx.say("hello world")
end
```
`hellohello` is not supported in the upstream interface, so the error returned is 404.
```
function _M.go()
local action = string.sub(ngx.var.uri, 2)
action = string.gsub(action, "[/\\.]", "_")
if not action or not _M[action] then
return ngx.exit(404)
end
inject_headers()
return _M[action]()
end
```
--
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 #1675: feat: rewrite e2e test(test-e2e-route-with-method) using ginkgo
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #1675:
URL: https://github.com/apache/apisix-dashboard/pull/1675#issuecomment-808024334
# [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1675?src=pr&el=h1) Report
> Merging [#1675](https://codecov.io/gh/apache/apisix-dashboard/pull/1675?src=pr&el=desc) (a102197) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/88f323285f2bdbafca027da9aef357b2e3eb4008?el=desc) (88f3232) will **decrease** coverage by `5.24%`.
> The diff coverage is `n/a`.
[](https://codecov.io/gh/apache/apisix-dashboard/pull/1675?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #1675 +/- ##
==========================================
- Coverage 72.41% 67.16% -5.25%
==========================================
Files 133 47 -86
Lines 5728 3116 -2612
Branches 666 0 -666
==========================================
- Hits 4148 2093 -2055
+ Misses 1337 774 -563
- Partials 243 249 +6
```
| Flag | Coverage Δ | |
|---|---|---|
| backend-e2e-test | `47.59% <ø> (-14.25%)` | :arrow_down: |
| backend-e2e-test-ginkgo | `?` | |
| backend-unit-test | `51.81% <ø> (ø)` | |
| 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/1675?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [...l/handler/route\_online\_debug/route\_online\_debug.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvcm91dGVfb25saW5lX2RlYnVnL3JvdXRlX29ubGluZV9kZWJ1Zy5nbw==) | `5.55% <0.00%> (-70.38%)` | :arrow_down: |
| [api/internal/handler/healthz/healthz.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvaGVhbHRoei9oZWFsdGh6Lmdv) | `66.66% <0.00%> (-33.34%)` | :arrow_down: |
| [api/internal/core/entity/entity.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvZW50aXR5L2VudGl0eS5nbw==) | `81.25% <0.00%> (-18.75%)` | :arrow_down: |
| [api/internal/filter/schema.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2ZpbHRlci9zY2hlbWEuZ28=) | `39.49% <0.00%> (-15.97%)` | :arrow_down: |
| [api/internal/handler/schema/schema.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvc2NoZW1hL3NjaGVtYS5nbw==) | `90.47% <0.00%> (-9.53%)` | :arrow_down: |
| [api/internal/handler/handler.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvaGFuZGxlci5nbw==) | `68.51% <0.00%> (-9.26%)` | :arrow_down: |
| [api/internal/handler/route/route.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvcm91dGUvcm91dGUuZ28=) | `71.42% <0.00%> (-7.35%)` | :arrow_down: |
| [api/internal/handler/ssl/ssl.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvc3NsL3NzbC5nbw==) | `67.53% <0.00%> (-5.76%)` | :arrow_down: |
| [api/internal/filter/authentication.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2ZpbHRlci9hdXRoZW50aWNhdGlvbi5nbw==) | `72.22% <0.00%> (-5.56%)` | :arrow_down: |
| [api/cmd/managerapi.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2NtZC9tYW5hZ2VyYXBpLmdv) | `54.05% <0.00%> (-5.41%)` | :arrow_down: |
| ... and [95 more](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1675?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/1675?src=pr&el=footer). Last update [88f3232...a102197](https://codecov.io/gh/apache/apisix-dashboard/pull/1675?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 #1675: feat: rewrite e2e test(test-e2e-route-with-method) using ginkgo
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #1675:
URL: https://github.com/apache/apisix-dashboard/pull/1675#issuecomment-808024334
# [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1675?src=pr&el=h1) Report
> Merging [#1675](https://codecov.io/gh/apache/apisix-dashboard/pull/1675?src=pr&el=desc) (a30f011) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/88f323285f2bdbafca027da9aef357b2e3eb4008?el=desc) (88f3232) will **increase** coverage by `1.55%`.
> The diff coverage is `n/a`.
[](https://codecov.io/gh/apache/apisix-dashboard/pull/1675?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #1675 +/- ##
==========================================
+ Coverage 72.41% 73.96% +1.55%
==========================================
Files 133 86 -47
Lines 5728 2612 -3116
Branches 666 666
==========================================
- Hits 4148 1932 -2216
+ Misses 1337 680 -657
+ Partials 243 0 -243
```
| Flag | Coverage Δ | |
|---|---|---|
| backend-e2e-test | `?` | |
| backend-e2e-test-ginkgo | `?` | |
| backend-unit-test | `?` | |
| frontend-e2e-test | `73.96% <ø> (ø)` | |
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/1675?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [api/internal/utils/runtime/runtime.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL3V0aWxzL3J1bnRpbWUvcnVudGltZS5nbw==) | | |
| [api/internal/handler/global\_rule/global\_rule.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvZ2xvYmFsX3J1bGUvZ2xvYmFsX3J1bGUuZ28=) | | |
| [api/internal/core/store/store.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvc3RvcmUuZ28=) | | |
| [api/internal/handler/ssl/ssl.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvc3NsL3NzbC5nbw==) | | |
| [api/internal/utils/closer.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL3V0aWxzL2Nsb3Nlci5nbw==) | | |
| [api/internal/core/entity/format.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvZW50aXR5L2Zvcm1hdC5nbw==) | | |
| [api/internal/handler/tool/tool.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvdG9vbC90b29sLmdv) | | |
| [api/internal/conf/conf.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvbmYvY29uZi5nbw==) | | |
| [api/internal/filter/request\_id.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2ZpbHRlci9yZXF1ZXN0X2lkLmdv) | | |
| [...pi/internal/handler/plugin\_config/plugin\_config.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvcGx1Z2luX2NvbmZpZy9wbHVnaW5fY29uZmlnLmdv) | | |
| ... and [37 more](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1675?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/1675?src=pr&el=footer). Last update [88f3232...a30f011](https://codecov.io/gh/apache/apisix-dashboard/pull/1675?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] Jaycean commented on pull request #1675: feat: rewrite e2e test(test-e2e-route-with-method) using ginkgo
Posted by GitBox <gi...@apache.org>.
Jaycean commented on pull request #1675:
URL: https://github.com/apache/apisix-dashboard/pull/1675#issuecomment-809023973
> Okay, @Jaycean, I'm opening an issue.
> See the ci is also failing with a 404 for that particular test.
> 
@bisakhmondal
This error is that the URI created by APISIX is forwarded to the upstream, and the corresponding interface is also required. I checked the conf in the upstream image and found that the supporting interface is `hello` `hello1` `hello_` You can change update URI to `hello_`
File path:In the docker container: johz/upstream
/usr/local/openresty/nginx/conf/lua/server.lua
```
function _M.hello()
ngx.say("hello world")
end
function _M.hello1()
ngx.say("hello1 world")
end
function _M.hello_()
ngx.say("hello world")
end
```
--
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 merged pull request #1675: feat: rewrite e2e test(test-e2e-route-with-method) using ginkgo
Posted by GitBox <gi...@apache.org>.
juzhiyuan merged pull request #1675:
URL: https://github.com/apache/apisix-dashboard/pull/1675
--
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] bisakhmondal commented on a change in pull request #1675: feat: rewrite e2e test(test-e2e-route-with-method) using ginkgo
Posted by GitBox <gi...@apache.org>.
bisakhmondal commented on a change in pull request #1675:
URL: https://github.com/apache/apisix-dashboard/pull/1675#discussion_r602756476
##########
File path: api/test/e2enew/route/route_with_methods_test.go
##########
@@ -0,0 +1,367 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package route
+
+import (
+ "net/http"
+
+ "github.com/onsi/ginkgo"
+ "github.com/onsi/ginkgo/extensions/table"
+
+ "github.com/apisix/manager-api/test/e2enew/base"
+)
+
+var _ = ginkgo.Describe("route with methods", func() {
+ table.DescribeTable("test route with methods",
+ func(tc base.HttpTestCase) {
+ base.RunTestCase(tc)
+ },
+ table.Entry("add route with invalid method", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodPut,
+ Path: "/apisix/admin/routes/r1",
+ Body: `{
+ "name": "route1",
+ "uri": "/hello",
+ "methods": ["TEST"],
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": [{
+ "host": "172.16.238.20",
Review comment:
Nice catch :+1:. Update pushed.
--
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] bisakhmondal commented on pull request #1675: feat: rewrite e2e test(test-e2e-route-with-method) using ginkgo
Posted by GitBox <gi...@apache.org>.
bisakhmondal commented on pull request #1675:
URL: https://github.com/apache/apisix-dashboard/pull/1675#issuecomment-809088311
> Yes, after all, this upstream is just for testing
No issues. Totally agree with you :)
--
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 #1675: feat: rewrite e2e test(test-e2e-route-with-method) using ginkgo
Posted by GitBox <gi...@apache.org>.
tokers commented on a change in pull request #1675:
URL: https://github.com/apache/apisix-dashboard/pull/1675#discussion_r602318828
##########
File path: api/test/e2enew/route/route_with_methods_test.go
##########
@@ -110,73 +111,66 @@ func TestRoute_with_methods(t *testing.T) {
}]
}
}`,
- Headers: map[string]string{"Authorization": token},
+ Headers: map[string]string{"Authorization": base.GetToken()},
ExpectStatus: http.StatusOK,
- },
- {
- Desc: "verify route by post",
- Object: APISIXExpect(t),
+ }),
+ table.Entry("verify route by post", base.HttpTestCase{
+ Object: base.APISIXExpect(),
Method: http.MethodPost,
Path: "/hello",
Body: `test=test`,
- Headers: map[string]string{"Authorization": token},
+ Headers: map[string]string{"Authorization": base.GetToken()},
ExpectStatus: http.StatusOK,
ExpectBody: "hello world",
- Sleep: sleepTime,
- },
- {
- Desc: "verify route by put",
- Object: APISIXExpect(t),
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("verify route by put", base.HttpTestCase{
+ Object: base.APISIXExpect(),
Method: http.MethodPut,
Path: "/hello",
Body: `test=test`,
- Headers: map[string]string{"Authorization": token},
+ Headers: map[string]string{"Authorization": base.GetToken()},
ExpectStatus: http.StatusOK,
ExpectBody: "hello world",
- Sleep: sleepTime,
- },
- {
- Desc: "verify route by get",
- Object: APISIXExpect(t),
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("verify route by get", base.HttpTestCase{
+ Object: base.APISIXExpect(),
Method: http.MethodGet,
Path: "/hello",
- Headers: map[string]string{"Authorization": token},
+ Headers: map[string]string{"Authorization": base.GetToken()},
ExpectStatus: http.StatusOK,
ExpectBody: "hello world",
- Sleep: sleepTime,
- },
- {
- Desc: "verify route by delete",
- Object: APISIXExpect(t),
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("verify route by delete", base.HttpTestCase{
+ Object: base.APISIXExpect(),
Method: http.MethodDelete,
Path: "/hello",
- Headers: map[string]string{"Authorization": token},
+ Headers: map[string]string{"Authorization": base.GetToken()},
ExpectStatus: http.StatusOK,
ExpectBody: "hello world",
- Sleep: sleepTime,
- },
- {
- Desc: "verify route by patch",
- Object: APISIXExpect(t),
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("verify route by patch", base.HttpTestCase{
+ Object: base.APISIXExpect(),
Method: http.MethodPatch,
Path: "/hello",
Body: `test=test`,
- Headers: map[string]string{"Authorization": token},
+ Headers: map[string]string{"Authorization": base.GetToken()},
ExpectStatus: http.StatusOK,
ExpectBody: "hello world",
- Sleep: sleepTime,
- },
- {
- Desc: "delete route",
- Object: ManagerApiExpect(t),
+ Sleep: base.SleepTime,
+ }),
Review comment:
Also, we may update the `methods` list and verify the change.
##########
File path: api/test/e2enew/route/route_with_methods_test.go
##########
@@ -71,30 +75,27 @@ func TestRoute_with_methods(t *testing.T) {
}]
}
}`,
- Headers: map[string]string{"Authorization": token},
+ Headers: map[string]string{"Authorization": base.GetToken()},
ExpectStatus: http.StatusOK,
- },
- {
- Desc: "verify route",
- Object: APISIXExpect(t),
+ }),
+ table.Entry("verify route", base.HttpTestCase{
+ Object: base.APISIXExpect(),
Method: http.MethodGet,
Path: "/hello",
- Headers: map[string]string{"Authorization": token},
+ Headers: map[string]string{"Authorization": base.GetToken()},
ExpectStatus: http.StatusOK,
ExpectBody: "hello world",
- Sleep: sleepTime,
- },
- {
- Desc: "delete route",
- Object: ManagerApiExpect(t),
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("delete route", base.HttpTestCase{
Review comment:
It seems the update of these routes is missing, we should 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] codecov-io edited a comment on pull request #1675: feat: rewrite e2e test(test-e2e-route-with-method) using ginkgo
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #1675:
URL: https://github.com/apache/apisix-dashboard/pull/1675#issuecomment-808024334
# [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1675?src=pr&el=h1) Report
> Merging [#1675](https://codecov.io/gh/apache/apisix-dashboard/pull/1675?src=pr&el=desc) (2c96d73) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/88f323285f2bdbafca027da9aef357b2e3eb4008?el=desc) (88f3232) will **decrease** coverage by `25.04%`.
> The diff coverage is `n/a`.
[](https://codecov.io/gh/apache/apisix-dashboard/pull/1675?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #1675 +/- ##
===========================================
- Coverage 72.41% 47.36% -25.05%
===========================================
Files 133 47 -86
Lines 5728 3116 -2612
Branches 666 0 -666
===========================================
- Hits 4148 1476 -2672
- Misses 1337 1382 +45
- Partials 243 258 +15
```
| Flag | Coverage Δ | |
|---|---|---|
| backend-e2e-test | `47.36% <ø> (-14.48%)` | :arrow_down: |
| backend-e2e-test-ginkgo | `?` | |
| 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/1675?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [api/internal/handler/schema/plugin.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvc2NoZW1hL3BsdWdpbi5nbw==) | `15.00% <0.00%> (-85.00%)` | :arrow_down: |
| [api/internal/handler/tool/tool.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvdG9vbC90b29sLmdv) | `13.88% <0.00%> (-80.56%)` | :arrow_down: |
| [api/internal/handler/schema/schema.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvc2NoZW1hL3NjaGVtYS5nbw==) | `23.80% <0.00%> (-76.20%)` | :arrow_down: |
| [...l/handler/route\_online\_debug/route\_online\_debug.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvcm91dGVfb25saW5lX2RlYnVnL3JvdXRlX29ubGluZV9kZWJ1Zy5nbw==) | `5.55% <0.00%> (-70.38%)` | :arrow_down: |
| [api/internal/utils/runtime/runtime.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL3V0aWxzL3J1bnRpbWUvcnVudGltZS5nbw==) | `0.00% <0.00%> (-64.29%)` | :arrow_down: |
| [api/internal/handler/ssl/ssl.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvc3NsL3NzbC5nbw==) | `12.04% <0.00%> (-61.26%)` | :arrow_down: |
| [api/internal/handler/upstream/upstream.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvdXBzdHJlYW0vdXBzdHJlYW0uZ28=) | `31.42% <0.00%> (-59.29%)` | :arrow_down: |
| [api/internal/handler/server\_info/server\_info.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvc2VydmVyX2luZm8vc2VydmVyX2luZm8uZ28=) | `33.33% <0.00%> (-57.15%)` | :arrow_down: |
| [api/internal/handler/service/service.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvc2VydmljZS9zZXJ2aWNlLmdv) | `41.73% <0.00%> (-50.44%)` | :arrow_down: |
| [api/internal/core/store/validate\_mock.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvdmFsaWRhdGVfbW9jay5nbw==) | `0.00% <0.00%> (-50.00%)` | :arrow_down: |
| ... and [107 more](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1675?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/1675?src=pr&el=footer). Last update [88f3232...2c96d73](https://codecov.io/gh/apache/apisix-dashboard/pull/1675?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] bisakhmondal commented on pull request #1675: feat: rewrite e2e test(test-e2e-route-with-method) using ginkgo
Posted by GitBox <gi...@apache.org>.
bisakhmondal commented on pull request #1675:
URL: https://github.com/apache/apisix-dashboard/pull/1675#issuecomment-808680921
hi @tokers it's due to exceeding timeout, lol. Going to make a blank commit to retrigger the CIs
--
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 #1675: feat: rewrite e2e test(test-e2e-route-with-method) using ginkgo
Posted by GitBox <gi...@apache.org>.
Jaycean commented on a change in pull request #1675:
URL: https://github.com/apache/apisix-dashboard/pull/1675#discussion_r602737877
##########
File path: api/test/e2enew/route/route_with_methods_test.go
##########
@@ -0,0 +1,367 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package route
+
+import (
+ "net/http"
+
+ "github.com/onsi/ginkgo"
+ "github.com/onsi/ginkgo/extensions/table"
+
+ "github.com/apisix/manager-api/test/e2enew/base"
+)
+
+var _ = ginkgo.Describe("route with methods", func() {
+ table.DescribeTable("test route with methods",
+ func(tc base.HttpTestCase) {
+ base.RunTestCase(tc)
+ },
+ table.Entry("add route with invalid method", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodPut,
+ Path: "/apisix/admin/routes/r1",
+ Body: `{
+ "name": "route1",
+ "uri": "/hello",
+ "methods": ["TEST"],
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": [{
+ "host": "172.16.238.20",
+ "port": 1980,
+ "weight": 1
+ }]
+ }
+ }`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusBadRequest,
+ }),
+ table.Entry("verify route", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodGet,
+ Path: "/hello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusNotFound,
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("add route with valid method", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodPut,
+ Path: "/apisix/admin/routes/r1",
+ Body: `{
+ "name": "route1",
+ "uri": "/hello",
+ "methods": ["GET"],
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": [{
+ "host": "172.16.238.20",
Review comment:
ditto
##########
File path: api/test/e2enew/route/route_with_methods_test.go
##########
@@ -0,0 +1,367 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package route
+
+import (
+ "net/http"
+
+ "github.com/onsi/ginkgo"
+ "github.com/onsi/ginkgo/extensions/table"
+
+ "github.com/apisix/manager-api/test/e2enew/base"
+)
+
+var _ = ginkgo.Describe("route with methods", func() {
+ table.DescribeTable("test route with methods",
+ func(tc base.HttpTestCase) {
+ base.RunTestCase(tc)
+ },
+ table.Entry("add route with invalid method", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodPut,
+ Path: "/apisix/admin/routes/r1",
+ Body: `{
+ "name": "route1",
+ "uri": "/hello",
+ "methods": ["TEST"],
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": [{
+ "host": "172.16.238.20",
+ "port": 1980,
+ "weight": 1
+ }]
+ }
+ }`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusBadRequest,
+ }),
+ table.Entry("verify route", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodGet,
+ Path: "/hello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusNotFound,
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("add route with valid method", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodPut,
+ Path: "/apisix/admin/routes/r1",
+ Body: `{
+ "name": "route1",
+ "uri": "/hello",
+ "methods": ["GET"],
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": [{
+ "host": "172.16.238.20",
+ "port": 1980,
+ "weight": 1
+ }]
+ }
+ }`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ }),
+ table.Entry("verify route", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodGet,
+ Path: "/hello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ ExpectBody: "hello world",
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("update same route path", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodPut,
+ Path: "/apisix/admin/routes/r1",
+ Body: `{
+ "name": "route1",
+ "uri": "/hellohello",
+ "methods": ["GET"],
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": [{
+ "host": "172.16.238.20",
+ "port": 1980,
+ "weight": 1
+ }]
+ }
+ }`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ }),
+ table.Entry("verify old route updated", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodGet,
+ Path: "/hello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusNotFound,
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("verify new update applied", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodGet,
+ Path: "/hellohello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ ExpectBody: "hello world",
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("delete route", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodDelete,
+ Path: "/apisix/admin/routes/r1",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ }),
+ table.Entry("add route with valid methods", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodPut,
+ Path: "/apisix/admin/routes/r1",
+ Body: `{
+ "name": "route1",
+ "uri": "/hello",
+ "methods": ["GET", "POST", "PUT", "DELETE", "PATCH"],
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": [{
+ "host": "172.16.238.20",
+ "port": 1980,
+ "weight": 1
+ }]
+ }
+ }`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ }),
+ table.Entry("verify route by post", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodPost,
+ Path: "/hello",
+ Body: `test=test`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ ExpectBody: "hello world",
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("verify route by put", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodPut,
+ Path: "/hello",
+ Body: `test=test`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ ExpectBody: "hello world",
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("verify route by get", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodGet,
+ Path: "/hello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ ExpectBody: "hello world",
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("verify route by delete", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodDelete,
+ Path: "/hello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ ExpectBody: "hello world",
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("verify route by patch", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodPatch,
+ Path: "/hello",
+ Body: `test=test`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ ExpectBody: "hello world",
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("update route methods to GET only", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodPut,
+ Path: "/apisix/admin/routes/r1",
+ Body: `{
+ "name": "route1",
+ "uri": "/hello",
+ "methods": ["GET"],
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": [{
+ "host": "172.16.238.20",
+ "port": 1980,
+ "weight": 1
+ }]
+ }
+ }`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ }),
+ table.Entry("verify post method isn't working now", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodPost,
+ Path: "/hello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusNotFound,
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("verify PUT method isn't working now", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodPut,
+ Path: "/hello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusNotFound,
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("verify route by GET only", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodGet,
+ Path: "/hello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ ExpectBody: "hello world",
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("delete route", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodDelete,
+ Path: "/apisix/admin/routes/r1",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ }),
+ table.Entry("add route with lower case methods", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodPut,
+ Path: "/apisix/admin/routes/r1",
+ Body: `{
+ "name": "route1",
+ "uri": "/hello",
+ "methods": ["GET", "post"],
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": [{
+ "host": "172.16.238.20",
+ "port": 1980,
+ "weight": 1
+ }]
+ }
+ }`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusBadRequest,
+ }),
+ table.Entry("verify route", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodGet,
+ Path: "/hello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusNotFound,
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("add route with methods GET", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodPut,
+ Path: "/apisix/admin/routes/r1",
+ Body: `{
+ "name": "route1",
+ "uri": "/hello",
+ "methods": ["GET"],
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": [{
+ "host": "172.16.238.20",
+ "port": 1980,
+ "weight": 1
+ }]
+ }
+ }`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ }),
+ table.Entry("verify route by get", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodGet,
+ Path: "/hello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ ExpectBody: "hello world",
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("verify route by post", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodPost,
+ Path: "/hello",
+ Body: `test=test`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusNotFound,
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("update route methods to POST", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodPut,
+ Path: "/apisix/admin/routes/r1",
+ Body: `{
+ "name": "route1",
+ "uri": "/hello",
+ "methods": ["POST"],
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": [{
+ "host": "172.16.238.20",
Review comment:
ditto
##########
File path: api/test/e2enew/route/route_with_methods_test.go
##########
@@ -0,0 +1,367 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package route
+
+import (
+ "net/http"
+
+ "github.com/onsi/ginkgo"
+ "github.com/onsi/ginkgo/extensions/table"
+
+ "github.com/apisix/manager-api/test/e2enew/base"
+)
+
+var _ = ginkgo.Describe("route with methods", func() {
+ table.DescribeTable("test route with methods",
+ func(tc base.HttpTestCase) {
+ base.RunTestCase(tc)
+ },
+ table.Entry("add route with invalid method", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodPut,
+ Path: "/apisix/admin/routes/r1",
+ Body: `{
+ "name": "route1",
+ "uri": "/hello",
+ "methods": ["TEST"],
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": [{
+ "host": "172.16.238.20",
Review comment:
nodes host please use the base.UpstreamIp
##########
File path: api/test/e2enew/route/route_with_methods_test.go
##########
@@ -0,0 +1,367 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package route
+
+import (
+ "net/http"
+
+ "github.com/onsi/ginkgo"
+ "github.com/onsi/ginkgo/extensions/table"
+
+ "github.com/apisix/manager-api/test/e2enew/base"
+)
+
+var _ = ginkgo.Describe("route with methods", func() {
+ table.DescribeTable("test route with methods",
+ func(tc base.HttpTestCase) {
+ base.RunTestCase(tc)
+ },
+ table.Entry("add route with invalid method", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodPut,
+ Path: "/apisix/admin/routes/r1",
+ Body: `{
+ "name": "route1",
+ "uri": "/hello",
+ "methods": ["TEST"],
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": [{
+ "host": "172.16.238.20",
+ "port": 1980,
+ "weight": 1
+ }]
+ }
+ }`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusBadRequest,
+ }),
+ table.Entry("verify route", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodGet,
+ Path: "/hello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusNotFound,
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("add route with valid method", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodPut,
+ Path: "/apisix/admin/routes/r1",
+ Body: `{
+ "name": "route1",
+ "uri": "/hello",
+ "methods": ["GET"],
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": [{
+ "host": "172.16.238.20",
+ "port": 1980,
+ "weight": 1
+ }]
+ }
+ }`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ }),
+ table.Entry("verify route", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodGet,
+ Path: "/hello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ ExpectBody: "hello world",
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("update same route path", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodPut,
+ Path: "/apisix/admin/routes/r1",
+ Body: `{
+ "name": "route1",
+ "uri": "/hellohello",
+ "methods": ["GET"],
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": [{
+ "host": "172.16.238.20",
+ "port": 1980,
+ "weight": 1
+ }]
+ }
+ }`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ }),
+ table.Entry("verify old route updated", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodGet,
+ Path: "/hello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusNotFound,
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("verify new update applied", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodGet,
+ Path: "/hellohello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ ExpectBody: "hello world",
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("delete route", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodDelete,
+ Path: "/apisix/admin/routes/r1",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ }),
+ table.Entry("add route with valid methods", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodPut,
+ Path: "/apisix/admin/routes/r1",
+ Body: `{
+ "name": "route1",
+ "uri": "/hello",
+ "methods": ["GET", "POST", "PUT", "DELETE", "PATCH"],
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": [{
+ "host": "172.16.238.20",
Review comment:
ditto
##########
File path: api/test/e2enew/route/route_with_methods_test.go
##########
@@ -0,0 +1,367 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package route
+
+import (
+ "net/http"
+
+ "github.com/onsi/ginkgo"
+ "github.com/onsi/ginkgo/extensions/table"
+
+ "github.com/apisix/manager-api/test/e2enew/base"
+)
+
+var _ = ginkgo.Describe("route with methods", func() {
+ table.DescribeTable("test route with methods",
+ func(tc base.HttpTestCase) {
+ base.RunTestCase(tc)
+ },
+ table.Entry("add route with invalid method", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodPut,
+ Path: "/apisix/admin/routes/r1",
+ Body: `{
+ "name": "route1",
+ "uri": "/hello",
+ "methods": ["TEST"],
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": [{
+ "host": "172.16.238.20",
+ "port": 1980,
+ "weight": 1
+ }]
+ }
+ }`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusBadRequest,
+ }),
+ table.Entry("verify route", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodGet,
+ Path: "/hello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusNotFound,
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("add route with valid method", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodPut,
+ Path: "/apisix/admin/routes/r1",
+ Body: `{
+ "name": "route1",
+ "uri": "/hello",
+ "methods": ["GET"],
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": [{
+ "host": "172.16.238.20",
+ "port": 1980,
+ "weight": 1
+ }]
+ }
+ }`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ }),
+ table.Entry("verify route", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodGet,
+ Path: "/hello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ ExpectBody: "hello world",
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("update same route path", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodPut,
+ Path: "/apisix/admin/routes/r1",
+ Body: `{
+ "name": "route1",
+ "uri": "/hellohello",
+ "methods": ["GET"],
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": [{
+ "host": "172.16.238.20",
Review comment:
ditto
##########
File path: api/test/e2enew/route/route_with_methods_test.go
##########
@@ -0,0 +1,367 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package route
+
+import (
+ "net/http"
+
+ "github.com/onsi/ginkgo"
+ "github.com/onsi/ginkgo/extensions/table"
+
+ "github.com/apisix/manager-api/test/e2enew/base"
+)
+
+var _ = ginkgo.Describe("route with methods", func() {
+ table.DescribeTable("test route with methods",
+ func(tc base.HttpTestCase) {
+ base.RunTestCase(tc)
+ },
+ table.Entry("add route with invalid method", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodPut,
+ Path: "/apisix/admin/routes/r1",
+ Body: `{
+ "name": "route1",
+ "uri": "/hello",
+ "methods": ["TEST"],
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": [{
+ "host": "172.16.238.20",
+ "port": 1980,
+ "weight": 1
+ }]
+ }
+ }`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusBadRequest,
+ }),
+ table.Entry("verify route", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodGet,
+ Path: "/hello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusNotFound,
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("add route with valid method", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodPut,
+ Path: "/apisix/admin/routes/r1",
+ Body: `{
+ "name": "route1",
+ "uri": "/hello",
+ "methods": ["GET"],
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": [{
+ "host": "172.16.238.20",
+ "port": 1980,
+ "weight": 1
+ }]
+ }
+ }`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ }),
+ table.Entry("verify route", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodGet,
+ Path: "/hello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ ExpectBody: "hello world",
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("update same route path", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodPut,
+ Path: "/apisix/admin/routes/r1",
+ Body: `{
+ "name": "route1",
+ "uri": "/hellohello",
+ "methods": ["GET"],
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": [{
+ "host": "172.16.238.20",
+ "port": 1980,
+ "weight": 1
+ }]
+ }
+ }`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ }),
+ table.Entry("verify old route updated", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodGet,
+ Path: "/hello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusNotFound,
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("verify new update applied", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodGet,
+ Path: "/hellohello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ ExpectBody: "hello world",
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("delete route", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodDelete,
+ Path: "/apisix/admin/routes/r1",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ }),
+ table.Entry("add route with valid methods", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodPut,
+ Path: "/apisix/admin/routes/r1",
+ Body: `{
+ "name": "route1",
+ "uri": "/hello",
+ "methods": ["GET", "POST", "PUT", "DELETE", "PATCH"],
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": [{
+ "host": "172.16.238.20",
+ "port": 1980,
+ "weight": 1
+ }]
+ }
+ }`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ }),
+ table.Entry("verify route by post", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodPost,
+ Path: "/hello",
+ Body: `test=test`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ ExpectBody: "hello world",
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("verify route by put", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodPut,
+ Path: "/hello",
+ Body: `test=test`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ ExpectBody: "hello world",
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("verify route by get", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodGet,
+ Path: "/hello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ ExpectBody: "hello world",
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("verify route by delete", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodDelete,
+ Path: "/hello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ ExpectBody: "hello world",
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("verify route by patch", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodPatch,
+ Path: "/hello",
+ Body: `test=test`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ ExpectBody: "hello world",
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("update route methods to GET only", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodPut,
+ Path: "/apisix/admin/routes/r1",
+ Body: `{
+ "name": "route1",
+ "uri": "/hello",
+ "methods": ["GET"],
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": [{
+ "host": "172.16.238.20",
+ "port": 1980,
+ "weight": 1
+ }]
+ }
+ }`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ }),
+ table.Entry("verify post method isn't working now", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodPost,
+ Path: "/hello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusNotFound,
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("verify PUT method isn't working now", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodPut,
+ Path: "/hello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusNotFound,
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("verify route by GET only", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodGet,
+ Path: "/hello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ ExpectBody: "hello world",
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("delete route", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodDelete,
+ Path: "/apisix/admin/routes/r1",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ }),
+ table.Entry("add route with lower case methods", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodPut,
+ Path: "/apisix/admin/routes/r1",
+ Body: `{
+ "name": "route1",
+ "uri": "/hello",
+ "methods": ["GET", "post"],
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": [{
+ "host": "172.16.238.20",
Review comment:
ditto
##########
File path: api/test/e2enew/route/route_with_methods_test.go
##########
@@ -0,0 +1,367 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package route
+
+import (
+ "net/http"
+
+ "github.com/onsi/ginkgo"
+ "github.com/onsi/ginkgo/extensions/table"
+
+ "github.com/apisix/manager-api/test/e2enew/base"
+)
+
+var _ = ginkgo.Describe("route with methods", func() {
+ table.DescribeTable("test route with methods",
+ func(tc base.HttpTestCase) {
+ base.RunTestCase(tc)
+ },
+ table.Entry("add route with invalid method", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodPut,
+ Path: "/apisix/admin/routes/r1",
+ Body: `{
+ "name": "route1",
+ "uri": "/hello",
+ "methods": ["TEST"],
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": [{
+ "host": "172.16.238.20",
+ "port": 1980,
+ "weight": 1
+ }]
+ }
+ }`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusBadRequest,
+ }),
+ table.Entry("verify route", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodGet,
+ Path: "/hello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusNotFound,
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("add route with valid method", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodPut,
+ Path: "/apisix/admin/routes/r1",
+ Body: `{
+ "name": "route1",
+ "uri": "/hello",
+ "methods": ["GET"],
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": [{
+ "host": "172.16.238.20",
+ "port": 1980,
+ "weight": 1
+ }]
+ }
+ }`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ }),
+ table.Entry("verify route", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodGet,
+ Path: "/hello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ ExpectBody: "hello world",
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("update same route path", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodPut,
+ Path: "/apisix/admin/routes/r1",
+ Body: `{
+ "name": "route1",
+ "uri": "/hellohello",
+ "methods": ["GET"],
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": [{
+ "host": "172.16.238.20",
+ "port": 1980,
+ "weight": 1
+ }]
+ }
+ }`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ }),
+ table.Entry("verify old route updated", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodGet,
+ Path: "/hello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusNotFound,
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("verify new update applied", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodGet,
+ Path: "/hellohello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ ExpectBody: "hello world",
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("delete route", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodDelete,
+ Path: "/apisix/admin/routes/r1",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ }),
+ table.Entry("add route with valid methods", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodPut,
+ Path: "/apisix/admin/routes/r1",
+ Body: `{
+ "name": "route1",
+ "uri": "/hello",
+ "methods": ["GET", "POST", "PUT", "DELETE", "PATCH"],
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": [{
+ "host": "172.16.238.20",
+ "port": 1980,
+ "weight": 1
+ }]
+ }
+ }`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ }),
+ table.Entry("verify route by post", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodPost,
+ Path: "/hello",
+ Body: `test=test`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ ExpectBody: "hello world",
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("verify route by put", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodPut,
+ Path: "/hello",
+ Body: `test=test`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ ExpectBody: "hello world",
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("verify route by get", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodGet,
+ Path: "/hello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ ExpectBody: "hello world",
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("verify route by delete", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodDelete,
+ Path: "/hello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ ExpectBody: "hello world",
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("verify route by patch", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodPatch,
+ Path: "/hello",
+ Body: `test=test`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ ExpectBody: "hello world",
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("update route methods to GET only", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodPut,
+ Path: "/apisix/admin/routes/r1",
+ Body: `{
+ "name": "route1",
+ "uri": "/hello",
+ "methods": ["GET"],
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": [{
+ "host": "172.16.238.20",
+ "port": 1980,
+ "weight": 1
+ }]
+ }
+ }`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ }),
+ table.Entry("verify post method isn't working now", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodPost,
+ Path: "/hello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusNotFound,
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("verify PUT method isn't working now", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodPut,
+ Path: "/hello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusNotFound,
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("verify route by GET only", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodGet,
+ Path: "/hello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ ExpectBody: "hello world",
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("delete route", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodDelete,
+ Path: "/apisix/admin/routes/r1",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ }),
+ table.Entry("add route with lower case methods", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodPut,
+ Path: "/apisix/admin/routes/r1",
+ Body: `{
+ "name": "route1",
+ "uri": "/hello",
+ "methods": ["GET", "post"],
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": [{
+ "host": "172.16.238.20",
+ "port": 1980,
+ "weight": 1
+ }]
+ }
+ }`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusBadRequest,
+ }),
+ table.Entry("verify route", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodGet,
+ Path: "/hello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusNotFound,
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("add route with methods GET", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodPut,
+ Path: "/apisix/admin/routes/r1",
+ Body: `{
+ "name": "route1",
+ "uri": "/hello",
+ "methods": ["GET"],
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": [{
+ "host": "172.16.238.20",
Review comment:
ditto
##########
File path: api/test/e2enew/route/route_with_methods_test.go
##########
@@ -0,0 +1,367 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package route
+
+import (
+ "net/http"
+
+ "github.com/onsi/ginkgo"
+ "github.com/onsi/ginkgo/extensions/table"
+
+ "github.com/apisix/manager-api/test/e2enew/base"
+)
+
+var _ = ginkgo.Describe("route with methods", func() {
+ table.DescribeTable("test route with methods",
+ func(tc base.HttpTestCase) {
+ base.RunTestCase(tc)
+ },
+ table.Entry("add route with invalid method", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodPut,
+ Path: "/apisix/admin/routes/r1",
+ Body: `{
+ "name": "route1",
+ "uri": "/hello",
+ "methods": ["TEST"],
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": [{
+ "host": "172.16.238.20",
+ "port": 1980,
+ "weight": 1
+ }]
+ }
+ }`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusBadRequest,
+ }),
+ table.Entry("verify route", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodGet,
+ Path: "/hello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusNotFound,
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("add route with valid method", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodPut,
+ Path: "/apisix/admin/routes/r1",
+ Body: `{
+ "name": "route1",
+ "uri": "/hello",
+ "methods": ["GET"],
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": [{
+ "host": "172.16.238.20",
+ "port": 1980,
+ "weight": 1
+ }]
+ }
+ }`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ }),
+ table.Entry("verify route", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodGet,
+ Path: "/hello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ ExpectBody: "hello world",
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("update same route path", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodPut,
+ Path: "/apisix/admin/routes/r1",
+ Body: `{
+ "name": "route1",
+ "uri": "/hellohello",
+ "methods": ["GET"],
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": [{
+ "host": "172.16.238.20",
+ "port": 1980,
+ "weight": 1
+ }]
+ }
+ }`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ }),
+ table.Entry("verify old route updated", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodGet,
+ Path: "/hello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusNotFound,
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("verify new update applied", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodGet,
+ Path: "/hellohello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ ExpectBody: "hello world",
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("delete route", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodDelete,
+ Path: "/apisix/admin/routes/r1",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ }),
+ table.Entry("add route with valid methods", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodPut,
+ Path: "/apisix/admin/routes/r1",
+ Body: `{
+ "name": "route1",
+ "uri": "/hello",
+ "methods": ["GET", "POST", "PUT", "DELETE", "PATCH"],
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": [{
+ "host": "172.16.238.20",
+ "port": 1980,
+ "weight": 1
+ }]
+ }
+ }`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ }),
+ table.Entry("verify route by post", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodPost,
+ Path: "/hello",
+ Body: `test=test`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ ExpectBody: "hello world",
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("verify route by put", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodPut,
+ Path: "/hello",
+ Body: `test=test`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ ExpectBody: "hello world",
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("verify route by get", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodGet,
+ Path: "/hello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ ExpectBody: "hello world",
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("verify route by delete", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodDelete,
+ Path: "/hello",
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ ExpectBody: "hello world",
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("verify route by patch", base.HttpTestCase{
+ Object: base.APISIXExpect(),
+ Method: http.MethodPatch,
+ Path: "/hello",
+ Body: `test=test`,
+ Headers: map[string]string{"Authorization": base.GetToken()},
+ ExpectStatus: http.StatusOK,
+ ExpectBody: "hello world",
+ Sleep: base.SleepTime,
+ }),
+ table.Entry("update route methods to GET only", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodPut,
+ Path: "/apisix/admin/routes/r1",
+ Body: `{
+ "name": "route1",
+ "uri": "/hello",
+ "methods": ["GET"],
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": [{
+ "host": "172.16.238.20",
Review comment:
ditto
--
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 #1675: feat: rewrite e2e test(test-e2e-route-with-method) using ginkgo
Posted by GitBox <gi...@apache.org>.
codecov-io edited a comment on pull request #1675:
URL: https://github.com/apache/apisix-dashboard/pull/1675#issuecomment-808024334
# [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1675?src=pr&el=h1) Report
> Merging [#1675](https://codecov.io/gh/apache/apisix-dashboard/pull/1675?src=pr&el=desc) (a102197) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/88f323285f2bdbafca027da9aef357b2e3eb4008?el=desc) (88f3232) will **decrease** coverage by `20.60%`.
> The diff coverage is `n/a`.
[](https://codecov.io/gh/apache/apisix-dashboard/pull/1675?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #1675 +/- ##
===========================================
- Coverage 72.41% 51.81% -20.61%
===========================================
Files 133 38 -95
Lines 5728 2650 -3078
Branches 666 0 -666
===========================================
- Hits 4148 1373 -2775
+ Misses 1337 1089 -248
+ Partials 243 188 -55
```
| Flag | Coverage Δ | |
|---|---|---|
| backend-e2e-test | `?` | |
| backend-e2e-test-ginkgo | `?` | |
| backend-unit-test | `51.81% <ø> (ø)` | |
| 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/1675?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [api/internal/utils/version.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/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/1675/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/1675/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/1675/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/1675/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/1675/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/1675/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/1675/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/1675/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvaGFuZGxlci5nbw==) | `42.59% <0.00%> (-35.19%)` | :arrow_down: |
| [api/internal/handler/schema/schema.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvc2NoZW1hL3NjaGVtYS5nbw==) | `66.66% <0.00%> (-33.34%)` | :arrow_down: |
| ... and [119 more](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1675?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/1675?src=pr&el=footer). Last update [88f3232...a102197](https://codecov.io/gh/apache/apisix-dashboard/pull/1675?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] bisakhmondal commented on pull request #1675: feat: rewrite e2e test(test-e2e-route-with-method) using ginkgo
Posted by GitBox <gi...@apache.org>.
bisakhmondal commented on pull request #1675:
URL: https://github.com/apache/apisix-dashboard/pull/1675#issuecomment-809080765
Wonderful @Jaycean❤️. Thank you for the elaborated information.
So the whole time the 404 was thrown by upstream itself😶.
--
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 pull request #1675: feat: rewrite e2e test(test-e2e-route-with-method) using ginkgo
Posted by GitBox <gi...@apache.org>.
Jaycean commented on pull request #1675:
URL: https://github.com/apache/apisix-dashboard/pull/1675#issuecomment-809081483
> Wonderful @Jaycean. Thank you for the elaborated information.
> So the whole time the 404 was thrown by upstream itself.
Yes, after all, this upstream is just for testing
--
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] bisakhmondal commented on pull request #1675: feat: rewrite e2e test(test-e2e-route-with-method) using ginkgo
Posted by GitBox <gi...@apache.org>.
bisakhmondal commented on pull request #1675:
URL: https://github.com/apache/apisix-dashboard/pull/1675#issuecomment-808664239
Okay, @Jaycean, I'm opening an issue.
See the ci is also failing with a 404 for that particular test.

--
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 pull request #1675: feat: rewrite e2e test(test-e2e-route-with-method) using ginkgo
Posted by GitBox <gi...@apache.org>.
Jaycean commented on pull request #1675:
URL: https://github.com/apache/apisix-dashboard/pull/1675#issuecomment-808756397
> Okay, @Jaycean, I'm opening an issue.
> See the ci is also failing with a 404 for that particular test.
> 
I see this problem. Let me find out the reason.
--
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 #1675: feat: rewrite e2e test(test-e2e-route-with-method) using ginkgo
Posted by GitBox <gi...@apache.org>.
codecov-io commented on pull request #1675:
URL: https://github.com/apache/apisix-dashboard/pull/1675#issuecomment-808024334
# [Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1675?src=pr&el=h1) Report
> Merging [#1675](https://codecov.io/gh/apache/apisix-dashboard/pull/1675?src=pr&el=desc) (832ef22) into [master](https://codecov.io/gh/apache/apisix-dashboard/commit/88f323285f2bdbafca027da9aef357b2e3eb4008?el=desc) (88f3232) will **decrease** coverage by `5.40%`.
> The diff coverage is `n/a`.
> :exclamation: Current head 832ef22 differs from pull request most recent head 2c96d73. Consider uploading reports for the commit 2c96d73 to get more accurate results
[](https://codecov.io/gh/apache/apisix-dashboard/pull/1675?src=pr&el=tree)
```diff
@@ Coverage Diff @@
## master #1675 +/- ##
==========================================
- Coverage 72.41% 67.00% -5.41%
==========================================
Files 133 47 -86
Lines 5728 3116 -2612
Branches 666 0 -666
==========================================
- Hits 4148 2088 -2060
+ Misses 1337 783 -554
- Partials 243 245 +2
```
| Flag | Coverage Δ | |
|---|---|---|
| backend-e2e-test | `?` | |
| backend-e2e-test-ginkgo | `48.29% <ø> (-0.36%)` | :arrow_down: |
| backend-unit-test | `51.77% <ø> (-0.04%)` | :arrow_down: |
| 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/1675?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [api/internal/handler/data\_loader/route\_import.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvZGF0YV9sb2FkZXIvcm91dGVfaW1wb3J0Lmdv) | `32.25% <0.00%> (-32.67%)` | :arrow_down: |
| [api/internal/core/entity/entity.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvZW50aXR5L2VudGl0eS5nbw==) | `75.00% <0.00%> (-25.00%)` | :arrow_down: |
| [api/internal/handler/global\_rule/global\_rule.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvZ2xvYmFsX3J1bGUvZ2xvYmFsX3J1bGUuZ28=) | `66.12% <0.00%> (-17.75%)` | :arrow_down: |
| [api/internal/utils/utils.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL3V0aWxzL3V0aWxzLmdv) | `54.11% <0.00%> (-11.77%)` | :arrow_down: |
| [api/internal/route.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL3JvdXRlLmdv) | `76.47% <0.00%> (-8.83%)` | :arrow_down: |
| [api/cmd/managerapi.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2NtZC9tYW5hZ2VyYXBpLmdv) | `54.05% <0.00%> (-5.41%)` | :arrow_down: |
| [api/internal/core/store/storehub.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvc3RvcmVodWIuZ28=) | `67.28% <0.00%> (-3.74%)` | :arrow_down: |
| [api/internal/filter/schema.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2ZpbHRlci9zY2hlbWEuZ28=) | `52.10% <0.00%> (-3.37%)` | :arrow_down: |
| [api/internal/core/store/validate.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2NvcmUvc3RvcmUvdmFsaWRhdGUuZ28=) | `67.03% <0.00%> (-2.24%)` | :arrow_down: |
| [api/internal/handler/label/label.go](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree#diff-YXBpL2ludGVybmFsL2hhbmRsZXIvbGFiZWwvbGFiZWwuZ28=) | `80.18% <0.00%> (-1.89%)` | :arrow_down: |
| ... and [87 more](https://codecov.io/gh/apache/apisix-dashboard/pull/1675/diff?src=pr&el=tree-more) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/apisix-dashboard/pull/1675?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/1675?src=pr&el=footer). Last update [88f3232...2c96d73](https://codecov.io/gh/apache/apisix-dashboard/pull/1675?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] Jaycean commented on a change in pull request #1675: feat: rewrite e2e test(test-e2e-route-with-method) using ginkgo
Posted by GitBox <gi...@apache.org>.
Jaycean commented on a change in pull request #1675:
URL: https://github.com/apache/apisix-dashboard/pull/1675#discussion_r602737847
##########
File path: api/test/e2enew/route/route_with_methods_test.go
##########
@@ -0,0 +1,367 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package route
+
+import (
+ "net/http"
+
+ "github.com/onsi/ginkgo"
+ "github.com/onsi/ginkgo/extensions/table"
+
+ "github.com/apisix/manager-api/test/e2enew/base"
+)
+
+var _ = ginkgo.Describe("route with methods", func() {
+ table.DescribeTable("test route with methods",
+ func(tc base.HttpTestCase) {
+ base.RunTestCase(tc)
+ },
+ table.Entry("add route with invalid method", base.HttpTestCase{
+ Object: base.ManagerApiExpect(),
+ Method: http.MethodPut,
+ Path: "/apisix/admin/routes/r1",
+ Body: `{
+ "name": "route1",
+ "uri": "/hello",
+ "methods": ["TEST"],
+ "upstream": {
+ "type": "roundrobin",
+ "nodes": [{
+ "host": "172.16.238.20",
Review comment:
nodes host please use the base.UpstreamIp
```
"nodes": {
"` + base.UpstreamIp + `:1980": 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