{"action":"opened","issue":{"url":"https://api.github.com/repos/GoogleContainerTools/container-structure-test/issues/182","repository_url":"https://api.github.com/repos/GoogleContainerTools/container-structure-test","labels_url":"https://api.github.com/repos/GoogleContainerTools/container-structure-test/issues/182/labels{/name}","comments_url":"https://api.github.com/repos/GoogleContainerTools/container-structure-test/issues/182/comments","events_url":"https://api.github.com/repos/GoogleContainerTools/container-structure-test/issues/182/events","html_url":"https://github.com/GoogleContainerTools/container-structure-test/issues/182","id":380669937,"node_id":"MDU6SXNzdWUzODA2Njk5Mzc=","number":182,"title":"File existence tests do not follow symlinks","user":{"login":"bgauduch","id":5585755,"node_id":"MDQ6VXNlcjU1ODU3NTU=","avatar_url":"https://avatars0.githubusercontent.com/u/5585755?v=4","gravatar_id":"","url":"https://api.github.com/users/bgauduch","html_url":"https://github.com/bgauduch","followers_url":"https://api.github.com/users/bgauduch/followers","following_url":"https://api.github.com/users/bgauduch/following{/other_user}","gists_url":"https://api.github.com/users/bgauduch/gists{/gist_id}","starred_url":"https://api.github.com/users/bgauduch/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bgauduch/subscriptions","organizations_url":"https://api.github.com/users/bgauduch/orgs","repos_url":"https://api.github.com/users/bgauduch/repos","events_url":"https://api.github.com/users/bgauduch/events{/privacy}","received_events_url":"https://api.github.com/users/bgauduch/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":0,"created_at":"2018-11-14T12:10:29Z","updated_at":"2018-11-14T12:10:29Z","closed_at":null,"author_association":"NONE","body":"Hello 👋 \r\n\r\nI am using `fileExistenceTest` to validate Apache 2 module are present on an alpine image, but it looks like it doesn't follow symlinks.\r\nOn Alpine, Apache modules are installed in `/usr/lib/apache2` directory, and symlinked to `/var/www/modules` by default.\r\n\r\n### Dockerfile:\r\n```dockerfile\r\nFROM alpine:3.8\r\nRUN apk add --no-cache  apache2=2.4.35-r0\r\n```\r\n\r\n### Apache 2 module configuration:\r\n```bash\r\n# stripped down to only 1 module for clarity\r\nLoadModule macro_module modules/mod_macro.so\r\n```\r\n\r\n### Test module presence with `apache_file_tests.yaml`:\r\n```yaml\r\nschemaVersion: \"2.0.0\"\r\n\r\nfileExistenceTests:\r\n  - name: 'check module macro is installed'\r\n    path: '/usr/lib/apache2/mod_macro.so'\r\n    shouldExist: true\r\n```\r\n\r\n### Structure test command:\r\n```bash\r\ntest docker/apache test/apache_file_tests.yaml\r\n```\r\n\r\n### Expected behavior is Test: PASS, but I get:\r\n```bash\r\nINFO: File Existence Test: check module macro is installed\r\ntime=\"2018-11-14T11:54:27Z\" level=info msg=\"Removing image filesystem directory /tmp/git.int.rcacloud.it:4567dockerapache@sha256:089d7cdd6ec79105ae70225a344f7d760eae700af647665adb1bd0ff484a2f0f280365698 from system\"\r\n=== RUN: File Existence Test: check module macro is installed\r\n--- FAIL\r\nError: Error examining file in container: stat /tmp/git.int.rcacloud.it:4567dockerapache@sha256:089d7cdd6ec79105ae70225a344f7d760eae700af647665adb1bd0ff484a2f0f280365698/var/www/modules/mod_macro.so: no such file or directory\r\n```\r\n\r\n### Test without symlink pass without issue:\r\n```yaml\r\nschemaVersion: \"2.0.0\"\r\n\r\nfileExistenceTests:\r\n  - name: 'check module macro is installed'\r\n    path: '/var/www/modules/mod_macro.so'\r\n    shouldExist: true\r\n```\r\n```bash\r\nINFO: File Existence Test: check module macro is installed\r\ntime=\"2018-11-14T11:54:26Z\" level=info msg=\"Removing image filesystem directory /tmp/git.int.rcacloud.it:4567dockerapache@sha256:089d7cdd6ec79105ae70225a344f7d760eae700af647665adb1bd0ff484a2f0f276330479 from system\"\r\n=== RUN: File Existence Test: check module macro is installed\r\n--- PASS\r\n```\r\n\r\n### Content of folder `/var/www` inside running container\r\nSymlinks are present as expected inside running container from the Dockerfile.\r\n```bash\r\n# ls -la /var/www/\r\ntotal 12\r\ndrwxr-xr-x    3 root     root          4096 Nov 14 11:32 .\r\ndrwxr-xr-x    1 root     root          4096 Nov 14 11:32 ..\r\ndrwxr-xr-x    4 root     root          4096 Nov 14 11:32 localhost\r\nlrwxrwxrwx    1 root     root            16 Nov 14 11:32 logs -> /var/log/apache2\r\nlrwxrwxrwx    1 root     root            16 Nov 14 11:32 modules -> /usr/lib/apache2\r\nlrwxrwxrwx    1 root     root            12 Nov 14 11:32 run -> /run/apache2\r\n```\r\n\r\n### Additional informations\r\nWhen exploring the temporary filesystem used by structure test (using --save flag and a temp volume mount), the symlinks are not present."}}
{"actor":{"display_login":"bgauduch"}}