Waits up to 5s for a container with the specified alias to appear.
(alias string, fm framework.Framework)
| 50 | |
| 51 | // Waits up to 5s for a container with the specified alias to appear. |
| 52 | func waitForContainer(alias string, fm framework.Framework) { |
| 53 | err := framework.RetryForDuration(func() error { |
| 54 | ret, err := fm.Cadvisor().Client().DockerContainer(alias, &info.ContainerInfoRequest{ |
| 55 | NumStats: 1, |
| 56 | }) |
| 57 | if err != nil { |
| 58 | return err |
| 59 | } |
| 60 | if len(ret.Stats) != 1 { |
| 61 | return fmt.Errorf("no stats returned for container %q", alias) |
| 62 | } |
| 63 | |
| 64 | return nil |
| 65 | }, 5*time.Second) |
| 66 | require.NoError(fm.T(), err, "Timed out waiting for container %q to be available in cAdvisor: %v", alias, err) |
| 67 | } |
| 68 | |
| 69 | // A Docker container in /docker/<ID> |
| 70 | func TestDockerContainerById(t *testing.T) { |
no test coverage detected
searching dependent graphs…