From deeb5c95e2eaa58d4490cb126839b8bc41e5ba08 Mon Sep 17 00:00:00 2001 From: Anil Belur Date: Wed, 9 Mar 2016 18:00:56 +0530 Subject: [PATCH] Optimized integration test case DockerSuite.TestBuildUsersAndGroups for #19425 Removed unnecessary RUN statements and combined some of the RUN statement into a single line. The runtime performance is seen as follows: pre-change: PASS: docker_cli_build_test.go:3826: DockerSuite.TestBuildUsersAndGroups 63.074s post-change: PASS: docker_cli_build_test.go:3826: DockerSuite.TestBuildUsersAndGroups 49.698s Signed-off-by: Anil Belur --- integration-cli/docker_cli_build_test.go | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/integration-cli/docker_cli_build_test.go b/integration-cli/docker_cli_build_test.go index 88024c28e8..4610853f0c 100644 --- a/integration-cli/docker_cli_build_test.go +++ b/integration-cli/docker_cli_build_test.go @@ -3837,21 +3837,18 @@ USER root RUN [ "$(id -G):$(id -Gn)" = '0 10:root wheel' ] # Setup dockerio user and group -RUN echo 'dockerio:x:1001:1001::/bin:/bin/false' >> /etc/passwd -RUN echo 'dockerio:x:1001:' >> /etc/group +RUN echo 'dockerio:x:1001:1001::/bin:/bin/false' >> /etc/passwd && \ + echo 'dockerio:x:1001:' >> /etc/group # Make sure we can switch to our user and all the information is exactly as we expect it to be USER dockerio -RUN id -G -RUN id -Gn RUN [ "$(id -u):$(id -g)/$(id -un):$(id -gn)/$(id -G):$(id -Gn)" = '1001:1001/dockerio:dockerio/1001:dockerio' ] # Switch back to root and double check that worked exactly as we might expect it to USER root -RUN [ "$(id -u):$(id -g)/$(id -un):$(id -gn)/$(id -G):$(id -Gn)" = '0:0/root:root/0 10:root wheel' ] - -# Add a "supplementary" group for our dockerio user -RUN echo 'supplementary:x:1002:dockerio' >> /etc/group +RUN [ "$(id -u):$(id -g)/$(id -un):$(id -gn)/$(id -G):$(id -Gn)" = '0:0/root:root/0 10:root wheel' ] && \ + # Add a "supplementary" group for our dockerio user \ + echo 'supplementary:x:1002:dockerio' >> /etc/group # ... and then go verify that we get it like we expect USER dockerio