From c123f7e8c5ef33406df48a41417c474c2f1ff787 Mon Sep 17 00:00:00 2001 From: Gyu-Ho Lee Date: Tue, 18 Oct 2016 16:05:02 -0700 Subject: [PATCH] clientv3/integration: test missing sort order get --- clientv3/integration/kv_test.go | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/clientv3/integration/kv_test.go b/clientv3/integration/kv_test.go index 4bdd5de62a6b..efaa337fd47a 100644 --- a/clientv3/integration/kv_test.go +++ b/clientv3/integration/kv_test.go @@ -226,6 +226,21 @@ func TestKVRange(t *testing.T) { {Key: []byte("fop"), Value: nil, CreateRevision: 9, ModRevision: 9, Version: 1}, }, }, + // range all with SortByKey, missing sorting order (ASCEND by default) + { + "a", "x", + 0, + []clientv3.OpOption{clientv3.WithSort(clientv3.SortByKey, clientv3.SortNone)}, + + []*mvccpb.KeyValue{ + {Key: []byte("a"), Value: nil, CreateRevision: 2, ModRevision: 2, Version: 1}, + {Key: []byte("b"), Value: nil, CreateRevision: 3, ModRevision: 3, Version: 1}, + {Key: []byte("c"), Value: nil, CreateRevision: 4, ModRevision: 6, Version: 3}, + {Key: []byte("foo"), Value: nil, CreateRevision: 7, ModRevision: 7, Version: 1}, + {Key: []byte("foo/abc"), Value: nil, CreateRevision: 8, ModRevision: 8, Version: 1}, + {Key: []byte("fop"), Value: nil, CreateRevision: 9, ModRevision: 9, Version: 1}, + }, + }, // range all with SortByCreateRevision, SortDescend { "a", "x", @@ -241,6 +256,21 @@ func TestKVRange(t *testing.T) { {Key: []byte("a"), Value: nil, CreateRevision: 2, ModRevision: 2, Version: 1}, }, }, + // range all with SortByCreateRevision, missing sorting order (ASCEND by default) + { + "a", "x", + 0, + []clientv3.OpOption{clientv3.WithSort(clientv3.SortByCreateRevision, clientv3.SortNone)}, + + []*mvccpb.KeyValue{ + {Key: []byte("a"), Value: nil, CreateRevision: 2, ModRevision: 2, Version: 1}, + {Key: []byte("b"), Value: nil, CreateRevision: 3, ModRevision: 3, Version: 1}, + {Key: []byte("c"), Value: nil, CreateRevision: 4, ModRevision: 6, Version: 3}, + {Key: []byte("foo"), Value: nil, CreateRevision: 7, ModRevision: 7, Version: 1}, + {Key: []byte("foo/abc"), Value: nil, CreateRevision: 8, ModRevision: 8, Version: 1}, + {Key: []byte("fop"), Value: nil, CreateRevision: 9, ModRevision: 9, Version: 1}, + }, + }, // range all with SortByModRevision, SortDescend { "a", "x",