(ctx context.Context, t *testing.T, containerID string, cmdArgs ...string)
| 289 | } |
| 290 | |
| 291 | func execContainerCmd(ctx context.Context, t *testing.T, containerID string, cmdArgs ...string) (string, error) { |
| 292 | t.Helper() |
| 293 | |
| 294 | execArgs := []string{"exec", containerID} |
| 295 | execArgs = append(execArgs, cmdArgs...) |
| 296 | t.Logf("exec cmd: docker %s", strings.Join(execArgs, " ")) |
| 297 | execCmd := exec.CommandContext(ctx, "docker", execArgs...) |
| 298 | out, err := execCmd.CombinedOutput() |
| 299 | if err != nil { |
| 300 | t.Logf("exec cmd failed: %s\n%s", err.Error(), string(out)) |
| 301 | } else { |
| 302 | t.Logf("exec cmd success: %s", out) |
| 303 | } |
| 304 | return strings.TrimSpace(string(out)), err |
| 305 | } |
no test coverage detected