-
Notifications
You must be signed in to change notification settings - Fork 9.9k
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
Fix coverage failures #13693
Fix coverage failures #13693
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,29 +31,41 @@ import ( | |
) | ||
|
||
func TestSerializableReadWithoutQuorum(t *testing.T) { | ||
// Initialize a cluster with 3 members | ||
epc, err := e2e.InitEtcdProcessCluster(t, e2e.NewConfigAutoTLS()) | ||
if err != nil { | ||
t.Fatalf("Failed to initilize the etcd cluster: %v", err) | ||
tcs := []struct { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The change on the e2e test case looks good, but is it related to the the issue of coverage failure? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I won't ask change on this, but it would be better if we could only fix one thing in one PR next time. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The test |
||
name string | ||
testFunc func(cx ctlCtx) | ||
}{ | ||
{ | ||
name: "serializableReadTest", | ||
testFunc: serializableReadTest, | ||
}, | ||
{ | ||
name: "linearizableReadTest", | ||
testFunc: linearizableReadTest, | ||
}, | ||
} | ||
for _, tc := range tcs { | ||
t.Run(tc.name, func(t *testing.T) { | ||
// Initialize a cluster with 3 members | ||
epc, err := e2e.InitEtcdProcessCluster(t, e2e.NewConfigAutoTLS()) | ||
if err != nil { | ||
t.Fatalf("Failed to initilize the etcd cluster: %v", err) | ||
} | ||
|
||
// Remove two members, so that only one etcd will get started | ||
epc.Procs = epc.Procs[:1] | ||
// Remove two members, so that only one etcd will get started | ||
epc.Procs = epc.Procs[:1] | ||
|
||
// Start the etcd cluster with only one member | ||
if err := epc.Start(); err != nil { | ||
t.Fatalf("Failed to start the etcd cluster: %v", err) | ||
} | ||
|
||
// construct the ctl context | ||
cx := getDefaultCtlCtx(t) | ||
cx.epc = epc | ||
// Start the etcd cluster with only one member | ||
if err := epc.Start(); err != nil { | ||
t.Fatalf("Failed to start the etcd cluster: %v", err) | ||
} | ||
|
||
// run serializable test and wait for result | ||
runCtlTest(t, serializableReadTest, nil, cx) | ||
|
||
// run linearizable test and wait for result | ||
runCtlTest(t, linearizableReadTest, nil, cx) | ||
// construct the ctl context | ||
cx := getDefaultCtlCtx(t) | ||
cx.epc = epc | ||
runCtlTest(t, tc.testFunc, nil, cx) | ||
}) | ||
} | ||
} | ||
|
||
func serializableReadTest(cx ctlCtx) { | ||
|
@@ -65,7 +77,7 @@ func serializableReadTest(cx ctlCtx) { | |
|
||
func linearizableReadTest(cx ctlCtx) { | ||
cx.quorum = true | ||
if err := ctlV3Get(cx, []string{"key1"}, []kv{}...); err == nil { | ||
cx.t.Error("linearizableReadTest is expected to fail, but it succeeded") | ||
if err := ctlV3GetWithErr(cx, []string{"key"}, []string{"retrying of unary invoker failed"}); err != nil { // expect errors | ||
cx.t.Fatalf("ctlV3GetWithErr 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.
The change looks good.
But the directory change was made more than half year ago in this commit, why we do not see any issue in such a long time? cc @serathius @ptabor @spzala