@@ -418,7 +418,7 @@ func TestClusterOutputList_Load_As_Yaml(t *testing.T) {
418
418
func TestLokiOutputWithStructuredMetadata_Load (t * testing.T ) {
419
419
g := NewGomegaWithT (t )
420
420
sl := plugins .NewSecretLoader (nil , "testnamespace" )
421
-
421
+
422
422
lokiOutput := ClusterOutput {
423
423
TypeMeta : metav1.TypeMeta {
424
424
APIVersion : "fluentbit.fluent.io/v1alpha2" ,
@@ -437,9 +437,9 @@ func TestLokiOutputWithStructuredMetadata_Load(t *testing.T) {
437
437
"environment=production" ,
438
438
},
439
439
StructuredMetadata : map [string ]string {
440
- "pod" : "${record['kubernetes']['pod_name']}" ,
440
+ "pod" : "${record['kubernetes']['pod_name']}" ,
441
441
"container" : "${record['kubernetes']['container_name']}" ,
442
- "trace_id" : "${record['trace_id']}" ,
442
+ "trace_id" : "${record['trace_id']}" ,
443
443
},
444
444
StructuredMetadataKeys : []string {
445
445
"level" ,
@@ -448,11 +448,11 @@ func TestLokiOutputWithStructuredMetadata_Load(t *testing.T) {
448
448
},
449
449
},
450
450
}
451
-
451
+
452
452
outputs := ClusterOutputList {
453
453
Items : []ClusterOutput {lokiOutput },
454
454
}
455
-
455
+
456
456
expected := `[Output]
457
457
Name loki
458
458
Match kube.*
@@ -462,7 +462,7 @@ func TestLokiOutputWithStructuredMetadata_Load(t *testing.T) {
462
462
structured_metadata container=${record['kubernetes']['container_name']},pod=${record['kubernetes']['pod_name']},trace_id=${record['trace_id']}
463
463
structured_metadata_keys level,caller
464
464
`
465
-
465
+
466
466
result , err := outputs .Load (sl )
467
467
g .Expect (err ).NotTo (HaveOccurred ())
468
468
g .Expect (result ).To (Equal (expected ))
@@ -471,7 +471,7 @@ func TestLokiOutputWithStructuredMetadata_Load(t *testing.T) {
471
471
func TestLokiOutputWithStructuredMetadata_LoadAsYaml (t * testing.T ) {
472
472
g := NewGomegaWithT (t )
473
473
sl := plugins .NewSecretLoader (nil , "testnamespace" )
474
-
474
+
475
475
lokiOutput := ClusterOutput {
476
476
TypeMeta : metav1.TypeMeta {
477
477
APIVersion : "fluentbit.fluent.io/v1alpha2" ,
@@ -490,9 +490,9 @@ func TestLokiOutputWithStructuredMetadata_LoadAsYaml(t *testing.T) {
490
490
"environment=production" ,
491
491
},
492
492
StructuredMetadata : map [string ]string {
493
- "pod" : "${record['kubernetes']['pod_name']}" ,
493
+ "pod" : "${record['kubernetes']['pod_name']}" ,
494
494
"container" : "${record['kubernetes']['container_name']}" ,
495
- "trace_id" : "${record['trace_id']}" ,
495
+ "trace_id" : "${record['trace_id']}" ,
496
496
},
497
497
StructuredMetadataKeys : []string {
498
498
"level" ,
@@ -501,11 +501,11 @@ func TestLokiOutputWithStructuredMetadata_LoadAsYaml(t *testing.T) {
501
501
},
502
502
},
503
503
}
504
-
504
+
505
505
outputs := ClusterOutputList {
506
506
Items : []ClusterOutput {lokiOutput },
507
507
}
508
-
508
+
509
509
expected := `outputs:
510
510
- name: loki
511
511
match: "kube.*"
@@ -515,7 +515,7 @@ func TestLokiOutputWithStructuredMetadata_LoadAsYaml(t *testing.T) {
515
515
structured_metadata: container=${record['kubernetes']['container_name']},pod=${record['kubernetes']['pod_name']},trace_id=${record['trace_id']}
516
516
structured_metadata_keys: level,caller
517
517
`
518
-
518
+
519
519
result , err := outputs .LoadAsYaml (sl , 0 )
520
520
g .Expect (err ).NotTo (HaveOccurred ())
521
521
g .Expect (result ).To (Equal (expected ))
0 commit comments