-
Notifications
You must be signed in to change notification settings - Fork 539
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: rewrite e2e test(test-e2e-route-with-management-fields) using ginkgo #1704
feat: rewrite e2e test(test-e2e-route-with-management-fields) using ginkgo #1704
Conversation
"upstream": { | ||
"type": "roundrobin", | ||
"nodes": [{ | ||
"host": "172.16.238.20", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nodes host please use the base.UpstreamIp
"nodes": {
"` + base.UpstreamIp + `:1980": 1
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Done ✔️
Headers: map[string]string{"Authorization": base.GetToken()}, | ||
ExpectStatus: http.StatusOK, | ||
}) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After the route is deleted, we need to check whether the route is deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done ✔️
ci fails to pull docker images |
ok, just retrigger |
Method: http.MethodGet, | ||
Path: "/hello", | ||
Headers: map[string]string{"Authorization": base.GetToken()}, | ||
ExpectStatus: http.StatusNotFound, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better to check respond body for each case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done :)
Codecov Report
@@ Coverage Diff @@
## master #1704 +/- ##
===========================================
- Coverage 72.63% 52.29% -20.34%
===========================================
Files 133 38 -95
Lines 5740 2660 -3080
Branches 666 0 -666
===========================================
- Hits 4169 1391 -2778
+ Misses 1327 1081 -246
+ Partials 244 188 -56
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
}`, | ||
Headers: map[string]string{"Authorization": base.GetToken()}, | ||
ExpectStatus: http.StatusOK, | ||
Sleep: time.Duration(2) * time.Second, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to check body too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay. Just for this one or all other PUTs too
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Nic, just to make sure, the response body contains dynamic information like timestamp, do we really have to check the body?
However, I have added ExpectCode
as somewhat an alternative😄.
eg.
{
"code": 0,
"message": "",
"data": {
"id": "r1",
"create_time": 1617804834,
"update_time": 1617804834,
"uri": "/hello",
"name": "new jack",
"desc": "new desc",
"upstream": {
"nodes": {
"172.16.238.20:1980": 1
},
"type": "roundrobin"
},
"status": 1
},
"request_id": "22fbd110-3e00-4e2b-b267-528bdef67fd5"
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can test the fixed part, example:
ExpectBody: []string{`"code":0`, `"name":"new jack"`},
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool. Adding changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now, all tests with PUT request have been updated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
request.Header.Add("Authorization", base.GetToken()) | ||
resp, err := http.DefaultClient.Do(request) | ||
if err != nil { | ||
return |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can use gomega
to assert the err is nil.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah sure. Good catch.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done.Thank you for your contribution.
bf776f4
to
347d1e7
Compare
Please answer these questions before submitting a pull request, or your PR will get closed.
Why submit this pull request?
Related issues
#1500
Checklist: