Browse code

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 <askb23@gmail.com>

Anil Belur authored on 2016/03/09 21:30:56
Showing 1 changed files
... ...
@@ -3837,21 +3837,18 @@ USER root
3837 3837
 RUN [ "$(id -G):$(id -Gn)" = '0 10:root wheel' ]
3838 3838
 
3839 3839
 # Setup dockerio user and group
3840
-RUN echo 'dockerio:x:1001:1001::/bin:/bin/false' >> /etc/passwd
3841
-RUN echo 'dockerio:x:1001:' >> /etc/group
3840
+RUN echo 'dockerio:x:1001:1001::/bin:/bin/false' >> /etc/passwd && \
3841
+	echo 'dockerio:x:1001:' >> /etc/group
3842 3842
 
3843 3843
 # Make sure we can switch to our user and all the information is exactly as we expect it to be
3844 3844
 USER dockerio
3845
-RUN id -G
3846
-RUN id -Gn
3847 3845
 RUN [ "$(id -u):$(id -g)/$(id -un):$(id -gn)/$(id -G):$(id -Gn)" = '1001:1001/dockerio:dockerio/1001:dockerio' ]
3848 3846
 
3849 3847
 # Switch back to root and double check that worked exactly as we might expect it to
3850 3848
 USER root
3851
-RUN [ "$(id -u):$(id -g)/$(id -un):$(id -gn)/$(id -G):$(id -Gn)" = '0:0/root:root/0 10:root wheel' ]
3852
-
3853
-# Add a "supplementary" group for our dockerio user
3854
-RUN echo 'supplementary:x:1002:dockerio' >> /etc/group
3849
+RUN [ "$(id -u):$(id -g)/$(id -un):$(id -gn)/$(id -G):$(id -Gn)" = '0:0/root:root/0 10:root wheel' ] && \
3850
+	# Add a "supplementary" group for our dockerio user \
3851
+	echo 'supplementary:x:1002:dockerio' >> /etc/group
3855 3852
 
3856 3853
 # ... and then go verify that we get it like we expect
3857 3854
 USER dockerio