MCPcopy
hub / github.com/uber-go/zap / TestConfigWithInvalidPaths

Function TestConfigWithInvalidPaths

config_test.go:88–108  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

86}
87
88func TestConfigWithInvalidPaths(t *testing.T) {
89 tests := []struct {
90 desc string
91 output string
92 errOutput string
93 }{
94 {"output directory doesn't exist", "/tmp/not-there/foo.log", "stderr"},
95 {"error output directory doesn't exist", "stdout", "/tmp/not-there/foo-errors.log"},
96 {"neither output directory exists", "/tmp/not-there/foo.log", "/tmp/not-there/foo-errors.log"},
97 }
98
99 for _, tt := range tests {
100 t.Run(tt.desc, func(t *testing.T) {
101 cfg := NewProductionConfig()
102 cfg.OutputPaths = []string{tt.output}
103 cfg.ErrorOutputPaths = []string{tt.errOutput}
104 _, err := cfg.Build()
105 assert.Error(t, err, "Expected an error opening a non-existent directory.")
106 })
107 }
108}
109
110func TestConfigWithMissingAttributes(t *testing.T) {
111 tests := []struct {

Callers

nothing calls this directly

Calls 3

NewProductionConfigFunction · 0.85
BuildMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected