Skip to content

Commit 51c2b2d

Browse files
author
dmsa0618
committed
add delimiter generation test
1 parent 169a776 commit 51c2b2d

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

config/v3/configV3_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,18 @@ func TestImportSuccess(t *testing.T) {
441441
expectMetric(t, cfg.AllMetrics[4], "test_summary_2", []string{"/var/log/syslog/*"}, 0, 4, 2*time.Hour+30*time.Minute)
442442
}
443443

444+
func TestLineDelimiterGeneration(t *testing.T) {
445+
cfgWithoutDelimiter := strings.Replace(counter_config, "[\\s]*line_delimiter:[^\\n]*", "", 1)
446+
cfgWithDelimiter, err := Unmarshal([]byte(cfgWithoutDelimiter))
447+
if err != nil {
448+
t.Fatalf("unexpected unmarshalling error: %v", err)
449+
}
450+
err = equalsIgnoreIndentation(cfgWithDelimiter.String(), counter_config)
451+
if err != nil {
452+
t.Fatalf("Expected:\n%v\nActual:\n%v\n%v", counter_config, cfgWithDelimiter, err)
453+
}
454+
}
455+
444456
func expectMetric(t *testing.T, metric MetricConfig, name string, paths []string, bucketLen, quantilesLen int, retention time.Duration) {
445457
if metric.Name != name {
446458
t.Fatalf("expected metric %v but found %v", name, metric.Name)

0 commit comments

Comments
 (0)