(t *testing.T)
| 57 | } |
| 58 | |
| 59 | func TestExecutor_CreateLogFile(t *testing.T) { |
| 60 | tmpDir := t.TempDir() |
| 61 | logPath := tmpDir + "/test.log" |
| 62 | |
| 63 | executor := NewExecutor("test", "echo").SetLogPath(logPath) |
| 64 | execCmd := exec.Command("echo") |
| 65 | execCmd.Env = os.Environ() |
| 66 | |
| 67 | logFile, err := executor.createLogFile(execCmd) |
| 68 | if err != nil { |
| 69 | t.Fatalf("unexpected error: %v", err) |
| 70 | } |
| 71 | if logFile == nil { |
| 72 | t.Fatal("expected log file to be created") |
| 73 | } |
| 74 | logFile.Close() |
| 75 | |
| 76 | if _, err := os.Stat(logPath); os.IsNotExist(err) { |
| 77 | t.Fatal("log file should exist") |
| 78 | } |
| 79 | } |
| 80 | |
| 81 | func TestExecutor_CreateLogFileNoPath(t *testing.T) { |
| 82 | executor := NewExecutor("test", "echo") |
nothing calls this directly
no test coverage detected