Skip to content

Commit 8e47b17

Browse files
committed
Fix failed v2 integration and e2e test cases
Signed-off-by: Benjamin Wang <[email protected]>
1 parent 87f5cb2 commit 8e47b17

File tree

2 files changed

+36
-36
lines changed

2 files changed

+36
-36
lines changed

tests/e2e/v2store_deprecation_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func assertVerifyCanStartV2deprecationNotYet(t testing.TB, dataDirPath string) {
5656

5757
if err := e2e.CURLGet(epc, e2e.CURLReq{
5858
Endpoint: "/v2/keys/foo",
59-
Expected: `{"action":"get","node":{"key":"/foo","value":"bar9","modifiedIndex":13,"createdIndex":13}}`}); err != nil {
59+
Expected: `{"action":"get","node":{"key":"/foo","value":"bar9","modifiedIndex":14,"createdIndex":14}}`}); err != nil {
6060
t.Fatalf("failed get with curl (%v)", err)
6161
}
6262

tests/integration/v2_http_kv_test.go

+35-35
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,19 @@ func TestV2Set(t *testing.T) {
5353
"/v2/keys/foo/bar",
5454
v,
5555
http.StatusCreated,
56-
`{"action":"set","node":{"key":"/foo/bar","value":"bar","modifiedIndex":4,"createdIndex":4}}`,
56+
`{"action":"set","node":{"key":"/foo/bar","value":"bar","modifiedIndex":5,"createdIndex":5}}`,
5757
},
5858
{
5959
"/v2/keys/foodir?dir=true",
6060
url.Values{},
6161
http.StatusCreated,
62-
`{"action":"set","node":{"key":"/foodir","dir":true,"modifiedIndex":5,"createdIndex":5}}`,
62+
`{"action":"set","node":{"key":"/foodir","dir":true,"modifiedIndex":6,"createdIndex":6}}`,
6363
},
6464
{
6565
"/v2/keys/fooempty",
6666
url.Values(map[string][]string{"value": {""}}),
6767
http.StatusCreated,
68-
`{"action":"set","node":{"key":"/fooempty","value":"","modifiedIndex":6,"createdIndex":6}}`,
68+
`{"action":"set","node":{"key":"/fooempty","value":"","modifiedIndex":7,"createdIndex":7}}`,
6969
},
7070
{
7171
"/v2/keys/foo/novalue",
@@ -250,12 +250,12 @@ func TestV2CAS(t *testing.T) {
250250
},
251251
{
252252
"/v2/keys/cas/foo",
253-
url.Values(map[string][]string{"value": {"YYY"}, "prevIndex": {"4"}}),
253+
url.Values(map[string][]string{"value": {"YYY"}, "prevIndex": {"5"}}),
254254
http.StatusOK,
255255
map[string]interface{}{
256256
"node": map[string]interface{}{
257257
"value": "YYY",
258-
"modifiedIndex": float64(5),
258+
"modifiedIndex": float64(6),
259259
},
260260
"action": "compareAndSwap",
261261
},
@@ -267,8 +267,8 @@ func TestV2CAS(t *testing.T) {
267267
map[string]interface{}{
268268
"errorCode": float64(101),
269269
"message": "Compare failed",
270-
"cause": "[10 != 5]",
271-
"index": float64(5),
270+
"cause": "[10 != 6]",
271+
"index": float64(6),
272272
},
273273
},
274274
{
@@ -317,7 +317,7 @@ func TestV2CAS(t *testing.T) {
317317
map[string]interface{}{
318318
"errorCode": float64(101),
319319
"message": "Compare failed",
320-
"cause": "[bad_value != ZZZ] [100 != 6]",
320+
"cause": "[bad_value != ZZZ] [100 != 7]",
321321
},
322322
},
323323
{
@@ -327,12 +327,12 @@ func TestV2CAS(t *testing.T) {
327327
map[string]interface{}{
328328
"errorCode": float64(101),
329329
"message": "Compare failed",
330-
"cause": "[100 != 6]",
330+
"cause": "[100 != 7]",
331331
},
332332
},
333333
{
334334
"/v2/keys/cas/foo",
335-
url.Values(map[string][]string{"value": {"XXX"}, "prevValue": {"bad_value"}, "prevIndex": {"6"}}),
335+
url.Values(map[string][]string{"value": {"XXX"}, "prevValue": {"bad_value"}, "prevIndex": {"7"}}),
336336
http.StatusPreconditionFailed,
337337
map[string]interface{}{
338338
"errorCode": float64(101),
@@ -342,7 +342,7 @@ func TestV2CAS(t *testing.T) {
342342
},
343343
{
344344
"/v2/keys/cas/foo",
345-
url.Values(map[string][]string{"value": {"YYY"}, "prevIndex": {"6"}, "noValueOnSuccess": {"true"}}),
345+
url.Values(map[string][]string{"value": {"YYY"}, "prevIndex": {"7"}, "noValueOnSuccess": {"true"}}),
346346
http.StatusOK,
347347
map[string]interface{}{
348348
"action": "compareAndSwap",
@@ -355,8 +355,8 @@ func TestV2CAS(t *testing.T) {
355355
map[string]interface{}{
356356
"errorCode": float64(101),
357357
"message": "Compare failed",
358-
"cause": "[10 != 7]",
359-
"index": float64(7),
358+
"cause": "[10 != 8]",
359+
"index": float64(8),
360360
},
361361
},
362362
}
@@ -509,7 +509,7 @@ func TestV2CAD(t *testing.T) {
509509
map[string]interface{}{
510510
"errorCode": float64(101),
511511
"message": "Compare failed",
512-
"cause": "[100 != 4]",
512+
"cause": "[100 != 5]",
513513
},
514514
},
515515
{
@@ -521,12 +521,12 @@ func TestV2CAD(t *testing.T) {
521521
},
522522
},
523523
{
524-
"/v2/keys/foo?prevIndex=4",
524+
"/v2/keys/foo?prevIndex=5",
525525
http.StatusOK,
526526
map[string]interface{}{
527527
"node": map[string]interface{}{
528528
"key": "/foo",
529-
"modifiedIndex": float64(6),
529+
"modifiedIndex": float64(7),
530530
},
531531
"action": "compareAndDelete",
532532
},
@@ -554,7 +554,7 @@ func TestV2CAD(t *testing.T) {
554554
map[string]interface{}{
555555
"node": map[string]interface{}{
556556
"key": "/foovalue",
557-
"modifiedIndex": float64(7),
557+
"modifiedIndex": float64(8),
558558
},
559559
"action": "compareAndDelete",
560560
},
@@ -596,7 +596,7 @@ func TestV2Unique(t *testing.T) {
596596
http.StatusCreated,
597597
map[string]interface{}{
598598
"node": map[string]interface{}{
599-
"key": "/foo/00000000000000000004",
599+
"key": "/foo/00000000000000000005",
600600
"value": "XXX",
601601
},
602602
"action": "create",
@@ -608,7 +608,7 @@ func TestV2Unique(t *testing.T) {
608608
http.StatusCreated,
609609
map[string]interface{}{
610610
"node": map[string]interface{}{
611-
"key": "/foo/00000000000000000005",
611+
"key": "/foo/00000000000000000006",
612612
"value": "XXX",
613613
},
614614
"action": "create",
@@ -620,7 +620,7 @@ func TestV2Unique(t *testing.T) {
620620
http.StatusCreated,
621621
map[string]interface{}{
622622
"node": map[string]interface{}{
623-
"key": "/bar/00000000000000000006",
623+
"key": "/bar/00000000000000000007",
624624
"value": "XXX",
625625
},
626626
"action": "create",
@@ -686,8 +686,8 @@ func TestV2Get(t *testing.T) {
686686
map[string]interface{}{
687687
"key": "/foo/bar",
688688
"dir": true,
689-
"createdIndex": float64(4),
690-
"modifiedIndex": float64(4),
689+
"createdIndex": float64(5),
690+
"modifiedIndex": float64(5),
691691
},
692692
},
693693
},
@@ -705,14 +705,14 @@ func TestV2Get(t *testing.T) {
705705
map[string]interface{}{
706706
"key": "/foo/bar",
707707
"dir": true,
708-
"createdIndex": float64(4),
709-
"modifiedIndex": float64(4),
708+
"createdIndex": float64(5),
709+
"modifiedIndex": float64(5),
710710
"nodes": []interface{}{
711711
map[string]interface{}{
712712
"key": "/foo/bar/zar",
713713
"value": "XXX",
714-
"createdIndex": float64(4),
715-
"modifiedIndex": float64(4),
714+
"createdIndex": float64(5),
715+
"modifiedIndex": float64(5),
716716
},
717717
},
718718
},
@@ -784,8 +784,8 @@ func TestV2QuorumGet(t *testing.T) {
784784
map[string]interface{}{
785785
"key": "/foo/bar",
786786
"dir": true,
787-
"createdIndex": float64(4),
788-
"modifiedIndex": float64(4),
787+
"createdIndex": float64(5),
788+
"modifiedIndex": float64(5),
789789
},
790790
},
791791
},
@@ -803,14 +803,14 @@ func TestV2QuorumGet(t *testing.T) {
803803
map[string]interface{}{
804804
"key": "/foo/bar",
805805
"dir": true,
806-
"createdIndex": float64(4),
807-
"modifiedIndex": float64(4),
806+
"createdIndex": float64(5),
807+
"modifiedIndex": float64(5),
808808
"nodes": []interface{}{
809809
map[string]interface{}{
810810
"key": "/foo/bar/zar",
811811
"value": "XXX",
812-
"createdIndex": float64(4),
813-
"modifiedIndex": float64(4),
812+
"createdIndex": float64(5),
813+
"modifiedIndex": float64(5),
814814
},
815815
},
816816
},
@@ -866,7 +866,7 @@ func TestV2Watch(t *testing.T) {
866866
"node": map[string]interface{}{
867867
"key": "/foo/bar",
868868
"value": "XXX",
869-
"modifiedIndex": float64(4),
869+
"modifiedIndex": float64(5),
870870
},
871871
"action": "set",
872872
}
@@ -888,7 +888,7 @@ func TestV2WatchWithIndex(t *testing.T) {
888888
var body map[string]interface{}
889889
c := make(chan bool, 1)
890890
go func() {
891-
resp, err := tc.Get(fmt.Sprintf("%s%s", u, "/v2/keys/foo/bar?wait=true&waitIndex=5"))
891+
resp, err := tc.Get(fmt.Sprintf("%s%s", u, "/v2/keys/foo/bar?wait=true&waitIndex=6"))
892892
if err != nil {
893893
t.Errorf("watch err = %v, want nil", err)
894894
}
@@ -934,7 +934,7 @@ func TestV2WatchWithIndex(t *testing.T) {
934934
"node": map[string]interface{}{
935935
"key": "/foo/bar",
936936
"value": "XXX",
937-
"modifiedIndex": float64(5),
937+
"modifiedIndex": float64(6),
938938
},
939939
"action": "set",
940940
}

0 commit comments

Comments
 (0)