Skip to content

improve TestDeleteContext using temporary directories#315

Open
Manar-Elhabbal7 wants to merge 1 commit intomicrocks:masterfrom
Manar-Elhabbal7:ref-context_test.go
Open

improve TestDeleteContext using temporary directories#315
Manar-Elhabbal7 wants to merge 1 commit intomicrocks:masterfrom
Manar-Elhabbal7:ref-context_test.go

Conversation

@Manar-Elhabbal7
Copy link
Copy Markdown

Description

This PR fixes a brittle test case in cmd/context_test.go where TestDeleteContext was failing on
non-Unix-native filesystems (like NTFS/FAT).

The test previously relied on a static file path in ./testdata/, which caused issues when trying to set
and verify restrictive file permissions (0600). By switching to t.TempDir(), the test is now isolated,
environment-agnostic, and leaves no garbage files behind.

Changes

  • Removed hardcoded testConfigFilePath constant.
  • Added path/filepath to imports.
  • Updated TestDeleteContext to generate a unique temporary directory and path for each execution.

Related issue(s) : #313

Signed-off-by: Manar Elhabbal <manarelhabbal619@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant