A Docker container in /docker/
(t *testing.T)
| 87 | |
| 88 | // A Docker container in /docker/<name> |
| 89 | func 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. |
| 112 | func findContainer(alias string, containers []info.ContainerInfo, t *testing.T) info.ContainerInfo { |
nothing calls this directly
no test coverage detected
searching dependent graphs…