Skip to content

[test] Fix TestBuildApiDockerFileRemote#26720

Merged
thaJeztah merged 1 commit into
moby:masterfrom
AkihiroSuda:fix-TestBuildApiDockerFileRemote
Sep 20, 2016
Merged

[test] Fix TestBuildApiDockerFileRemote#26720
thaJeztah merged 1 commit into
moby:masterfrom
AkihiroSuda:fix-TestBuildApiDockerFileRemote

Conversation

@AkihiroSuda

Copy link
Copy Markdown
Member

- What I did
TestBuildApiDockerFileRemote has been consistently failing (EPERM) on the host with #26618, which prohibits /sys/firmware from being accessed using apparmor.
https://github.com/docker/docker/blob/8a46c18dd4e4f8091b9e02ef5b476e8b8aa77c47/integration-cli/docker_api_build_test.go#L19

RUN find / -name ba*
find: /sys/firmware/dmi: Permission denied
find: /sys/firmware/acpi: Permission denied
find: /sys/firmware/memmap: Permission denied

Replaces #26689

- How I did it
Add -xdev to find.

- How to verify it
Make sure the latest apparmor profile is installed to the host:

$ cat /etc/apparmor.d/docker
...
profile docker-default flags=(attach_disconnected,mediate_deleted) {
...
  deny /sys/firmware/** rwklx,
...
}

Then execute the test

$ TESTFLAGS='-check.f TestBuildApiDockerFileRemote' make test-integration-cli

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

Signed-off-by: Akihiro Suda [email protected]

@AkihiroSuda AkihiroSuda changed the title Fix TestBuildApiDockerFileRemote [test] Fix TestBuildApiDockerFileRemote Sep 19, 2016
@justincormack

Copy link
Copy Markdown
Contributor

LGTM

1 similar comment
@thaJeztah

Copy link
Copy Markdown
Member

LGTM

@AkihiroSuda

Copy link
Copy Markdown
Member Author

Strange error in windowsRS1??

13:13:54 FAIL: docker_api_build_test.go:14: DockerSuite.TestBuildApiDockerFileRemote
13:13:54 
13:13:54 docker_api_build_test.go:36:
13:13:54     c.Assert(out, checker.Contains, "/tmp/Dockerfile")
13:13:54 ... obtained string = "" +
13:13:54 ...     "{\"stream\":\"Step 1/4 : FROM busybox\\n\"}\r\n" +
13:13:54 ...     "{\"stream\":\" ---\\u003e 6c7af9e86fe5\\n\"}\r\n" +
13:13:54 ...     "{\"stream\":\"Step 2/4 : COPY * /tmp/\\n\"}\r\n" +
13:13:54 ...     "{\"stream\":\" ---\\u003e 07c0ac441b8c\\n\"}\r\n" +
13:13:54 ...     "{\"stream\":\"Removing intermediate container d5003c955d3c\\n\"}\r\n" +
13:13:54 ...     "{\"stream\":\"Step 3/4 : RUN find / -xdev -name ba*\\n\"}\r\n" +
13:13:54 ...     "{\"stream\":\" ---\\u003e Running in 54ba31540957\\n\"}\r\n" +
13:13:54 ...     "{\"stream\":\"\\u001b[91mfind: unrecognized: -xdev\\nBusyBox v1.26.0-FRP-484-g977d65c (2016-08-16 15:49:02 BST)\\u001b[0m\"}\r\n" +
13:13:54 ...     "{\"stream\":\"\\u001b[91m multi-call binary.\\n\\nUsage: \\u001b[0m\"}\r\n" +
13:13:54 ...     "{\"stream\":\"\\u001b[91mfind \\u001b[0m\"}\r\n" +
13:13:54 ...     "{\"stream\":\"\\u001b[91m[-HL] [PATH]... [OPTIONS] [ACTIONS]\\n\\nSearch for files and perform actions on them.\\nFirst failed action stops processing of current file.\\nDefaults: PATH is current directory, action is '-print'\\n\\n\\t-L,-follow\\tFollow symlinks\\n\\t-H\\t\\t...on command line only\\n\\t-maxdepth N\\tDescend at most N levels. -maxdepth 0 applies\\n\\t\\t\\tactions to command line arguments only\\n\\t-mindepth N\\tDon't act on first N levels\\n\\t-depth\\t\\tAct on directory *after* traversing it\\n\\nActions:\\n\\t( ACTIONS )\\tGroup actions for -o / -a\\n\\t! ACT\\t\\tInvert ACT's success/failure\\n\\tACT1 [-a] ACT2\\tIf ACT1 fails, stop, else do ACT2\\n\\tACT1 -o ACT2\\tIf ACT1 succeeds, stop, else do ACT2\\n\\t\\t\\tNote: -a has higher priority than -o\\n\\t-name PATTERN\\tMatch file name (w/o directory name) to PATTERN\\n\\t-iname PATTERN\\tCase insensitive -name\\n\\t-path PATTERN\\tMatch path to PATTERN\\n\\t-ipath PATTERN\\tCase insensitive -path\\n\\t-regex PATTERN\\tMatch path to regex PATTERN\\n\\t-type X\\t\\tFile type is X (one of: f,d,l,b,c,...)\\n\\t-perm MASK\\tAt least one mask bit (+MASK), all bits (-MASK),\\n\\t\\t\\tor exactly MASK bits are set in file's mode\\n\\t-mtime DAYS\\tmtime is greater than (+N), less than (-N),\\n\\t\\t\\tor exactly N days in the past\\n\\t-mmin MINS\\tmtime is greater than (+N), less than (-N),\\n\\t\\t\\tor exactly N minutes in the past\\n\\t-newer FILE\\tmtime is more recent than FILE's\\n\\t-size N[bck]\\tFile size is N (c:bytes,k:kbytes,b:512 bytes(def.))\\n\\t\\t\\t+/-N: file size is bigger/smaller than N\\n\\t-prune\\t\\tIf current file is directory, don't descend into it\\nIf none of the following actions is specified, -print is assumed\\n\\t-print\\t\\tPrint file name\\n\\t-print0\\t\\tPrint file name, NUL terminated\\n\\t-delete\\t\\tDelete current file/directory. Turns on -depth option\\n\\u001b[0m\"}\r\n" +
13:13:54 ...     "{\"errorDetail\":{\"code\":1,\"message\":\"The command 'cmd /S /C find / -xdev -name ba*' returned a non-zero code: 1\"},\"error\":\"The command 'cmd /S /C find / -xdev -name ba*' returned a non-zero code: 1\"}\r\n"
13:13:54 ... substring string = "/tmp/Dockerfile"
13:13:54 
13:13:54 
13:13:54 ----------------------------------------------------------------------

TestBuildApiDockerFileRemote has been consistently failing (EPERM) on the host
with moby#26618, which prohibits /sys/firmware from being accessed using apparmor.

Signed-off-by: Akihiro Suda <[email protected]>
@AkihiroSuda
AkihiroSuda force-pushed the fix-TestBuildApiDockerFileRemote branch from cea7a41 to f453261 Compare September 20, 2016 14:15
@AkihiroSuda

Copy link
Copy Markdown
Member Author

updated PR, hope CI passes..

@AkihiroSuda

Copy link
Copy Markdown
Member Author

windowsRS1 is now passing 😄

failure in win2lin is unrelated:

14:36:06 ----------------------------------------------------------------------
14:36:06 FAIL: docker_cli_build_test.go:498: DockerSuite.TestBuildCacheAdd
14:36:06 
14:36:06 docker_cli_build_test.go:514:
14:36:06     c.Fatal(err)
14:36:06 ... Error: failed to build the image: Sending build context to Docker daemon 2.048 kB

14:36:06 Step 1/2 : FROM scratch
14:36:06  ---> 
14:36:06 Step 2/2 : ADD http://10.0.0.16:32779/robots.txt /
14:36:06 Get http://10.0.0.16:32779/robots.txt: dial tcp 10.0.0.16:32779: getsockopt: connection refused
14:36:06 
14:36:06 
14:36:07 
14:36:07 ----------------------------------------------------------------------

@icecrime

Copy link
Copy Markdown
Contributor

Thanks @AkihiroSuda!

@thaJeztah

Copy link
Copy Markdown
Member

still LGTM

ping @jhowardmsft for the difference between busybox on Windows and on Linux

@thaJeztah

Copy link
Copy Markdown
Member

Merging, as the test that's fixed here passed on win2lin as well (and failure is unrelated, as @AkihiroSuda mentioned);

14:34:35 PASS: docker_api_build_test.go:14: DockerSuite.TestBuildApiDockerFileRemote    3.055s

@thaJeztah
thaJeztah merged commit 6eb6eaf into moby:master Sep 20, 2016
liusdu pushed a commit to liusdu/moby that referenced this pull request Oct 30, 2017
Fix flaky test: TestBuildApiDockerFileRemote

TestBuildApiDockerFileRemote has been consistently failing (EPERM) on the host
with moby#26618, which prohibits /sys/firmware from being accessed using apparmor.

Cherry-pick from moby#26720

fix issue moby#183 

Issues info:
Issue ID: 183
Title: flaky test: TestBuildApiDockerFileRemote
Issue url: moby#183

See merge request docker/docker!294
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.

5 participants