openfasttrace
openfasttrace copied to clipboard
`testReportService.testReportToIllegalPathThrowsReportExpection` fails when running in Docker
Description
The test TestReportService.testReportToIllegalPathThrowsReportExpection
fails when running in Docker since the process capability CAP_DAC_OVERRIDE
is set.
This occurs for example if someone tries to install OFT directly by cloning the GH repository in a Docker container. One of the integration tests requires that a r/o file is created in order to force an exception when writing a report. Since the CAP_DAC_OVERRIDE
is set, marking a file as r/o is simply ignored.
While that is a shortcoming on the Docker-side of the problem and installation from a Git clone is not the best idea, we still should skip the test in this scenario for maximum compatibility.
You can verify this outside of OFT by issuing
touch foo.txt
chmod a-w foo.txt
echo "more" >> foo.txt
This should fail, but it runs just fine.
If you enter
capsh --print
you get
Current: = cap_chown,cap_dac_override,cap_fowner,cap_fsetid,cap_kill,cap_setgid,cap_setuid,cap_setpcap,cap_net_bind_service,cap_net_raw,cap_sys_chroot,cap_mknod,cap_audit_write,cap_setfcap+eip
Steps to Reproduce
- Create a docker container from image "fedora 28" calling it
openfasttrace
- Run
docker exec -ti openfasttrace /bin/bash
- Test fails
Expected behavior
Test succeeds or is skipped.
Environment
- OFT: 2.0.3
- OS: Fedora release 28 (Twenty Eight), Linux 32bf15a4789c 4.18.14-200.fc28.x86_64 #1 SMP Mon Oct 15 13:16:27 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
- Java Version: OpenJDK Runtime Environment (build 1.8.0_181-b15)
- Maven Version (in case of build problems only): Apache Maven 3.5.2 (Red Hat 3.5.2-5)