mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-10-08 14:29:45 +00:00
Add the resource version to api.*List items from etcd
Allows clients to watch more easily (can invoke Get, then Watch).
This commit is contained in:
@@ -66,6 +66,7 @@ func TestExtractList(t *testing.T) {
|
||||
fakeClient := NewFakeEtcdClient(t)
|
||||
fakeClient.Data["/some/key"] = EtcdResponseWithError{
|
||||
R: &etcd.Response{
|
||||
EtcdIndex: 10,
|
||||
Node: &etcd.Node{
|
||||
Nodes: []*etcd.Node{
|
||||
{
|
||||
@@ -92,10 +93,14 @@ func TestExtractList(t *testing.T) {
|
||||
|
||||
var got []api.Pod
|
||||
helper := EtcdHelper{fakeClient, codec, versioner}
|
||||
err := helper.ExtractList("/some/key", &got)
|
||||
resourceVersion := uint64(0)
|
||||
err := helper.ExtractList("/some/key", &got, &resourceVersion)
|
||||
if err != nil {
|
||||
t.Errorf("Unexpected error %#v", err)
|
||||
}
|
||||
if resourceVersion != 10 {
|
||||
t.Errorf("Unexpected resource version %d", resourceVersion)
|
||||
}
|
||||
|
||||
for i := 0; i < len(expect); i++ {
|
||||
if !reflect.DeepEqual(got[i], expect[i]) {
|
||||
|
Reference in New Issue
Block a user