Closed Jongy closed 7 months ago
I will also run one negative test - undo the fix and ensure that the new test fails.
Commenting-out the fixing code in the plugin - the tests fail as expected.
tests/test_java.py::test_java_noexec_or_ro_dirs[on_host-noexec] PASSED [ 25%]
tests/test_java.py::test_java_noexec_or_ro_dirs[on_host-ro] FAILED [ 50%]
tests/test_java.py::test_java_noexec_or_ro_dirs[in_container-noexec] PASSED [ 75%]
tests/test_java.py::test_java_noexec_or_ro_dirs[in_container-ro] FAILED
Traceback (most recent call last):
File "/Granulate/gprofiler/gprofiler/profilers/profiler_base.py", line 132, in _wait_for_profiles
result = future.result()
File "/usr/lib/python3.8/concurrent/futures/_base.py", line 437, in result
return self.__get_result()
File "/usr/lib/python3.8/concurrent/futures/_base.py", line 389, in __get_result
result = self.fn(*self.args, **self.kwargs) [98/1807]
File "/Granulate/gprofiler/gprofiler/profilers/java.py", line 1211, in _profile_process
with AsyncProfiledProcess(
File "/Granulate/gprofiler/gprofiler/profilers/java.py", line 498, in __init__
self._ap_dir_base = self._find_rw_exec_dir()
File "/Granulate/gprofiler/gprofiler/profilers/java.py", line 545, in _find_rw_exec_dir
mkdir_owned_root(full_dir)
File "/Granulate/gprofiler/gprofiler/utils/fs.py", line 91, in mkdir_owned_root
os.mkdir(path, mode=mode)
OSError: [Errno 30] Read-only file system: '/proc/1/root/tmp/pytest-of-root/pytest-22/test_java_noexec_or_ro_dirs_on1/tmpfs/gprofiler_tmp'
Fixes a regression from https://github.com/Granulate/gprofiler/commit/6360449252793ad59802a3c09fde297646529b7d, and improves the tests so we'd catch it next time :)