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

Function TestContainerdContainerById

integration/tests/api/containerd_test.go:94–113  ·  view source on GitHub ↗

TestContainerdContainerById tests that cAdvisor can find a containerd container by its ID.

(t *testing.T)

Source from the content-addressed store, hash-verified

92
93// TestContainerdContainerById tests that cAdvisor can find a containerd container by its ID.
94func 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

Callers

nothing calls this directly

Calls 10

NewFunction · 0.92
findContainerdContainerFunction · 0.85
sanityCheckContainerdFunction · 0.85
CleanupMethod · 0.65
RunPauseMethod · 0.65
ContainerdMethod · 0.65
SubcontainersInfoMethod · 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…