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

Function TestDockerContainerByName

integration/tests/api/docker_test.go:89–109  ·  view source on GitHub ↗

A Docker container in /docker/

(t *testing.T)

Source from the content-addressed store, hash-verified

87
88// A Docker container in /docker/<name>
89func TestDockerContainerByName(t *testing.T) {
90 fm := framework.New(t)
91 defer fm.Cleanup()
92
93 containerName := fmt.Sprintf("test-docker-container-by-name-%d", os.Getpid())
94 fm.Docker().Run(framework.DockerRunArgs{
95 Image: "registry.k8s.io/pause",
96 Args: []string{"--name", containerName},
97 })
98
99 // Wait for the container to show up.
100 waitForContainer(containerName, fm)
101
102 request := &info.ContainerInfoRequest{
103 NumStats: 1,
104 }
105 containerInfo, err := fm.Cadvisor().Client().DockerContainer(containerName, request)
106 require.NoError(t, err)
107
108 sanityCheck(containerName, containerInfo, t)
109}
110
111// Find the first container with the specified alias in containers.
112func findContainer(alias string, containers []info.ContainerInfo, t *testing.T) info.ContainerInfo {

Callers

nothing calls this directly

Calls 9

NewFunction · 0.92
waitForContainerFunction · 0.85
sanityCheckFunction · 0.70
CleanupMethod · 0.65
RunMethod · 0.65
DockerMethod · 0.65
DockerContainerMethod · 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…