Skip to content

Commit d226d8d

Browse files
committed
Fix test package format
1 parent 42cb4a0 commit d226d8d

File tree

4 files changed

+12
-6
lines changed

4 files changed

+12
-6
lines changed

internal/formatter/yaml_formatter.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
// The function is exposed, so it can be used by other internal packages.
1717
func YAMLFormatter(content []byte) ([]byte, bool, error) {
1818
// yaml.Unmarshal() requires `yaml.Node` to be passed instead of generic `interface{}`.
19-
// Otherwise it can detect any comments and fields are considered as normal map.
19+
// Otherwise it can't detect any comments and fields are considered as normal map.
2020
var node yaml.Node
2121
err := yaml.Unmarshal(content, &node)
2222
if err != nil {
@@ -31,5 +31,11 @@ func YAMLFormatter(content []byte) ([]byte, bool, error) {
3131
return nil, false, errors.Wrap(err, "marshalling YAML node failed")
3232
}
3333
formatted := b.Bytes()
34+
35+
// required to preserve yaml files starting with "---" as yaml.Encoding strips them
36+
if bytes.HasPrefix(content, []byte("---\n")) {
37+
formatted = append([]byte("---\n"), formatted...)
38+
}
39+
3440
return formatted, string(content) == string(formatted), nil
3541
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
description: Benchmark 100MiB of data ingested
2+
description: Benchmark 20MiB of data ingested
33
input: filestream
44
vars: ~
55
data_stream.name: testds
@@ -9,4 +9,4 @@ warmup_time_period: 10s
99
corpora.generator.size: 20MiB
1010
corpora.generator.template.path: ./20mb-logs-benchmark/template.log
1111
corpora.generator.config.path: ./20mb-logs-benchmark/config.yml
12-
corpora.generator.fields.path: ./20mb-logs-benchmark/fields.yml
12+
corpora.generator.fields.path: ./20mb-logs-benchmark/fields.yml

test/packages/benchmarks/system_benchmark/_dev/benchmark/system/20mb-logs-benchmark/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
min: 10
1616
max: 59
1717
- name: Mon
18-
enum:
18+
enum:
1919
- "Jan"
2020
- "Feb"
2121
- "Mar"
@@ -37,4 +37,4 @@
3737
- name: Port
3838
range:
3939
min: 8000
40-
max: 8080
40+
max: 8080

test/packages/benchmarks/system_benchmark/_dev/benchmark/system/20mb-logs-benchmark/fields.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
- name: Hostname
1616
type: keyword
1717
- name: Port
18-
type: long
18+
type: long

0 commit comments

Comments
 (0)