test add integration test
parent
ec175d4c47
commit
bd651edf80
|
@ -42,6 +42,7 @@ func TestV2GetKeyRecursively(t *testing.T) {
|
||||||
tests.RunServer(func(s *server.Server) {
|
tests.RunServer(func(s *server.Server) {
|
||||||
v := url.Values{}
|
v := url.Values{}
|
||||||
v.Set("value", "XXX")
|
v.Set("value", "XXX")
|
||||||
|
v.Set("ttl", "10")
|
||||||
resp, _ := tests.PutForm(fmt.Sprintf("http://%s%s", s.URL(), "/v2/keys/foo/x"), v)
|
resp, _ := tests.PutForm(fmt.Sprintf("http://%s%s", s.URL(), "/v2/keys/foo/x"), v)
|
||||||
tests.ReadBody(resp)
|
tests.ReadBody(resp)
|
||||||
|
|
||||||
|
@ -60,6 +61,7 @@ func TestV2GetKeyRecursively(t *testing.T) {
|
||||||
kv0 := body["kvs"].([]interface{})[0].(map[string]interface{})
|
kv0 := body["kvs"].([]interface{})[0].(map[string]interface{})
|
||||||
assert.Equal(t, kv0["key"], "/foo/x", "")
|
assert.Equal(t, kv0["key"], "/foo/x", "")
|
||||||
assert.Equal(t, kv0["value"], "XXX", "")
|
assert.Equal(t, kv0["value"], "XXX", "")
|
||||||
|
assert.Equal(t, kv0["ttl"], 10, "")
|
||||||
|
|
||||||
kv1 := body["kvs"].([]interface{})[1].(map[string]interface{})
|
kv1 := body["kvs"].([]interface{})[1].(map[string]interface{})
|
||||||
assert.Equal(t, kv1["key"], "/foo/y", "")
|
assert.Equal(t, kv1["key"], "/foo/y", "")
|
||||||
|
@ -105,7 +107,6 @@ func TestV2WatchKey(t *testing.T) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Ensures that a watcher can wait for a value to be set after a given index.
|
// Ensures that a watcher can wait for a value to be set after a given index.
|
||||||
//
|
//
|
||||||
// $ curl localhost:4001/v2/keys/foo/bar?wait=true&waitIndex=4
|
// $ curl localhost:4001/v2/keys/foo/bar?wait=true&waitIndex=4
|
||||||
|
@ -149,4 +150,3 @@ func TestV2WatchKeyWithIndex(t *testing.T) {
|
||||||
assert.Equal(t, body["term"], 0, "")
|
assert.Equal(t, body["term"], 0, "")
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue