-
Notifications
You must be signed in to change notification settings - Fork 9.8k
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
e2e: improve Lease coverage #9017
Conversation
Also test |
e2e/ctl_v3_auth_test.go
Outdated
} | ||
if !strings.Contains(line, "TTL(3s), remaining(0s)") { | ||
cx.t.Fatalf("expected 'TTL(3s), remaining(0s)', got %q", line) | ||
} |
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.
@gyuho why does this test pass? Are one of the CI checks running e2e against master?
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.
Seems like it just got lucky, it ran timetolive
command when TTL is <1-sec.
e2e/ctl_v3_auth_test.go
Outdated
if err := ctlV3Put(cx, "key", "val", leaseID); err != nil { | ||
cx.t.Fatalf("authLeaseTestTimeToLiveExpired: ctlV3Put error (%v)", err) | ||
} | ||
// eliminate false posative |
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.
typo?
e2e/ctl_v3_auth_test.go
Outdated
if err != nil { | ||
cx.t.Fatal(err) | ||
} | ||
line, err := proc.Expect(" granted with TTL(") |
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.
This should be matched by TTL(0s), remaining(-1s)
since we are testing the expired lease output.
@@ -73,6 +75,33 @@ func leaseTestGrantLeasesList(cx ctlCtx) { | |||
} | |||
} | |||
|
|||
func leaseTestTimeToLiveExpired(cx ctlCtx) { |
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.
Seems redundant with authLeaseTestTimeToLiveExpired
. Could this be simplified by sharing code with authLeaseTestTimeToLiveExpired
?
@gyuho thanks for review, will resolve. |
@gyuho PTAL, thanks. |
e2e/ctl_v3_lease_test.go
Outdated
return fmt.Errorf(fmt.Sprintf("expected '%s', got %q", e, line)) | ||
} | ||
if err := ctlV3Get(cx, []string{"key"}, kv{"key", ""}); err != nil { | ||
fmt.Errorf("leaseTestTimeToLiveExpired: ctlV3Get error (%v)", err) |
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.
Forgot to return this error?
ee329c0
to
8d0e777
Compare
@gyuho fixed PTAL |
2bc80d6
to
db908e2
Compare
Excuse the dust folks shaking off the rust a bit. \o/ |
e2e/ctl_v3_lease_test.go
Outdated
if err != nil { | ||
return err | ||
} | ||
line, err := proc.Expect(" granted with TTL(") |
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.
eventually we should return things like lease already expired
to explicitly return the error.
@hexfusion Thanks! LGTM. Defer to @gyuho |
Codecov Report
@@ Coverage Diff @@
## master #9017 +/- ##
==========================================
+ Coverage 76.12% 76.13% +<.01%
==========================================
Files 359 359
Lines 29838 29838
==========================================
+ Hits 22715 22717 +2
- Misses 5548 5551 +3
+ Partials 1575 1570 -5
Continue to review full report at Codecov.
|
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.
minor nits, and lgtm. Thanks!
e2e/ctl_v3_lease_test.go
Outdated
if err != nil { | ||
return err | ||
} | ||
line, err := proc.Expect(" granted with TTL(") |
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.
_, err := proc.Expect("TTL(0s), remaining(-1s)") // expect expired lease
and remove line 105-108?
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 good point, thanks.
db908e2
to
4b5b281
Compare
Could we fix https://travis-ci.org/coreos/etcd/jobs/318061698#L859? |
4b5b281
to
ed36728
Compare
Added tests to improve Lease coverage in e2e testing.
ref #9010