Commit 37273693 authored by Random-Liu's avatar Random-Liu

Fix bug in dockershim to set sandbox id properly.

parent 56be1976
......@@ -56,14 +56,16 @@ func toRuntimeAPIContainer(c *dockertypes.Container) (*runtimeApi.Container, err
return nil, err
}
labels, annotations := extractLabels(c.Labels)
sandboxID := c.Labels[sandboxIDLabelKey]
return &runtimeApi.Container{
Id: &c.ID,
Metadata: metadata,
Image: &runtimeApi.ImageSpec{Image: &c.Image},
ImageRef: &c.ImageID,
State: &state,
Labels: labels,
Annotations: annotations,
Id: &c.ID,
PodSandboxId: &sandboxID,
Metadata: metadata,
Image: &runtimeApi.ImageSpec{Image: &c.Image},
ImageRef: &c.ImageID,
State: &state,
Labels: labels,
Annotations: annotations,
}, nil
}
......
......@@ -73,13 +73,14 @@ func TestListContainers(t *testing.T) {
// Prepend to the expected list because ListContainers returns
// the most recent containers first.
expected = append([]*runtimeApi.Container{{
Metadata: configs[i].Metadata,
Id: &id,
State: &state,
Image: configs[i].Image,
ImageRef: &imageRef,
Labels: configs[i].Labels,
Annotations: configs[i].Annotations,
Metadata: configs[i].Metadata,
Id: &id,
PodSandboxId: &sandboxID,
State: &state,
Image: configs[i].Image,
ImageRef: &imageRef,
Labels: configs[i].Labels,
Annotations: configs[i].Annotations,
}}, expected...)
}
containers, err := ds.ListContainers(nil)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment