You've already forked nginx_exporter
mirror of
https://github.com/nginxinc/nginx-prometheus-exporter.git
synced 2025-07-30 10:03:04 +03:00
Simple parsing nginx metrics [parseStubStats] (#207)
This commit is contained in:
committed by
GitHub
parent
d14781a6bd
commit
c636d826c1
@ -1,6 +1,9 @@
|
||||
package client
|
||||
|
||||
import "testing"
|
||||
import (
|
||||
"bytes"
|
||||
"testing"
|
||||
)
|
||||
|
||||
const validStabStats = "Active connections: 1457 \nserver accepts handled requests\n 6717066 6717066 65844359 \nReading: 1 Writing: 8 Waiting: 1448 \n"
|
||||
|
||||
@ -32,15 +35,14 @@ func TestParseStubStatsValidInput(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, test := range tests {
|
||||
var result StubStats
|
||||
|
||||
err := parseStubStats(test.input, &result)
|
||||
r := bytes.NewReader(test.input)
|
||||
result, err := parseStubStats(r)
|
||||
|
||||
if err != nil && !test.expectedError {
|
||||
t.Errorf("parseStubStats() returned error for valid input %q: %v", string(test.input), err)
|
||||
}
|
||||
|
||||
if !test.expectedError && test.expectedResult != result {
|
||||
if !test.expectedError && test.expectedResult != *result {
|
||||
t.Errorf("parseStubStats() result %v != expected %v for input %q", result, test.expectedResult, test.input)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user