Skip to content

improve TestDeleteContext robustness and isolation using temporary directories#314

Closed
Manar-Elhabbal7 wants to merge 2 commits intomicrocks:masterfrom
Manar-Elhabbal7:refactor/test-config-tempdir
Closed

improve TestDeleteContext robustness and isolation using temporary directories#314
Manar-Elhabbal7 wants to merge 2 commits intomicrocks:masterfrom
Manar-Elhabbal7:refactor/test-config-tempdir

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

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 7, 2026

👋 @Manar-Elhabbal7

Welcome to the Microcks community! 💖

Thanks and congrats 🎉 for opening your first pull request here! Be sure to follow the pull request template or please update it accordingly.

Hope you have a great time there!

@Manar-Elhabbal7 Manar-Elhabbal7 force-pushed the refactor/test-config-tempdir branch from 9c2052f to 41aed5d Compare May 7, 2026 00:09
@Manar-Elhabbal7 Manar-Elhabbal7 deleted the refactor/test-config-tempdir branch May 7, 2026 00:10
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