TestGetAllContainerdContainers tests that cAdvisor can find multiple containerd containers.
(t *testing.T)
| 143 | |
| 144 | // TestGetAllContainerdContainers tests that cAdvisor can find multiple containerd containers. |
| 145 | func TestGetAllContainerdContainers(t *testing.T) { |
| 146 | fm := framework.New(t) |
| 147 | defer fm.Cleanup() |
| 148 | |
| 149 | // Start two containers |
| 150 | containerID1 := fm.Containerd().RunPause() |
| 151 | containerID2 := fm.Containerd().RunPause() |
| 152 | |
| 153 | // Wait for both containers to show up |
| 154 | waitForContainerdContainer(containerID1, fm) |
| 155 | waitForContainerdContainer(containerID2, fm) |
| 156 | |
| 157 | // Query all containers via SubcontainersInfo |
| 158 | allInfo, err := fm.Cadvisor().Client().SubcontainersInfo("/", &info.ContainerInfoRequest{ |
| 159 | NumStats: 1, |
| 160 | }) |
| 161 | require.NoError(t, err) |
| 162 | |
| 163 | // Find both containers |
| 164 | containerInfo1 := findContainerdContainer(containerID1, allInfo) |
| 165 | containerInfo2 := findContainerdContainer(containerID2, allInfo) |
| 166 | |
| 167 | require.NotNil(t, containerInfo1, "Container %q should be found in cAdvisor", containerID1) |
| 168 | require.NotNil(t, containerInfo2, "Container %q should be found in cAdvisor", containerID2) |
| 169 | |
| 170 | sanityCheckContainerd(containerID1, *containerInfo1, t) |
| 171 | sanityCheckContainerd(containerID2, *containerInfo2, t) |
| 172 | } |
| 173 | |
| 174 | // TestBasicContainerdContainer tests basic container properties. |
| 175 | func TestBasicContainerdContainer(t *testing.T) { |
nothing calls this directly
no test coverage detected
searching dependent graphs…