@@ -15,7 +15,7 @@ func TestPipeline_ConnectionRefused(t *testing.T) {
1515 out , _ := cmd .CombinedOutput ()
1616
1717 actual := string (out )
18- expected := "UNKNOWN - Get \" http://localhost:9999/"
18+ expected := "[ UNKNOWN] - Get \" http://localhost:9999/"
1919
2020 if ! strings .Contains (actual , expected ) {
2121 t .Error ("\n Actual: " , actual , "\n Expected: " , expected )
@@ -38,7 +38,7 @@ func TestPipelineCmd_Logstash7(t *testing.T) {
3838 w .Write ([]byte (`{}` ))
3939 })),
4040 args : []string {"run" , "../main.go" , "pipeline" },
41- expected : "UNKNOWN - required flag" ,
41+ expected : "[ UNKNOWN] - required flag" ,
4242 },
4343 {
4444 name : "pipeline-ok" ,
@@ -47,7 +47,7 @@ func TestPipelineCmd_Logstash7(t *testing.T) {
4747 w .Write ([]byte (`{"host":"localhost","version":"7.17.8","http_address":"127.0.0.1:9600","id":"4","name":"test","ephemeral_id":"5","status":"green","snapshot":false,"pipeline":{"workers":2,"batch_size":125,"batch_delay":50},"pipelines":{"localhost-input":{"events":{"filtered":0,"duration_in_millis":0,"queue_push_duration_in_millis":0,"out":50,"in":100},"plugins":{"inputs":[{"id":"b","name":"beats","events":{"queue_push_duration_in_millis":0,"out":0}}],"codecs":[{"id":"plain","name":"plain","decode":{"writes_in":0,"duration_in_millis":0,"out":0},"encode":{"writes_in":0,"duration_in_millis":0}},{"id":"json","name":"json","decode":{"writes_in":0,"duration_in_millis":0,"out":0},"encode":{"writes_in":0,"duration_in_millis":0}}],"filters":[],"outputs":[{"id":"f","name":"redis","events":{"duration_in_millis":18,"out":50,"in":100}}]},"reloads":{"successes":0,"last_success_timestamp":null,"last_error":null,"last_failure_timestamp":null,"failures":0},"queue":{"type":"memory","events_count":0,"queue_size_in_bytes":0,"max_queue_size_in_bytes":0},"hash":"f","ephemeral_id":"f"}}}` ))
4848 })),
4949 args : []string {"run" , "../main.go" , "pipeline" , "--inflight-events-warn" , "200" , "--inflight-events-crit" , "500" },
50- expected : "OK - Inflight events" ,
50+ expected : "[OK] - Inflight events" ,
5151 },
5252 {
5353 name : "pipeline-perfdata" ,
@@ -65,7 +65,7 @@ func TestPipelineCmd_Logstash7(t *testing.T) {
6565 w .Write ([]byte (`{"path": "/_node/stats/pipelines/foo","status": 404,"error": {"message": "Not Found"}}` ))
6666 })),
6767 args : []string {"run" , "../main.go" , "pipeline" , "--inflight-events-warn" , "10" , "--inflight-events-crit" , "20" , "--pipeline" , "foo" },
68- expected : "UNKNOWN - Could not get" ,
68+ expected : "[ UNKNOWN] - Could not get" ,
6969 },
7070 {
7171 name : "pipeline-inflight-warn" ,
@@ -74,7 +74,7 @@ func TestPipelineCmd_Logstash7(t *testing.T) {
7474 w .Write ([]byte (`{"host":"localhost","version":"7.17.8","http_address":"127.0.0.1:9600","id":"4","name":"test","ephemeral_id":"5","status":"green","snapshot":false,"pipeline":{"workers":2,"batch_size":125,"batch_delay":50},"pipelines":{"localhost-input":{"events":{"filtered":0,"duration_in_millis":0,"queue_push_duration_in_millis":0,"out":50,"in":100},"plugins":{"inputs":[{"id":"b","name":"beats","events":{"queue_push_duration_in_millis":0,"out":0}}],"codecs":[{"id":"plain","name":"plain","decode":{"writes_in":0,"duration_in_millis":0,"out":0},"encode":{"writes_in":0,"duration_in_millis":0}},{"id":"json","name":"json","decode":{"writes_in":0,"duration_in_millis":0,"out":0},"encode":{"writes_in":0,"duration_in_millis":0}}],"filters":[],"outputs":[{"id":"f","name":"redis","events":{"duration_in_millis":18,"out":50,"in":100}}]},"reloads":{"successes":0,"last_success_timestamp":null,"last_error":null,"last_failure_timestamp":null,"failures":0},"queue":{"type":"memory","events_count":0,"queue_size_in_bytes":0,"max_queue_size_in_bytes":0},"hash":"f","ephemeral_id":"f"}}}` ))
7575 })),
7676 args : []string {"run" , "../main.go" , "pipeline" , "--inflight-events-warn" , "25" , "--inflight-events-crit" , "60" },
77- expected : "WARNING - Inflight events" ,
77+ expected : "[ WARNING] - Inflight events" ,
7878 },
7979 {
8080 name : "pipeline-inflight-crit" ,
@@ -83,7 +83,7 @@ func TestPipelineCmd_Logstash7(t *testing.T) {
8383 w .Write ([]byte (`{"host":"localhost","version":"7.17.8","http_address":"127.0.0.1:9600","id":"4","name":"test","ephemeral_id":"5","status":"green","snapshot":false,"pipeline":{"workers":2,"batch_size":125,"batch_delay":50},"pipelines":{"localhost-input":{"events":{"filtered":0,"duration_in_millis":0,"queue_push_duration_in_millis":0,"out":50,"in":100},"plugins":{"inputs":[{"id":"b","name":"beats","events":{"queue_push_duration_in_millis":0,"out":0}}],"codecs":[{"id":"plain","name":"plain","decode":{"writes_in":0,"duration_in_millis":0,"out":0},"encode":{"writes_in":0,"duration_in_millis":0}},{"id":"json","name":"json","decode":{"writes_in":0,"duration_in_millis":0,"out":0},"encode":{"writes_in":0,"duration_in_millis":0}}],"filters":[],"outputs":[{"id":"f","name":"redis","events":{"duration_in_millis":18,"out":50,"in":100}}]},"reloads":{"successes":0,"last_success_timestamp":null,"last_error":null,"last_failure_timestamp":null,"failures":0},"queue":{"type":"memory","events_count":0,"queue_size_in_bytes":0,"max_queue_size_in_bytes":0},"hash":"f","ephemeral_id":"f"}}}` ))
8484 })),
8585 args : []string {"run" , "../main.go" , "pipeline" , "--inflight-events-warn" , "25" , "--inflight-events-crit" , "49" },
86- expected : "CRITICAL - Inflight events" ,
86+ expected : "[ CRITICAL] - Inflight events" ,
8787 },
8888 }
8989
@@ -115,7 +115,7 @@ func TestPipelineCmd_Logstash8(t *testing.T) {
115115 w .Write ([]byte (`{"host":"localhost","version":"8.6","http_address":"127.0.0.1:9600","id":"4","name":"test","ephemeral_id":"5","status":"green","snapshot":false,"pipeline":{"workers":2,"batch_size":125,"batch_delay":50},"pipelines":{"localhost-input":{"events":{"filtered":0,"duration_in_millis":0,"queue_push_duration_in_millis":0,"out":50,"in":100},"plugins":{"inputs":[{"id":"b","name":"beats","events":{"queue_push_duration_in_millis":0,"out":0}}],"codecs":[{"id":"plain","name":"plain","decode":{"writes_in":0,"duration_in_millis":0,"out":0},"encode":{"writes_in":0,"duration_in_millis":0}},{"id":"json","name":"json","decode":{"writes_in":0,"duration_in_millis":0,"out":0},"encode":{"writes_in":0,"duration_in_millis":0}}],"filters":[],"outputs":[{"id":"f","name":"redis","events":{"duration_in_millis":18,"out":50,"in":100}}]},"reloads":{"successes":0,"last_success_timestamp":null,"last_error":null,"last_failure_timestamp":null,"failures":0},"queue":{"type":"memory","events_count":0,"queue_size_in_bytes":0,"max_queue_size_in_bytes":0},"hash":"f","ephemeral_id":"f"}}}` ))
116116 })),
117117 args : []string {"run" , "../main.go" , "pipeline" , "--inflight-events-warn" , "200" , "--inflight-events-crit" , "500" },
118- expected : "OK - Inflight events" ,
118+ expected : "[OK] - Inflight events" ,
119119 },
120120 {
121121 name : "pipeline-reload-no-success" ,
@@ -124,7 +124,7 @@ func TestPipelineCmd_Logstash8(t *testing.T) {
124124 w .Write ([]byte (`{"host":"localhost","version":"8.6","http_address":"127.0.0.1:9600","id":"4","name":"test","ephemeral_id":"5","status":"green","snapshot":false,"pipeline":{"workers":2,"batch_size":125,"batch_delay":50},"pipelines":{"localhost-input":{"events":{"filtered":0,"duration_in_millis":0,"queue_push_duration_in_millis":0,"out":50,"in":100},"plugins":{"inputs":[{"id":"b","name":"beats","events":{"queue_push_duration_in_millis":0,"out":0}}],"codecs":[{"id":"plain","name":"plain","decode":{"writes_in":0,"duration_in_millis":0,"out":0},"encode":{"writes_in":0,"duration_in_millis":0}},{"id":"json","name":"json","decode":{"writes_in":0,"duration_in_millis":0,"out":0},"encode":{"writes_in":0,"duration_in_millis":0}}],"filters":[],"outputs":[{"id":"f","name":"redis","events":{"duration_in_millis":18,"out":50,"in":100}}]},"reloads":{"successes":0,"last_success_timestamp":"","last_error":null,"last_failure_timestamp":"2020-10-11T01:10:10.11Z","failures":0},"queue":{"type":"memory","events_count":0,"queue_size_in_bytes":0,"max_queue_size_in_bytes":0},"hash":"f","ephemeral_id":"f"}}}` ))
125125 })),
126126 args : []string {"run" , "../main.go" , "pipeline" , "reload" },
127- expected : "UNKNOWN - Configuration reload status unknown" ,
127+ expected : "[ UNKNOWN] - Configuration reload status unknown" ,
128128 },
129129 {
130130 name : "pipeline-reload-not-timestamp" ,
@@ -160,7 +160,7 @@ func TestPipelineCmd_Logstash8(t *testing.T) {
160160 w .Write ([]byte (`{"path": "/_node/stats/pipelines/foo","status": 404,"error": {"message": "Not Found"}}` ))
161161 })),
162162 args : []string {"run" , "../main.go" , "pipeline" , "reload" , "--pipeline" , "foo" },
163- expected : "UNKNOWN - Could not get" ,
163+ expected : "[ UNKNOWN] - Could not get" ,
164164 },
165165 {
166166 name : "pipeline-flow-ok" ,
@@ -178,7 +178,7 @@ func TestPipelineCmd_Logstash8(t *testing.T) {
178178 w .Write ([]byte (`{"host":"foobar","version":"8.7.1","http_address":"127.0.0.1:9600","id":"4","name":"test","ephemeral_id":"5","status":"green","snapshot":false,"pipeline":{"workers":2,"batch_size":125,"batch_delay":50},"pipelines":{"ansible-input":{"flow":{"queue_backpressure":{"current":10,"last_1_minute":0,"lifetime":2.503e-05},"output_throughput":{"current":0,"last_1_minute":0.344,"lifetime":0.7051},"input_throughput":{"current":10,"last_1_minute":0.5734,"lifetime":1.089},"worker_concurrency":{"current":0.0001815,"last_1_minute":0.0009501,"lifetime":0.003384},"filter_throughput":{"current":0,"last_1_minute":0.5734,"lifetime":1.089}},"events":{"filtered":0,"duration_in_millis":0,"queue_push_duration_in_millis":0,"out":50,"in":100},"queue":{"type":"memory","events_count":0,"queue_size_in_bytes":0,"max_queue_size_in_bytes":0},"hash":"f","ephemeral_id":"f"}}}` ))
179179 })),
180180 args : []string {"run" , "../main.go" , "pipeline" , "flow" , "--warning" , "1" , "--critical" , "2" },
181- expected : "CRITICAL - Flow metrics not alright" ,
181+ expected : "[ CRITICAL] - Flow metrics not alright" ,
182182 },
183183 }
184184
0 commit comments