File tree Expand file tree Collapse file tree 1 file changed +80
-0
lines changed
pkg/sdk/logging/model/output Expand file tree Collapse file tree 1 file changed +80
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Copyright © 2019 Banzai Cloud
2
+ //
3
+ // Licensed under the Apache License, Version 2.0 (the "License");
4
+ // you may not use this file except in compliance with the License.
5
+ // You may obtain a copy of the License at
6
+ //
7
+ // http://www.apache.org/licenses/LICENSE-2.0
8
+ //
9
+ // Unless required by applicable law or agreed to in writing, software
10
+ // distributed under the License is distributed on an "AS IS" BASIS,
11
+ // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ // See the License for the specific language governing permissions and
13
+ // limitations under the License.
14
+
15
+ package output_test
16
+
17
+ import (
18
+ "testing"
19
+
20
+ "github.com/ghodss/yaml"
21
+ "github.com/kube-logging/logging-operator/pkg/sdk/logging/model/output"
22
+ "github.com/kube-logging/logging-operator/pkg/sdk/logging/model/render"
23
+ "github.com/stretchr/testify/require"
24
+ )
25
+
26
+ func TestForward (t * testing.T ) {
27
+ CONFIG := []byte (`
28
+ servers:
29
+ - host: 192.168.1.3
30
+ name: myserver1
31
+ port: 24224
32
+ weight: 60
33
+ - host: 192.168.1.4
34
+ name: myserver2
35
+ port: 24223
36
+ weight: 40
37
+ buffer:
38
+ timekey: 1m
39
+ timekey_wait: 30s
40
+ timekey_use_utc: true
41
+ keepalive: true
42
+ keepalive_timeout: 20
43
+ time_as_integer: true
44
+ send_timeout: 60
45
+ ` )
46
+ expected := `
47
+ <match **>
48
+ @type forward
49
+ @id test
50
+ keepalive true
51
+ keepalive_timeout 20
52
+ send_timeout 60
53
+ time_as_integer true
54
+ <buffer tag,time>
55
+ @type file
56
+ path /buffers/test.*.buffer
57
+ retry_forever true
58
+ timekey 1m
59
+ timekey_use_utc true
60
+ timekey_wait 30s
61
+ </buffer>
62
+ <server>
63
+ host 192.168.1.3
64
+ name myserver1
65
+ port 24224
66
+ weight 60
67
+ </server>
68
+ <server>
69
+ host 192.168.1.4
70
+ name myserver2
71
+ port 24223
72
+ weight 40
73
+ </server>
74
+ </match>
75
+ `
76
+ g := & output.ForwardOutput {}
77
+ require .NoError (t , yaml .Unmarshal (CONFIG , g ))
78
+ test := render .NewOutputPluginTest (t , g )
79
+ test .DiffResult (expected )
80
+ }
You can’t perform that action at this time.
0 commit comments