mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
fix(v2): Drop prevValue from exported fields
This commit is contained in:
parent
5edaee79e6
commit
0fb8fc0b8d
@ -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{})
|
||||
body := tests.ReadBody(resp)
|
||||
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)
|
||||
body := tests.ReadBodyJSON(resp)
|
||||
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)
|
||||
assert.Equal(t, body["action"], "compareAndSwap", "")
|
||||
node := body["node"].(map[string]interface{})
|
||||
assert.Equal(t, node["prevValue"], "XXX", "")
|
||||
assert.Equal(t, node["value"], "YYY", "")
|
||||
assert.Equal(t, node["modifiedIndex"], 3, "")
|
||||
})
|
||||
@ -240,7 +236,6 @@ func TestV2SetKeyCASOnValueSuccess(t *testing.T) {
|
||||
body := tests.ReadBodyJSON(resp)
|
||||
assert.Equal(t, body["action"], "compareAndSwap", "")
|
||||
node := body["node"].(map[string]interface{})
|
||||
assert.Equal(t, node["prevValue"], "XXX", "")
|
||||
assert.Equal(t, node["value"], "YYY", "")
|
||||
assert.Equal(t, node["modifiedIndex"], 3, "")
|
||||
})
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
// TTL is time to live in second
|
||||
type NodeExtern struct {
|
||||
Key string `json:"key, omitempty"`
|
||||
PrevValue string `json:"prevValue,omitempty"`
|
||||
PrevValue string `json:"-"`
|
||||
Value string `json:"value,omitempty"`
|
||||
Dir bool `json:"dir,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)
|
||||
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 {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
@ -43,7 +43,7 @@ func TestSingleNode(t *testing.T) {
|
||||
result, err = c.Set("foo", "bar", 100)
|
||||
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 {
|
||||
t.Fatal("Set 2: ", err)
|
||||
}
|
||||
@ -56,7 +56,7 @@ func TestSingleNode(t *testing.T) {
|
||||
result, err = c.CompareAndSwap("foo", "foobar", 100, "bar", 0)
|
||||
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 {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user