newJsonParser function is now unexported, must use NewParser(config)

This commit is contained in:
Max U
2018-06-28 15:35:20 -07:00
parent 7f2b2a08ae
commit 4db667573a
11 changed files with 81 additions and 51 deletions

View File

@@ -26,7 +26,11 @@ func TestHTTPwithJSONFormat(t *testing.T) {
URLs: []string{url},
}
metricName := "metricName"
p, _ := parsers.NewJSONParser(metricName, nil, nil, nil)
config := &parsers.Config{
DataFormat: "json",
MetricName: "metricName",
}
p, _ := parsers.NewParser(config)
plugin.SetParser(p)
var acc testutil.Accumulator
@@ -63,8 +67,12 @@ func TestHTTPHeaders(t *testing.T) {
URLs: []string{url},
Headers: map[string]string{header: headerValue},
}
metricName := "metricName"
p, _ := parsers.NewJSONParser(metricName, nil, nil, nil)
config := &parsers.Config{
DataFormat: "json",
MetricName: "metricName",
}
p, _ := parsers.NewParser(config)
plugin.SetParser(p)
var acc testutil.Accumulator
@@ -83,7 +91,11 @@ func TestInvalidStatusCode(t *testing.T) {
}
metricName := "metricName"
p, _ := parsers.NewJSONParser(metricName, nil, nil, nil)
config := &parsers.Config{
DataFormat: "json",
MetricName: metricName,
}
p, _ := parsers.NewParser(config)
plugin.SetParser(p)
var acc testutil.Accumulator
@@ -105,8 +117,11 @@ func TestMethod(t *testing.T) {
Method: "POST",
}
metricName := "metricName"
p, _ := parsers.NewJSONParser(metricName, nil, nil, nil)
config := &parsers.Config{
DataFormat: "json",
MetricName: "metricName",
}
p, _ := parsers.NewParser(config)
plugin.SetParser(p)
var acc testutil.Accumulator