Commit Graph

3 Commits

Author SHA1 Message Date
b08746e15a integration: add container.Exec()
Some test cases might need an ability to execute a command inside a
container (in order to analyse its output and/or exit code). It is a bit
complicated operation to do so using engine API. The function provided
aims to hide this complexity, making exec almost as simple as 'docker
exec'.

NOTE that the exec is synchronous, and command's stdin is closed.

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
Upstream-commit: 01143afe54f1be7308c5663a0cc110740626c62b
Component: engine
2018-02-19 11:25:11 -08:00
366c7398c0 Add WithNetworkMode, WithExposedPorts, WithTty, WithWorkingDir to container helper functions
Signed-off-by: Yong Tang <yong.tang.github@outlook.com>
Upstream-commit: eaa1a0c218454c7f102a1a56c657e806e30d1b1b
Component: engine
2018-02-13 15:45:40 +00:00
defd7909c5 Add an integration/internal/container helper package
To help creating/running/… containers using the client for test integration.
This should make test more readable and reduce duplication a bit.

Usage example

```
// Create a default container named foo
id1 := container.Create(t, ctx, client, container.WithName("foo"))
// Run a default container with a custom command
id2 := container.Run(t, ctx, client, container.WithCmd("echo", "hello world"))
```

Signed-off-by: Vincent Demeester <vincent@sbr.pm>
Upstream-commit: 0bb7d42b03bfb125cd50ab50dabe99726e66ab71
Component: engine
2018-02-10 17:29:38 +01:00