Skip to content

improve TestDeleteContext using temporary directories - #315

Closed
Manar-Elhabbal7 wants to merge 1 commit into
microcks:masterfrom
Manar-Elhabbal7:ref-context_test.go
Closed

improve TestDeleteContext using temporary directories#315
Manar-Elhabbal7 wants to merge 1 commit into
microcks: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>
@Caesarsage

Caesarsage commented Aug 16, 2026

Copy link
Copy Markdown
Contributor

Thanks @Manar-Elhabbal7

This has largely being addressed on master, the newer context tests use t.TempDir() and the remaining fixture creates its directory explicitly, so the clean-clone failure is gone. If a specific NTFS/FAT permission failure remains, a fresh repro against master would help; otherwise I believe this can be closed.

@Harsh4902 Harsh4902 closed this Aug 25, 2026
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.

3 participants