Commit 0d9f2dc5 authored by k8s-merge-robot's avatar k8s-merge-robot

Merge pull request #17081 from yujuhong/docker_tests

Auto commit by PR queue bot
parents 6ef6b9e0 543391f1
......@@ -66,6 +66,42 @@ func (f *FakeDockerClient) ClearCalls() {
f.Removed = []string{}
}
func (f *FakeDockerClient) SetFakeContainers(containers []*docker.Container) {
f.Lock()
defer f.Unlock()
// Reset the lists and the map.
f.ContainerMap = map[string]*docker.Container{}
f.ContainerList = []docker.APIContainers{}
f.ExitedContainerList = []docker.APIContainers{}
for i := range containers {
c := containers[i]
if c.Config == nil {
c.Config = &docker.Config{}
}
if c.HostConfig == nil {
c.HostConfig = &docker.HostConfig{}
}
f.ContainerMap[c.ID] = c
apiContainer := docker.APIContainers{
Names: []string{c.Name},
ID: c.ID,
}
if c.State.Running {
f.ContainerList = append(f.ContainerList, apiContainer)
} else {
f.ExitedContainerList = append(f.ExitedContainerList, apiContainer)
}
}
}
func (f *FakeDockerClient) SetFakeRunningContainers(containers []*docker.Container) {
for _, c := range containers {
c.State.Running = true
}
f.SetFakeContainers(containers)
}
func (f *FakeDockerClient) AssertCalls(calls []string) (err error) {
f.Lock()
defer f.Unlock()
......
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