(t *testing.T)
| 32 | } |
| 33 | |
| 34 | func 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 |
| 53 | func TestLogFilePathWritable(t *testing.T) { |
nothing calls this directly
no test coverage detected