MCPcopy Create free account
hub / github.com/devnullvoid/pvetui / TestNewInternalLogger_InvalidCacheDir

Function TestNewInternalLogger_InvalidCacheDir

internal/logger/logger_test.go:193–216  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

191}
192
193func TestNewInternalLogger_InvalidCacheDir(t *testing.T) {
194 // Create a temporary directory for this test to avoid creating files in current directory
195 tempDir := t.TempDir()
196
197 // Change to temp directory temporarily
198 originalDir, err := os.Getwd()
199 require.NoError(t, err)
200
201 defer func() {
202 if chdirErr := os.Chdir(originalDir); chdirErr != nil {
203 t.Errorf("Failed to change back to original directory: %v", chdirErr)
204 }
205 }()
206
207 err = os.Chdir(tempDir)
208 require.NoError(t, err)
209
210 // Try with invalid cache directory - should fall back to current directory (which is now tempDir)
211 logger, err := NewInternalLogger(LevelInfo, "/root/nonexistent")
212 require.NoError(t, err) // Should not error, falls back to current directory
213 assert.NotNil(t, logger)
214
215 defer logger.Close()
216}
217
218func TestNewSimpleLogger(t *testing.T) {
219 logger := NewSimpleLogger(LevelDebug)

Callers

nothing calls this directly

Calls 2

NewInternalLoggerFunction · 0.85
CloseMethod · 0.65

Tested by

no test coverage detected