microcks / microcks/microcks-cli

Refactor : improve TestDeleteContext robustness and isolation using temporary directories

オープン 初心者向け
#313 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

主要言語
Go
スター
52
フォーク
68
平均マージ
6時間 54分
マージ済み PR(30日)
10

説明

### Reason/Context

Currently, `TestDeleteContext` in `cmd/context_test.go` relies on a **hardcoded** file path
`/testdata/local.config`

This approach causes the test to fail on filesystems that do not fully
support Unix-style permissions (such as NTFS or FAT32 partitions commonly used on external drives or
Windows-mounted volumes), as the test attempts to verify restrictive file permissions (0600).

### Description

The enhancement involves refactoring the `TestDeleteContext` function. Instead of using a static file
path, the test will now:

1. Utilize `t.TempDir()` to create a unique, isolated directory for each test run.
2. Construct the configuration file path dynamically using f`ilepath.Join()`
3. Clean up automatically after the test finishes, as `t.TempDir()` is managed by the Go testing
package.

### Implementation ideas

_No response_

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

Open cmd/context_test.go and start with TestDeleteContext. Run that test to observe its current behavior, then verify that the test uses t.TempDir() and filepath.Join() instead of the hardcoded path. Done means the test remains isolated, cleans up automatically, and passes on its supported filesystems.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
go
領域
cli, testing-qa
issue の種類
リファクタリング
難易度
2/5
見積もり時間
1〜3時間
活発さ
静か
明瞭さ
明確に書かれている
初心者へのやさしさ
84/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。