Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: set correct permission for the test directory. #107

Merged
merged 1 commit into from
Apr 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,18 @@ def mock_runtime_logger_level(self, tmpdir: pathlib.Path):

@pytest.fixture
def connection_file_path(self, tmp_path: pathlib.Path) -> str:
return os.path.join(tmp_path.absolute(), "connection.json")
connection_dir = os.path.join(tmp_path.absolute(), "connection_dir")
os.mkdir(connection_dir)
if OSName.is_windows():
# In Windows, to prevent false positives in tests, it's crucial to remove the "Delete subfolders and files"
# permission from the parent folder. This step ensures that files cannot be deleted without explicit delete
# permissions, addressing an edge case where the same user owns both the parent folder and the file,
# bypassing delete permissions. `set_file_permissions_in_windows` will restrict the permission to read,
# write, delete current folder, which meets the requirement.
from openjd.adaptor_runtime._utils._secure_open import set_file_permissions_in_windows

set_file_permissions_in_windows(connection_dir)
return os.path.join(connection_dir, "connection.json")

@pytest.fixture
def initialized_setup(
Expand Down