MCPcopy
hub / github.com/grafana/tempo / TestNewFromFile

Function TestNewFromFile

tools/chloggen/internal/config/config_test.go:41–192  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

39}
40
41func TestNewFromFile(t *testing.T) {
42 testCases := []struct {
43 name string
44 cfg *Config
45 expectErr string
46 }{
47 {
48 name: "empty",
49 cfg: &Config{},
50 },
51 {
52 name: "multi-changelog-no-default",
53 cfg: &Config{
54 EntriesDir: ".test",
55 TemplateYAML: "TEMPLATE-custom.yaml",
56 ChangeLogs: map[string]string{
57 "foo": "CHANGELOG-1.md",
58 "bar": "CHANGELOG-2.md",
59 },
60 },
61 },
62 {
63 name: "multi-changelog-with-default",
64 cfg: &Config{
65 EntriesDir: ".test",
66 TemplateYAML: "TEMPLATE-custom.yaml",
67 ChangeLogs: map[string]string{
68 "foo": "CHANGELOG-1.md",
69 "bar": "CHANGELOG-2.md",
70 },
71 DefaultChangeLogs: []string{"foo"},
72 },
73 },
74 {
75 name: "default-changelogs-without-changelogs",
76 cfg: &Config{
77 EntriesDir: ".test",
78 TemplateYAML: "TEMPLATE-custom.yaml",
79 DefaultChangeLogs: []string{"foo"},
80 },
81 expectErr: "cannot specify 'default_change_logs' without 'change_logs'",
82 },
83 {
84 name: "default-changelog-not-in-changelogs",
85 cfg: &Config{
86 EntriesDir: ".test",
87 TemplateYAML: "TEMPLATE-custom.yaml",
88 ChangeLogs: map[string]string{
89 "foo": "CHANGELOG-1.md",
90 "bar": "CHANGELOG-2.md",
91 },
92 DefaultChangeLogs: []string{"foo", "bar", "fake"},
93 },
94 expectErr: `contains key "fake" which is not defined in 'change_logs'`,
95 },
96 {
97 name: "absolute-entries-dir",
98 cfg: &Config{

Callers

nothing calls this directly

Calls 9

NewFromFileFunction · 0.85
NewFunction · 0.70
MarshalMethod · 0.65
CloseMethod · 0.65
WriteMethod · 0.65
NameMethod · 0.65
JoinMethod · 0.65
RunMethod · 0.45
EqualMethod · 0.45

Tested by

no test coverage detected