TestContainerdContainerById tests that cAdvisor can find a containerd container by its ID.
(t *testing.T)
| 92 | |
| 93 | // TestContainerdContainerById tests that cAdvisor can find a containerd container by its ID. |
| 94 | func TestContainerdContainerById(t *testing.T) { |
| 95 | fm := framework.New(t) |
| 96 | defer fm.Cleanup() |
| 97 | |
| 98 | containerID := fm.Containerd().RunPause() |
| 99 | |
| 100 | // Wait for the container to show up in cAdvisor |
| 101 | waitForContainerdContainer(containerID, fm) |
| 102 | |
| 103 | // Query all containers via SubcontainersInfo |
| 104 | allInfo, err := fm.Cadvisor().Client().SubcontainersInfo("/", &info.ContainerInfoRequest{ |
| 105 | NumStats: 1, |
| 106 | }) |
| 107 | require.NoError(t, err) |
| 108 | |
| 109 | // Find our container |
| 110 | containerInfo := findContainerdContainer(containerID, allInfo) |
| 111 | require.NotNil(t, containerInfo, "Container %q should be found in cAdvisor", containerID) |
| 112 | sanityCheckContainerd(containerID, *containerInfo, t) |
| 113 | } |
| 114 | |
| 115 | // TestContainerdContainerByName tests that cAdvisor can find a containerd container by a custom hex ID. |
| 116 | // Note: cAdvisor's containerd handler expects 64-char hex container IDs, which is the standard format |
nothing calls this directly
no test coverage detected
searching dependent graphs…