Check expected properties of a Docker container.
(t *testing.T)
| 147 | |
| 148 | // Check expected properties of a Docker container. |
| 149 | func TestBasicDockerContainer(t *testing.T) { |
| 150 | fm := framework.New(t) |
| 151 | defer fm.Cleanup() |
| 152 | |
| 153 | containerName := fmt.Sprintf("test-basic-docker-container-%d", os.Getpid()) |
| 154 | containerID := fm.Docker().Run(framework.DockerRunArgs{ |
| 155 | Image: "registry.k8s.io/pause", |
| 156 | Args: []string{ |
| 157 | "--name", containerName, |
| 158 | }, |
| 159 | }) |
| 160 | |
| 161 | // Wait for the container to show up. |
| 162 | waitForContainer(containerID, fm) |
| 163 | |
| 164 | request := &info.ContainerInfoRequest{ |
| 165 | NumStats: 1, |
| 166 | } |
| 167 | containerInfo, err := fm.Cadvisor().Client().DockerContainer(containerID, request) |
| 168 | require.NoError(t, err) |
| 169 | |
| 170 | // Check that the container is known by both its name and ID. |
| 171 | sanityCheck(containerID, containerInfo, t) |
| 172 | sanityCheck(containerName, containerInfo, t) |
| 173 | |
| 174 | assert.Empty(t, containerInfo.Subcontainers, "Should not have subcontainers") |
| 175 | assert.Len(t, containerInfo.Stats, 1, "Should have exactly one stat") |
| 176 | } |
| 177 | |
| 178 | // TODO(vmarmol): Handle if CPU or memory is not isolated on this system. |
| 179 | // Check the ContainerSpec. |
nothing calls this directly
no test coverage detected
searching dependent graphs…