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

Function TestExecutor_CreateLogFileWithEnv

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

Source from the content-addressed store, hash-verified

93}
94
95func TestExecutor_CreateLogFileWithEnv(t *testing.T) {
96 tmpDir := t.TempDir()
97 logPath := tmpDir + "/test.log"
98
99 executor := NewExecutor("test", "echo").SetLogPath(logPath)
100 execCmd := exec.Command("echo")
101 execCmd.Env = os.Environ()
102
103 logFile, err := executor.createLogFile(execCmd)
104 if err != nil {
105 t.Fatalf("unexpected error: %v", err)
106 }
107 logFile.Close()
108
109 data, err := os.ReadFile(logPath)
110 if err != nil {
111 t.Fatalf("failed to read log file: %v", err)
112 }
113 content := string(data)
114 if !strings.Contains(content, "Environment:") {
115 t.Error("log file should contain 'Environment:' header")
116 }
117 if !strings.Contains(content, "test:") {
118 t.Error("log file should contain title header")
119 }
120}
121
122func TestExecutor_ConfigureOutputs_NilOutput(t *testing.T) {
123 executor := NewExecutor("test", "echo")

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected