Skip to content

Commit 07d6242

Browse files
committed
Group vars
1 parent 2b38cc4 commit 07d6242

File tree

2 files changed

+36
-32
lines changed

2 files changed

+36
-32
lines changed

apis/fluentbit/v1alpha2/clusterfluentbitconfig_types_test.go

Lines changed: 32 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,14 @@ import (
1818
)
1919

2020
const (
21-
authorization = "foo:bar"
22-
xLogHeader0 = "testing"
23-
xLogHeaderAppID = "9780495d9db3"
24-
xLogHeaderAppName = "app_name"
21+
authorization = "foo:bar"
22+
xLogHeader0 = "testing"
23+
xLogHeaderAppID = "9780495d9db3"
24+
xLogHeaderAppName = "app_name"
2525
)
2626

27-
var expected = fmt.Sprintf(`[Service]
27+
var (
28+
expected = fmt.Sprintf(`[Service]
2829
Daemon false
2930
Flush 1
3031
Grace 30
@@ -119,7 +120,7 @@ var expected = fmt.Sprintf(`[Service]
119120
tls.verify true
120121
`, authorization, xLogHeader0, xLogHeaderAppID, xLogHeaderAppName)
121122

122-
var expectedYaml = fmt.Sprintf(`service:
123+
expectedYaml = fmt.Sprintf(`service:
123124
daemon: false
124125
flush: 1
125126
grace: 30
@@ -215,7 +216,7 @@ pipeline:
215216
topics: fluentbit-namespace
216217
`, authorization, xLogHeader0, xLogHeaderAppID, xLogHeaderAppName)
217218

218-
var expectedK8s = `[Service]
219+
expectedK8s = `[Service]
219220
Daemon false
220221
Flush 1
221222
Grace 30
@@ -252,7 +253,7 @@ var expectedK8s = `[Service]
252253
Write_Operation update
253254
`
254255

255-
var expectedK8sYaml = `service:
256+
expectedK8sYaml = `service:
256257
daemon: false
257258
flush: 1
258259
grace: 30
@@ -289,7 +290,7 @@ pipeline:
289290
write_operation: update
290291
`
291292

292-
var expectedK8sYamlWithClusterFilterOutput = `service:
293+
expectedK8sYamlWithClusterFilterOutput = `service:
293294
daemon: false
294295
flush: 1
295296
grace: 30
@@ -336,7 +337,7 @@ pipeline:
336337
write_operation: update
337338
`
338339

339-
var expectedParsers = `[PARSER]
340+
expectedParsers = `[PARSER]
340341
Name clusterparser0
341342
Format json
342343
Time_Key time
@@ -355,7 +356,7 @@ var expectedParsers = `[PARSER]
355356
Types status:integer size:integer
356357
`
357358

358-
var expectedMultilineParsers = `[MULTILINE_PARSER]
359+
expectedMultilineParsers = `[MULTILINE_PARSER]
359360
Name clustermultilineparser0
360361
Type regex
361362
Parser go
@@ -374,26 +375,27 @@ var expectedMultilineParsers = `[MULTILINE_PARSER]
374375
Rule "cont" "/^\s+at.*/" "cont"
375376
`
376377

377-
var labels = map[string]string{
378-
"label0": "lv0",
379-
"label1": "lv1",
380-
"label3": "lval3",
381-
"lbl2": "lval2",
382-
"lbl1": "lvl1",
383-
}
378+
labels = map[string]string{
379+
"label0": "lv0",
380+
"label1": "lv1",
381+
"label3": "lval3",
382+
"lbl2": "lval2",
383+
"lbl1": "lvl1",
384+
}
384385

385-
var cfg = ClusterFluentBitConfig{
386-
Spec: FluentBitConfigSpec{
387-
Service: &Service{
388-
Daemon: ptrBool(false),
389-
FlushSeconds: ptrFloat64(1),
390-
GraceSeconds: ptrInt64(30),
391-
HttpServer: ptrBool(true),
392-
LogLevel: "info",
393-
ParsersFile: "parsers.conf",
394-
},
395-
},
396-
}
386+
cfg = ClusterFluentBitConfig{
387+
Spec: FluentBitConfigSpec{
388+
Service: &Service{
389+
Daemon: ptrBool(false),
390+
FlushSeconds: ptrFloat64(1),
391+
GraceSeconds: ptrInt64(30),
392+
HttpServer: ptrBool(true),
393+
LogLevel: "info",
394+
ParsersFile: "parsers.conf",
395+
},
396+
},
397+
}
398+
)
397399

398400
func Test_FluentBitConfig_RenderMainConfig(t *testing.T) {
399401
g := NewGomegaWithT(t)

apis/fluentbit/v1alpha2/clusteroutput_types_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ import (
99
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1010
)
1111

12-
var outputExpectedYaml = `outputs:
12+
var (
13+
outputExpectedYaml = `outputs:
1314
- name: http
1415
match: "logs.foo.bar"
1516
alias: output_http_alias
@@ -66,7 +67,7 @@ var outputExpectedYaml = `outputs:
6667
tls: On
6768
tls.verify: true
6869
`
69-
var outputExpected = `[Output]
70+
outputExpected = `[Output]
7071
Name http
7172
Match logs.foo.bar
7273
Alias output_http_alias
@@ -121,6 +122,7 @@ var outputExpected = `[Output]
121122
tls On
122123
tls.verify true
123124
`
125+
)
124126

125127
func TestClusterOutputList_Load(t *testing.T) {
126128
g := NewGomegaWithT(t)

0 commit comments

Comments
 (0)