mirror of
https://github.com/coder/coder.git
synced 2026-06-02 20:48:20 +00:00
test(agent/agentcontextconfig): isolate TestContextPartsFromDir from host HOME (#25649)
ContextPartsFromDir scans ~/.coder/skills via DefaultSkillsDir. On machines with real skills installed, these leaked into test results. Set HOME/USERPROFILE to temp dirs on the parent test so subtests run in a clean environment.
This commit is contained in:
committed by
GitHub
parent
00a6dc56a7
commit
52e73b1343
@@ -42,8 +42,11 @@ func writeSkillMetaFile(t *testing.T, dir, name, description string) string {
|
|||||||
return writeSkillMetaFileInRoot(t, filepath.Join(dir, ".agents", "skills"), name, description)
|
return writeSkillMetaFileInRoot(t, filepath.Join(dir, ".agents", "skills"), name, description)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//nolint:paralleltest,tparallel // Uses t.Setenv to isolate HOME.
|
||||||
func TestContextPartsFromDir(t *testing.T) {
|
func TestContextPartsFromDir(t *testing.T) {
|
||||||
t.Parallel()
|
// Prevent ~/.coder/skills on the host from leaking into results.
|
||||||
|
t.Setenv("HOME", t.TempDir())
|
||||||
|
t.Setenv("USERPROFILE", t.TempDir())
|
||||||
|
|
||||||
t.Run("ReturnsInstructionFilePart", func(t *testing.T) {
|
t.Run("ReturnsInstructionFilePart", func(t *testing.T) {
|
||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|||||||
Reference in New Issue
Block a user