blob: 0ca2dab17e24644a464e4c523c47091a531879fe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
package config
import (
"testing"
)
func TestConfigLogFile(t *testing.T) {
testRoot := "/foo/bar"
testCases := []struct {
yaml string
path string
}{
{path: "/foo/bar/gitlab-shell.log"},
{yaml: "log_file: my-log.log", path: "/foo/bar/my-log.log"},
{yaml: "log_file: /qux/my-log.log", path: "/qux/my-log.log"},
}
for _, tc := range testCases {
cfg := Config{RootDir: testRoot}
if err := parseConfig([]byte(tc.yaml), &cfg); err != nil {
t.Fatalf("%q: %v", tc.yaml, err)
}
if cfg.LogFile != tc.path {
t.Fatalf("%q: expected %q, got %q", tc.yaml, tc.path, cfg.LogFile)
}
}
}
|