MCPcopy Index your code
hub / github.com/celer-pkg/celer / TestExecutor_CreateLogFile

Function TestExecutor_CreateLogFile

pkgs/cmd/exec_test.go:59–79  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

57}
58
59func 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
81func TestExecutor_CreateLogFileNoPath(t *testing.T) {
82 executor := NewExecutor("test", "echo")

Callers

nothing calls this directly

Calls 4

NewExecutorFunction · 0.85
SetLogPathMethod · 0.80
createLogFileMethod · 0.80
CommandMethod · 0.65

Tested by

no test coverage detected