Skip to content

Commit 0f33903

Browse files
seanbeardenclaude
andcommitted
fix: use test fixture in TestParsePluginMD_SessionHygiene instead of local filesystem
The test relied on ../../plugins/session-hygiene/run.sh existing on disk, which fails in CI where the working directory doesn't have that relative path. Create a temp dir with plugin.md and run.sh fixtures instead. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 7c40de0 commit 0f33903

1 file changed

Lines changed: 36 additions & 3 deletions

File tree

internal/plugin/scanner_test.go

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -401,11 +401,44 @@ func TestParsePluginMD_GitHubSheriff(t *testing.T) {
401401
}
402402

403403
func TestParsePluginMD_SessionHygiene(t *testing.T) {
404-
// Verify the actual session-hygiene plugin.md parses correctly.
405-
pluginDir := filepath.Join("..", "..", "plugins", "session-hygiene")
404+
// Use a temp dir with a fixture plugin.md and run.sh so the test
405+
// doesn't depend on the local filesystem layout (fails in CI).
406+
pluginDir := t.TempDir()
407+
408+
pluginContent := []byte(`+++
409+
name = "session-hygiene"
410+
description = "Clean up zombie tmux sessions and orphaned dog sessions"
411+
version = 2
412+
413+
[gate]
414+
type = "cooldown"
415+
duration = "30m"
416+
417+
[tracking]
418+
labels = ["plugin:session-hygiene", "category:cleanup"]
419+
digest = true
420+
421+
[execution]
422+
timeout = "5m"
423+
notify_on_failure = true
424+
severity = "low"
425+
+++
426+
427+
# Session Hygiene
428+
429+
Deterministic cleanup of zombie tmux sessions and orphaned dog sessions.
430+
`)
431+
432+
if err := os.WriteFile(filepath.Join(pluginDir, "plugin.md"), pluginContent, 0644); err != nil {
433+
t.Fatalf("writing plugin.md fixture: %v", err)
434+
}
435+
if err := os.WriteFile(filepath.Join(pluginDir, "run.sh"), []byte("#!/bin/bash\necho ok\n"), 0755); err != nil {
436+
t.Fatalf("writing run.sh fixture: %v", err)
437+
}
438+
406439
content, err := os.ReadFile(filepath.Join(pluginDir, "plugin.md"))
407440
if err != nil {
408-
t.Skipf("session-hygiene plugin not found (expected in plugins/): %v", err)
441+
t.Fatalf("reading plugin.md fixture: %v", err)
409442
}
410443

411444
plugin, err := parsePluginMD(content, pluginDir, LocationRig, "gastown")

0 commit comments

Comments
 (0)