MCPcopy
hub / github.com/google/cadvisor / TestGetAllDockerContainers

Function TestGetAllDockerContainers

integration/tests/api/docker_test.go:125–146  ·  view source on GitHub ↗

All Docker containers through /docker

(t *testing.T)

Source from the content-addressed store, hash-verified

123
124// All Docker containers through /docker
125func TestGetAllDockerContainers(t *testing.T) {
126 fm := framework.New(t)
127 defer fm.Cleanup()
128
129 // Wait for the containers to show up.
130 containerID1 := fm.Docker().RunPause()
131 containerID2 := fm.Docker().RunPause()
132 waitForContainer(containerID1, fm)
133 waitForContainer(containerID2, fm)
134
135 request := &info.ContainerInfoRequest{
136 NumStats: 1,
137 }
138 containersInfo, err := fm.Cadvisor().Client().AllDockerContainers(request)
139 require.NoError(t, err)
140
141 if len(containersInfo) < 2 {
142 t.Fatalf("At least 2 Docker containers should exist, received %d: %+v", len(containersInfo), containersInfo)
143 }
144 sanityCheck(containerID1, findContainer(containerID1, containersInfo, t), t)
145 sanityCheck(containerID2, findContainer(containerID2, containersInfo, t), t)
146}
147
148// Check expected properties of a Docker container.
149func TestBasicDockerContainer(t *testing.T) {

Callers

nothing calls this directly

Calls 10

NewFunction · 0.92
waitForContainerFunction · 0.85
findContainerFunction · 0.85
sanityCheckFunction · 0.70
CleanupMethod · 0.65
RunPauseMethod · 0.65
DockerMethod · 0.65
AllDockerContainersMethod · 0.65
ClientMethod · 0.65
CadvisorMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…