Browse code

integration-cli: remove redundant logs from cp utils

Now that we marked these utilities as helpers, it should be
possible to find which test-case failed (if any), and we
can skip logging in the "happy path".

This makes these tests less noisy, which makes it easier
to find actually important information in the output:

--- PASS: TestDockerSuite/TestCpFromCaseC (0.96s)
docker_cli_cp_utils_test.go:244: checking that file "/tmp/test-cp-from-case-c450122079/file2" contains "file2\n"
docker_cli_cp_utils_test.go:192: running `docker cp 962b1f3311e742b0842e13b2ad350214cea25883999fd26e87e8c9ddf40d5eb4:/root/file1 /tmp/test-cp-from-case-c450122079/file2`
docker_cli_cp_utils_test.go:244: checking that file "/tmp/test-cp-from-case-c450122079/file2" contains "file1\n"

Some of these tests should probably be rewritten to use subtests,
but that's something for a follow-up.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>

Sebastiaan van Stijn authored on 2019/10/22 00:10:44
Showing 1 changed files
... ...
@@ -192,7 +192,6 @@ func containerCpPathTrailingSep(containerID string, pathElements ...string) stri
192 192
 
193 193
 func runDockerCp(c *testing.T, src, dst string) error {
194 194
 	c.Helper()
195
-	c.Logf("running `docker cp %s %s`", src, dst)
196 195
 
197 196
 	args := []string{"cp", src, dst}
198 197
 	if out, _, err := runCommandWithOutput(exec.Command(dockerBinary, args...)); err != nil {
... ...
@@ -203,7 +202,6 @@ func runDockerCp(c *testing.T, src, dst string) error {
203 203
 
204 204
 func startContainerGetOutput(c *testing.T, containerID string) (out string, err error) {
205 205
 	c.Helper()
206
-	c.Logf("running `docker start -a %s`", containerID)
207 206
 
208 207
 	args := []string{"start", "-a", containerID}
209 208
 
... ...
@@ -240,7 +238,6 @@ func isCpCannotCopyReadOnly(err error) bool {
240 240
 
241 241
 func fileContentEquals(c *testing.T, filename, contents string) error {
242 242
 	c.Helper()
243
-	c.Logf("checking that file %q contains %q\n", filename, contents)
244 243
 
245 244
 	fileBytes, err := ioutil.ReadFile(filename)
246 245
 	if err != nil {
... ...
@@ -261,7 +258,6 @@ func fileContentEquals(c *testing.T, filename, contents string) error {
261 261
 
262 262
 func symlinkTargetEquals(c *testing.T, symlink, expectedTarget string) error {
263 263
 	c.Helper()
264
-	c.Logf("checking that the symlink %q points to %q\n", symlink, expectedTarget)
265 264
 
266 265
 	actualTarget, err := os.Readlink(symlink)
267 266
 	if err != nil {
... ...
@@ -277,7 +273,6 @@ func symlinkTargetEquals(c *testing.T, symlink, expectedTarget string) error {
277 277
 
278 278
 func containerStartOutputEquals(c *testing.T, containerID, contents string) error {
279 279
 	c.Helper()
280
-	c.Logf("checking that container %q start output contains %q\n", containerID, contents)
281 280
 
282 281
 	out, err := startContainerGetOutput(c, containerID)
283 282
 	if err != nil {