fix(v2): Drop prevValue from exported fields
This commit is contained in:
@ -24,6 +24,6 @@ func TestV2DeleteKey(t *testing.T) {
|
|||||||
resp, err = tests.DeleteForm(fmt.Sprintf("%s%s", s.URL(), "/v2/keys/foo/bar"), url.Values{})
|
resp, err = tests.DeleteForm(fmt.Sprintf("%s%s", s.URL(), "/v2/keys/foo/bar"), url.Values{})
|
||||||
body := tests.ReadBody(resp)
|
body := tests.ReadBody(resp)
|
||||||
assert.Nil(t, err, "")
|
assert.Nil(t, err, "")
|
||||||
assert.Equal(t, string(body), `{"action":"delete","node":{"key":"/foo/bar","prevValue":"XXX","modifiedIndex":3,"createdIndex":2}}`, "")
|
assert.Equal(t, string(body), `{"action":"delete","node":{"key":"/foo/bar","modifiedIndex":3,"createdIndex":2}}`, "")
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -118,9 +118,6 @@ func TestV2UpdateKeySuccess(t *testing.T) {
|
|||||||
resp, _ = tests.PutForm(fmt.Sprintf("%s%s", s.URL(), "/v2/keys/foo/bar"), v)
|
resp, _ = tests.PutForm(fmt.Sprintf("%s%s", s.URL(), "/v2/keys/foo/bar"), v)
|
||||||
body := tests.ReadBodyJSON(resp)
|
body := tests.ReadBodyJSON(resp)
|
||||||
assert.Equal(t, body["action"], "update", "")
|
assert.Equal(t, body["action"], "update", "")
|
||||||
|
|
||||||
node := body["node"].(map[string]interface{})
|
|
||||||
assert.Equal(t, node["prevValue"], "XXX", "")
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -178,7 +175,6 @@ func TestV2SetKeyCASOnIndexSuccess(t *testing.T) {
|
|||||||
body := tests.ReadBodyJSON(resp)
|
body := tests.ReadBodyJSON(resp)
|
||||||
assert.Equal(t, body["action"], "compareAndSwap", "")
|
assert.Equal(t, body["action"], "compareAndSwap", "")
|
||||||
node := body["node"].(map[string]interface{})
|
node := body["node"].(map[string]interface{})
|
||||||
assert.Equal(t, node["prevValue"], "XXX", "")
|
|
||||||
assert.Equal(t, node["value"], "YYY", "")
|
assert.Equal(t, node["value"], "YYY", "")
|
||||||
assert.Equal(t, node["modifiedIndex"], 3, "")
|
assert.Equal(t, node["modifiedIndex"], 3, "")
|
||||||
})
|
})
|
||||||
@ -240,7 +236,6 @@ func TestV2SetKeyCASOnValueSuccess(t *testing.T) {
|
|||||||
body := tests.ReadBodyJSON(resp)
|
body := tests.ReadBodyJSON(resp)
|
||||||
assert.Equal(t, body["action"], "compareAndSwap", "")
|
assert.Equal(t, body["action"], "compareAndSwap", "")
|
||||||
node := body["node"].(map[string]interface{})
|
node := body["node"].(map[string]interface{})
|
||||||
assert.Equal(t, node["prevValue"], "XXX", "")
|
|
||||||
assert.Equal(t, node["value"], "YYY", "")
|
assert.Equal(t, node["value"], "YYY", "")
|
||||||
assert.Equal(t, node["modifiedIndex"], 3, "")
|
assert.Equal(t, node["modifiedIndex"], 3, "")
|
||||||
})
|
})
|
||||||
|
@ -10,7 +10,7 @@ import (
|
|||||||
// TTL is time to live in second
|
// TTL is time to live in second
|
||||||
type NodeExtern struct {
|
type NodeExtern struct {
|
||||||
Key string `json:"key, omitempty"`
|
Key string `json:"key, omitempty"`
|
||||||
PrevValue string `json:"prevValue,omitempty"`
|
PrevValue string `json:"-"`
|
||||||
Value string `json:"value,omitempty"`
|
Value string `json:"value,omitempty"`
|
||||||
Dir bool `json:"dir,omitempty"`
|
Dir bool `json:"dir,omitempty"`
|
||||||
Expiration *time.Time `json:"expiration,omitempty"`
|
Expiration *time.Time `json:"expiration,omitempty"`
|
||||||
|
@ -54,7 +54,7 @@ func templateTestSimpleMultiNode(t *testing.T, tls bool) {
|
|||||||
result, err = c.Set("foo", "bar", 100)
|
result, err = c.Set("foo", "bar", 100)
|
||||||
node = result.Node
|
node = result.Node
|
||||||
|
|
||||||
if err != nil || node.Key != "/foo" || node.Value != "bar" || node.PrevValue != "bar" || node.TTL < 95 {
|
if err != nil || node.Key != "/foo" || node.Value != "bar" || node.TTL < 95 {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -43,7 +43,7 @@ func TestSingleNode(t *testing.T) {
|
|||||||
result, err = c.Set("foo", "bar", 100)
|
result, err = c.Set("foo", "bar", 100)
|
||||||
node = result.Node
|
node = result.Node
|
||||||
|
|
||||||
if err != nil || node.Key != "/foo" || node.Value != "bar" || node.PrevValue != "bar" || node.TTL != 100 {
|
if err != nil || node.Key != "/foo" || node.Value != "bar" || node.TTL != 100 {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal("Set 2: ", err)
|
t.Fatal("Set 2: ", err)
|
||||||
}
|
}
|
||||||
@ -56,7 +56,7 @@ func TestSingleNode(t *testing.T) {
|
|||||||
result, err = c.CompareAndSwap("foo", "foobar", 100, "bar", 0)
|
result, err = c.CompareAndSwap("foo", "foobar", 100, "bar", 0)
|
||||||
node = result.Node
|
node = result.Node
|
||||||
|
|
||||||
if err != nil || node.Key != "/foo" || node.Value != "foobar" || node.PrevValue != "bar" || node.TTL != 100 {
|
if err != nil || node.Key != "/foo" || node.Value != "foobar" || node.TTL != 100 {
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user