@@ -36,6 +36,8 @@ func TestConfig_ServicePorts(t *testing.T) {
36
36
name cloudflare
37
37
[INPUT]
38
38
name collectd
39
+ [INPUT]
40
+ name csphere_http
39
41
[INPUT]
40
42
name elasticsearch
41
43
[INPUT]
@@ -67,17 +69,18 @@ func TestConfig_ServicePorts(t *testing.T) {
67
69
{Port : 2020 , Protocol : networking .ProtocolTCP , Kind : SectionKindService },
68
70
expected (9880 , networking .ProtocolTCP , SectionKindInput , "cloudflare" , 0 ),
69
71
expected (25826 , networking .ProtocolUDP , SectionKindInput , "collectd" , 1 ),
70
- expected (9200 , networking .ProtocolTCP , SectionKindInput , "elasticsearch" , 2 ),
71
- expected (24224 , networking .ProtocolTCP , SectionKindInput , "forward" , 3 ),
72
- expected (9880 , networking .ProtocolTCP , SectionKindInput , "http" , 4 ),
73
- expected (1883 , networking .ProtocolTCP , SectionKindInput , "mqtt" , 5 ),
74
- expected (4318 , networking .ProtocolTCP , SectionKindInput , "opentelemetry" , 6 ),
75
- expected (8080 , networking .ProtocolTCP , SectionKindInput , "prometheus_remote_write" , 7 ),
76
- expected (8088 , networking .ProtocolTCP , SectionKindInput , "splunk" , 8 ),
77
- expected (8125 , networking .ProtocolUDP , SectionKindInput , "statsd" , 9 ),
78
- // expected(5140, networking.ProtocolTCP, SectionKindInput, "syslog", 10), // default syslog without explicit mode tcp or udp is skipped
79
- expected (5170 , networking .ProtocolTCP , SectionKindInput , "tcp" , 11 ),
80
- expected (5170 , networking .ProtocolUDP , SectionKindInput , "udp" , 12 ),
72
+ expected (443 , networking .ProtocolTCP , SectionKindInput , "csphere_http" , 2 ),
73
+ expected (9200 , networking .ProtocolTCP , SectionKindInput , "elasticsearch" , 3 ),
74
+ expected (24224 , networking .ProtocolTCP , SectionKindInput , "forward" , 4 ),
75
+ expected (9880 , networking .ProtocolTCP , SectionKindInput , "http" , 5 ),
76
+ expected (1883 , networking .ProtocolTCP , SectionKindInput , "mqtt" , 6 ),
77
+ expected (4318 , networking .ProtocolTCP , SectionKindInput , "opentelemetry" , 7 ),
78
+ expected (8080 , networking .ProtocolTCP , SectionKindInput , "prometheus_remote_write" , 8 ),
79
+ expected (8088 , networking .ProtocolTCP , SectionKindInput , "splunk" , 9 ),
80
+ expected (8125 , networking .ProtocolUDP , SectionKindInput , "statsd" , 10 ),
81
+ // expected(5140, networking.ProtocolTCP, SectionKindInput, "syslog", 11), // default syslog without explicit mode tcp or udp is skipped
82
+ expected (5170 , networking .ProtocolTCP , SectionKindInput , "tcp" , 12 ),
83
+ expected (5170 , networking .ProtocolUDP , SectionKindInput , "udp" , 13 ),
81
84
expected (2021 , networking .ProtocolTCP , SectionKindOutput , "prometheus_exporter" , 0 ),
82
85
}, config .ServicePorts ())
83
86
})
@@ -94,65 +97,69 @@ func TestConfig_ServicePorts(t *testing.T) {
94
97
name collectd
95
98
port 3
96
99
[INPUT]
97
- name elasticsearch
100
+ name csphere_http
98
101
port 4
99
102
[INPUT]
100
- name forward
103
+ name elasticsearch
101
104
port 5
102
105
[INPUT]
103
- name http
106
+ name forward
104
107
port 6
105
108
[INPUT]
106
- name mqtt
109
+ name http
107
110
port 7
108
111
[INPUT]
109
- name opentelemetry
112
+ name mqtt
110
113
port 8
111
114
[INPUT]
112
- name prometheus_remote_write
115
+ name opentelemetry
113
116
port 9
114
117
[INPUT]
115
- name splunk
118
+ name prometheus_remote_write
116
119
port 10
117
120
[INPUT]
118
- name statsd
121
+ name splunk
119
122
port 11
123
+ [INPUT]
124
+ name statsd
125
+ port 12
120
126
[INPUT]
121
127
name syslog
122
128
mode tcp
123
- port 12
129
+ port 13
124
130
[INPUT]
125
131
name syslog
126
132
mode udp
127
- port 13
133
+ port 14
128
134
[INPUT]
129
135
name tcp
130
- port 14
136
+ port 15
131
137
[INPUT]
132
138
name udp
133
- port 15
139
+ port 16
134
140
[OUTPUT]
135
141
name prometheus_exporter
136
- port 16
142
+ port 17
137
143
` , FormatClassic )
138
144
assert .NoError (t , err )
139
145
assert .Equal (t , ServicePorts {
140
146
{Port : 1 , Protocol : networking .ProtocolTCP , Kind : SectionKindService },
141
147
expected (2 , networking .ProtocolTCP , SectionKindInput , "cloudflare" , 0 , property.Property {Key : "addr" , Value : ":2" }),
142
148
expected (3 , networking .ProtocolUDP , SectionKindInput , "collectd" , 1 , property.Property {Key : "port" , Value : int64 (3 )}),
143
- expected (4 , networking .ProtocolTCP , SectionKindInput , "elasticsearch" , 2 , property.Property {Key : "port" , Value : int64 (4 )}),
144
- expected (5 , networking .ProtocolTCP , SectionKindInput , "forward" , 3 , property.Property {Key : "port" , Value : int64 (5 )}),
145
- expected (6 , networking .ProtocolTCP , SectionKindInput , "http" , 4 , property.Property {Key : "port" , Value : int64 (6 )}),
146
- expected (7 , networking .ProtocolTCP , SectionKindInput , "mqtt" , 5 , property.Property {Key : "port" , Value : int64 (7 )}),
147
- expected (8 , networking .ProtocolTCP , SectionKindInput , "opentelemetry" , 6 , property.Property {Key : "port" , Value : int64 (8 )}),
148
- expected (9 , networking .ProtocolTCP , SectionKindInput , "prometheus_remote_write" , 7 , property.Property {Key : "port" , Value : int64 (9 )}),
149
- expected (10 , networking .ProtocolTCP , SectionKindInput , "splunk" , 8 , property.Property {Key : "port" , Value : int64 (10 )}),
150
- expected (11 , networking .ProtocolUDP , SectionKindInput , "statsd" , 9 , property.Property {Key : "port" , Value : int64 (11 )}),
151
- expected (12 , networking .ProtocolTCP , SectionKindInput , "syslog" , 10 , property.Property {Key : "mode" , Value : "tcp" }, property.Property {Key : "port" , Value : int64 (12 )}),
152
- expected (13 , networking .ProtocolUDP , SectionKindInput , "syslog" , 11 , property.Property {Key : "mode" , Value : "udp" }, property.Property {Key : "port" , Value : int64 (13 )}),
153
- expected (14 , networking .ProtocolTCP , SectionKindInput , "tcp" , 12 , property.Property {Key : "port" , Value : int64 (14 )}),
154
- expected (15 , networking .ProtocolUDP , SectionKindInput , "udp" , 13 , property.Property {Key : "port" , Value : int64 (15 )}),
155
- expected (16 , networking .ProtocolTCP , SectionKindOutput , "prometheus_exporter" , 0 , property.Property {Key : "port" , Value : int64 (16 )}),
149
+ expected (4 , networking .ProtocolTCP , SectionKindInput , "csphere_http" , 2 , property.Property {Key : "port" , Value : int64 (4 )}),
150
+ expected (5 , networking .ProtocolTCP , SectionKindInput , "elasticsearch" , 3 , property.Property {Key : "port" , Value : int64 (5 )}),
151
+ expected (6 , networking .ProtocolTCP , SectionKindInput , "forward" , 4 , property.Property {Key : "port" , Value : int64 (6 )}),
152
+ expected (7 , networking .ProtocolTCP , SectionKindInput , "http" , 5 , property.Property {Key : "port" , Value : int64 (7 )}),
153
+ expected (8 , networking .ProtocolTCP , SectionKindInput , "mqtt" , 6 , property.Property {Key : "port" , Value : int64 (8 )}),
154
+ expected (9 , networking .ProtocolTCP , SectionKindInput , "opentelemetry" , 7 , property.Property {Key : "port" , Value : int64 (9 )}),
155
+ expected (10 , networking .ProtocolTCP , SectionKindInput , "prometheus_remote_write" , 8 , property.Property {Key : "port" , Value : int64 (10 )}),
156
+ expected (11 , networking .ProtocolTCP , SectionKindInput , "splunk" , 9 , property.Property {Key : "port" , Value : int64 (11 )}),
157
+ expected (12 , networking .ProtocolUDP , SectionKindInput , "statsd" , 10 , property.Property {Key : "port" , Value : int64 (12 )}),
158
+ expected (13 , networking .ProtocolTCP , SectionKindInput , "syslog" , 11 , property.Property {Key : "mode" , Value : "tcp" }, property.Property {Key : "port" , Value : int64 (13 )}),
159
+ expected (14 , networking .ProtocolUDP , SectionKindInput , "syslog" , 12 , property.Property {Key : "mode" , Value : "udp" }, property.Property {Key : "port" , Value : int64 (14 )}),
160
+ expected (15 , networking .ProtocolTCP , SectionKindInput , "tcp" , 13 , property.Property {Key : "port" , Value : int64 (15 )}),
161
+ expected (16 , networking .ProtocolUDP , SectionKindInput , "udp" , 14 , property.Property {Key : "port" , Value : int64 (16 )}),
162
+ expected (17 , networking .ProtocolTCP , SectionKindOutput , "prometheus_exporter" , 0 , property.Property {Key : "port" , Value : int64 (17 )}),
156
163
}, config .ServicePorts ())
157
164
})
158
165
0 commit comments