etcdctl: add --stream flag to get command#21747
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files
... and 21 files with indirect coverage changes @@ Coverage Diff @@
## main #21747 +/- ##
==========================================
- Coverage 70.29% 70.28% -0.02%
==========================================
Files 426 426
Lines 35215 35227 +12
==========================================
+ Hits 24754 24758 +4
+ Misses 9073 9072 -1
- Partials 1388 1397 +9 Continue to review full report in Codecov by Sentry.
🚀 New features to boost your workflow:
|
|
/retest |
|
/assign @serathius @fuweid |
| t.Run(fmt.Sprintf("Stream=%v", stream), func(t *testing.T) { | ||
| if !supportsGetStream || !rangeStreamSupports(tt.options) { | ||
| if !rangeStreamSupports(tt.options) { | ||
| t.Skip("Stream not supported") |
There was a problem hiding this comment.
In pull request, we only run few set of TestKVGet - E2E_TEST_MINIMAL=true
If we set it to false, the cluster will be mixed with old release one. It will return error like this.
match not found. Set EXPECT_DEBUG for more info Errs: [unexpected exit code [1] after running [/home/niuhechaofan/workspace/etcd/bin/etcdctl
--endpoints=http://localhost:20000,http://localhost:20005,http://localhost:20010 get c -w json --rev=6 -w fields --keys-only --stream -w json]], last lines:
Error: rpc error: code = Unimplemented desc = unknown method RangeStream for service etcdserverpb.KV
Test: TestKVGet/QuorumLastVersion/Get_third_version_of_'c'_by_its_revision_--keys-only/Stream=true
Messages: count not get key "c", err: match not found. Set EXPECT_DEBUG for more info Errs: [unexpected exit code [
There was a problem hiding this comment.
Nice catch, we run mixed version etcd clusters only in periodics.
There was a problem hiding this comment.
Thanks for flagging this. My thinking is that we can fetch the server version (via client.Status) and then only proceed with rangestream on >=3.7 to handle the mixed version case.
There was a problem hiding this comment.
we can fetch the server version (via client.Status)
Maybe we can go with this? the clusterSupportsGetStream will go through all the members with GetStream. If old member doesn't support it, it will return false.
func TestKVGet(t *testing.T) {
testKVGet(t, false)
}
func TestKVGetStream(t *testing.T) {
testKVGet(t, true)
}
func testKVGet(t *testing.T, stream bool) {
testRunner.BeforeTest(t)
for _, tc := range clusterTestCases() {
t.Run(tc.name, func(t *testing.T) {
ctx, cancel := context.WithTimeout(t.Context(), 30*time.Second)
defer cancel()
clus := testRunner.NewCluster(ctx, t, config.WithClusterConfig(tc.config))
defer clus.Close()
if stream && !clusterSupportsGetStream(t, clus) {
t.Skip("RangeStream is not supported by this cluster")
}
// ...Signed-off-by: Jefftree <jeffrey.ying86@live.com>
c926da1 to
695442b
Compare
|
/retest |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: fuweid, Jefftree, serathius The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Add --stream flag. Also removes the supportsGetStream variable since e2e now supports getStream.
e2e tests now exercise the streaming path (TestKVGet) so no new tests were added.