MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / TestValidateLogFileOutputNonDirectory

Function TestValidateLogFileOutputNonDirectory

base/logging_config_test.go:34–50  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

32}
33
34func TestValidateLogFileOutputNonDirectory(t *testing.T) {
35 tmpdir := t.TempDir()
36 file1 := filepath.Join(tmpdir, "1.log")
37 f, err := os.Create(file1)
38 require.NoError(t, err)
39 t.Cleanup(func() { require.NoError(t, f.Close()) })
40
41 invalidFilePath := filepath.Join(file1, "2.log")
42 err = validateLogFileOutput(invalidFilePath)
43 require.Error(t, err)
44 assert.ErrorContains(t, err, "invalid log file path: mkdir")
45 if runtime.GOOS == "windows" {
46 assert.ErrorContains(t, err, "The system cannot find the path specified")
47 } else {
48 assert.ErrorContains(t, err, "not a directory")
49 }
50}
51
52// CBG-1760: Error upfront when the configured logFilePath is not writable
53func TestLogFilePathWritable(t *testing.T) {

Callers

nothing calls this directly

Calls 3

validateLogFileOutputFunction · 0.85
CloseMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected