-
Notifications
You must be signed in to change notification settings - Fork 54
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
feature: implemented new lease-related api #66
Conversation
@Yiyiyimu please take a look at the output of Travis-CI . |
Hi @membphis I'm still working on the errors of other etcd versions. Is there anyway to set it to WIP? Or I just need to convert it to draft? Also to deal with test in multi-version etcd locally, I'm trying to build dockerfile to automate the test process. Do you think that's necessary? Or that's not a big deal for others that building docker on my own is enough? |
@Yiyiyimu I have updated the title, you can continue your job now. you can remove |
Thank you @membphis ! Do you have any suggestions on test of multi-version etcd locally? |
we can run the specified etcd at our local machine, and try to find the bug. you can take a look at the travis script, it is useful. |
Fix two problems:
Actually leases() is supported in v3.3.12, as etcd documentation shows. Since currently we deploy v3.3.0, I test it only in v3.4.0 and add another file Considering this kind of problem could be common in the future, and this kind of naming is lack of readability, is there any need to build different branches in this repo according to different versions of etcd? |
Thank you @membphis it works! |
t/v3/lease.t
Outdated
local data, err = etcd:get("/test") | ||
check_res(data, err, "abc") | ||
|
||
ngx.sleep(2.5) |
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.
should get the val between seted and expired, such as 1 or 1.5 second after seated.
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.
fixed
t/v3/lease.t
Outdated
local res, err = etcd:grant(5) | ||
check_res(res, err) | ||
|
||
local data, err = etcd:set("/test", "abc", {prev_kv = true, lease = res.body.ID}) |
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 more keys to test
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.
Fixed. Test on attaching multiple keys to one lease, and using revoke to delete them all.
t/v3/lease.t
Outdated
check_res(data, err) | ||
|
||
ngx.sleep(1) | ||
if tonumber(data.body.TTL) < 5 then |
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.
Why compare after slept? I’m confused about this.
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.
It's my fault. I add sleep after the comparison but forget to delete the comparison.
Also, I changed testing logic here from read TTL parameter to get key after default expired time.
t/v3/lease.t
Outdated
local res, err = etcd:grant(5) | ||
check_res(res, err) | ||
|
||
local data, err = etcd:set("/test", "abc", {prev_kv = true, lease = res.body.ID}) |
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 more keys 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.
Fixed. Test on separately attaching two keys to two leases, keepalive one and to see if one alive and another one expired.
Improve test file in:
It seems one v2 test file which I seems didn't change failed, I'll have a look on it. |
Same with #12 |
Do we need to add the response structure of each API in doc, like only the body part, as mentioned in #37 For example
and
|
it is better to add |
Sure I'll create another PR for this change. |
@Yiyiyimu many thx |
* implement lease related func and test files * add lease documentation * fix naming typo of txn test file * remove extra layer and fix formatting * multiversion adaptation * improved test file * same with api7#12 * add demo in doc
Fix #65
also fixed a naming typo