Skip to content

force inspect test format#34707

Merged
vieux merged 1 commit intomoby:masterfrom
vieux:force_format
Sep 5, 2017
Merged

force inspect test format#34707
vieux merged 1 commit intomoby:masterfrom
vieux:force_format

Conversation

@vieux
Copy link
Contributor

@vieux vieux commented Sep 1, 2017

depending of the docker cli version used, sometimes the result will be 5e+08 sometimes it will be
500000000

This update the test to force the use of a common output.

/cc @dnephin @andrewhsu @seemethere

Copy link
Member

@dnephin dnephin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess this works, so would something like this which removes the dependency on the client:

inspect, err := client.ContainerInspect(context.Background(), "test")
c.Assert(err, checker.IsNil)
c.Assert(inspect.HostConfig.NanoCPUs, checker.Equals, 500000000)

@seemethere
Copy link
Contributor

@seemethere
Copy link
Contributor

@vieux Tests still failed: https://jenkins.dockerproject.org/job/docker-integration-tests/111/execution/node/272/log/

00:46:28.249 ----------------------------------------------------------------------
00:46:28.249 FAIL: docker_cli_run_unix_test.go:1558: DockerSuite.TestRunWithNanoCPUs
00:46:28.249 
00:46:28.249 docker_cli_run_unix_test.go:1566:
00:46:28.249     cli.InspectCmd(c, "test", cli.Format("HostConfig.NanoCpus | printf \"%f\"")).Assert(c, icmd.Expected{
00:46:28.249         Out: "500000000.000000",
00:46:28.249     })
00:46:28.249 /go/src/github.com/docker/docker/vendor/github.com/gotestyourself/gotestyourself/icmd/command.go:61:
00:46:28.249     t.Fatalf("at %s:%d - %s\n", filepath.Base(file), line, err.Error())
00:46:28.249 ... Error: at cli.go:43 - 
00:46:28.249 Command:  /usr/local/cli/docker inspect --format {{HostConfig.NanoCpus | printf "%f"}} test
00:46:28.249 ExitCode: 64
00:46:28.249 Error:    exit status 64
00:46:28.249 Stdout:   
00:46:28.249 Stderr:   Template parsing error: template: :1: function "HostConfig" not defined
00:46:28.249 
00:46:28.249 
00:46:28.249 Failures:
00:46:28.249 ExitCode was 64 expected 0
00:46:28.249 Expected no error
00:46:28.249 
00:46:28.249 
00:46:28.815 
00:46:28.815 ----------------------------------------------------------------------
00:48:11.634 ----------------------------------------------------------------------
00:48:11.634 FAIL: docker_cli_update_unix_test.go:288: DockerSuite.TestUpdateWithNanoCPUs
00:48:11.634 
00:48:11.634 docker_cli_update_unix_test.go:300:
00:48:11.634     cli.InspectCmd(c, "top", cli.Format("HostConfig.NanoCpus | printf \"%f\"")).Assert(c, icmd.Expected{
00:48:11.634         Out: "500000000.000000",
00:48:11.634     })
00:48:11.634 /go/src/github.com/docker/docker/vendor/github.com/gotestyourself/gotestyourself/icmd/command.go:61:
00:48:11.634     t.Fatalf("at %s:%d - %s\n", filepath.Base(file), line, err.Error())
00:48:11.634 ... Error: at cli.go:43 - 
00:48:11.634 Command:  /usr/local/cli/docker inspect --format {{HostConfig.NanoCpus | printf "%f"}} top
00:48:11.634 ExitCode: 64
00:48:11.634 Error:    exit status 64
00:48:11.634 Stdout:   
00:48:11.634 Stderr:   Template parsing error: template: :1: function "HostConfig" not defined
00:48:11.634 
00:48:11.634 
00:48:11.634 Failures:
00:48:11.634 ExitCode was 64 expected 0
00:48:11.634 Expected no error
00:48:11.634 
00:48:11.634 
00:48:12.199 
00:48:12.199 ----------------------------------------------------------------------

@vieux
Copy link
Contributor Author

vieux commented Sep 1, 2017

@seemethere sorry I made a silly mistake, can you kick it again ?

@seemethere
Copy link
Contributor

seemethere commented Sep 1, 2017

Copy link
Contributor

@boaz0 boaz0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 LGTM

@vieux vieux force-pushed the force_format branch 2 times, most recently from 5ccd2de to 6a1bd65 Compare September 4, 2017 23:24
@vieux
Copy link
Contributor Author

vieux commented Sep 4, 2017

I rebased using @dnephin's solution.

@vdemeester
Copy link
Member

@vieux compilation error

23:44:43 integration-cli/docker_cli_run_unix_test.go:1567: undefined: client in client.ContainerInspect
23:44:43 integration-cli/docker_cli_run_unix_test.go:1576: no new variables on left side of :=
23:44:43 integration-cli/docker_cli_update_unix_test.go:299: undefined: client in client.ContainerInspect
23:44:43 integration-cli/docker_cli_update_unix_test.go:308: no new variables on left side of :=
23:44:43 integration-cli/docker_cli_update_unix_test.go:313: undefined: client in client.ContainerInspect

Signed-off-by: Victor Vieux <victorvieux@gmail.com>
@andrewhsu
Copy link
Contributor

@vieux
Copy link
Contributor Author

vieux commented Sep 5, 2017

@andrewhsu looks like it is indeed fixing tests in docker-ce

@dnephin can you review once more please ?

@seemethere
Copy link
Contributor

It indeed does look like it fixes the tests! We're down to 3.

❯ bash ~/scripts/check_failures.sh https://jenkins.dockerproject.org/job/docker-integration-tests/120/consoleText
FOR: https://jenkins.dockerproject.org/job/docker-integration-tests/120/consoleText

Passed (thought would fail):
DockerSuite.TestRunWithNanoCPUs
DockerSuite.TestUpdateWithNanoCPUs
DockerSwarmSuite.TestServiceLogs
DockerSwarmSuite.TestSwarmNetworkPluginV2
DockerSwarmSuite.TestSwarmServicePsMultipleServiceIDs

Failed (should fail)
DockerSuite.TestRmiContainerImageNotFound
DockerSuite.TestRmiImageIDForceWithRunningContainersAndMultipleTags
DockerSuite.TestRunAttachDetachFromInvalidFlag

Failed (thought would pass):

Copy link
Contributor

@seemethere seemethere left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@dnephin dnephin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🦁

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants