SandboxInfo gets sandbox info.
(id string)
| 820 | |
| 821 | // SandboxInfo gets sandbox info. |
| 822 | func SandboxInfo(id string) (*runtime.PodSandboxStatus, *podsandboxtypes.SandboxInfo, error) { |
| 823 | client, conn, err := RawRuntimeClient() |
| 824 | if err != nil { |
| 825 | return nil, nil, fmt.Errorf("failed to get raw runtime client: %w", err) |
| 826 | } |
| 827 | defer conn.Close() |
| 828 | resp, err := client.PodSandboxStatus(context.Background(), &runtime.PodSandboxStatusRequest{ |
| 829 | PodSandboxId: id, |
| 830 | Verbose: true, |
| 831 | }) |
| 832 | if err != nil { |
| 833 | return nil, nil, fmt.Errorf("failed to get sandbox status: %w", err) |
| 834 | } |
| 835 | status := resp.GetStatus() |
| 836 | var info podsandboxtypes.SandboxInfo |
| 837 | if err := json.Unmarshal([]byte(resp.GetInfo()["info"]), &info); err != nil { |
| 838 | return nil, nil, fmt.Errorf("failed to unmarshal sandbox info: %w", err) |
| 839 | } |
| 840 | return status, &info, nil |
| 841 | } |
| 842 | |
| 843 | func RestartContainerd(t *testing.T, signal syscall.Signal) { |
| 844 | require.NoError(t, KillProcess(*containerdBin, signal)) |
no test coverage detected
searching dependent graphs…