mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
[test-integration] Migrate some more tests to cli
package
Add some required command operators to the `cli` package, and update some tests to use this package, in order to remove a few functions from `docker_utils_test.go` Signed-off-by: Vincent Demeester <vincent@sbr.pm>
This commit is contained in:
parent
dc1f036772
commit
eeaa6c96d8
15 changed files with 234 additions and 272 deletions
|
@ -15,6 +15,7 @@ import (
|
|||
"time"
|
||||
|
||||
"github.com/docker/docker/integration-cli/checker"
|
||||
"github.com/docker/docker/integration-cli/cli"
|
||||
"github.com/docker/docker/pkg/testutil"
|
||||
icmd "github.com/docker/docker/pkg/testutil/cmd"
|
||||
"github.com/docker/go-units"
|
||||
|
@ -29,12 +30,12 @@ func (s *DockerSuite) TestBuildResourceConstraintsAreUsed(c *check.C) {
|
|||
FROM hello-world:frozen
|
||||
RUN ["/hello"]
|
||||
`, map[string]string{})
|
||||
_, _, err := dockerCmdInDir(c, ctx.Dir, "build", "--no-cache", "--rm=false", "--memory=64m", "--memory-swap=-1", "--cpuset-cpus=0", "--cpuset-mems=0", "--cpu-shares=100", "--cpu-quota=8000", "--ulimit", "nofile=42", "-t", name, ".")
|
||||
if err != nil {
|
||||
c.Fatal(err)
|
||||
}
|
||||
cli.Docker(
|
||||
cli.Args("build", "--no-cache", "--rm=false", "--memory=64m", "--memory-swap=-1", "--cpuset-cpus=0", "--cpuset-mems=0", "--cpu-shares=100", "--cpu-quota=8000", "--ulimit", "nofile=42", "-t", name, "."),
|
||||
cli.InDir(ctx.Dir),
|
||||
).Assert(c, icmd.Success)
|
||||
|
||||
out, _ := dockerCmd(c, "ps", "-lq")
|
||||
out := cli.DockerCmd(c, "ps", "-lq").Combined()
|
||||
cID := strings.TrimSpace(out)
|
||||
|
||||
type hostConfig struct {
|
||||
|
@ -50,7 +51,7 @@ func (s *DockerSuite) TestBuildResourceConstraintsAreUsed(c *check.C) {
|
|||
cfg := inspectFieldJSON(c, cID, "HostConfig")
|
||||
|
||||
var c1 hostConfig
|
||||
err = json.Unmarshal([]byte(cfg), &c1)
|
||||
err := json.Unmarshal([]byte(cfg), &c1)
|
||||
c.Assert(err, checker.IsNil, check.Commentf(cfg))
|
||||
|
||||
c.Assert(c1.Memory, checker.Equals, int64(64*1024*1024), check.Commentf("resource constraints not set properly for Memory"))
|
||||
|
@ -63,7 +64,7 @@ func (s *DockerSuite) TestBuildResourceConstraintsAreUsed(c *check.C) {
|
|||
c.Assert(c1.Ulimits[0].Hard, checker.Equals, int64(42), check.Commentf("resource constraints not set properly for Ulimits"))
|
||||
|
||||
// Make sure constraints aren't saved to image
|
||||
dockerCmd(c, "run", "--name=test", name)
|
||||
cli.DockerCmd(c, "run", "--name=test", name)
|
||||
|
||||
cfg = inspectFieldJSON(c, "test", "HostConfig")
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue