diff --git a/src/go/plugin/go.d/collector/apache/collector_test.go b/src/go/plugin/go.d/collector/apache/collector_test.go index 8899fb550bf33a..c1163f9d3f4c83 100644 --- a/src/go/plugin/go.d/collector/apache/collector_test.go +++ b/src/go/plugin/go.d/collector/apache/collector_test.go @@ -53,19 +53,19 @@ func TestCollector_Init(t *testing.T) { wantFail: false, config: New().Config, }, - "fail when URL not set": { - wantFail: true, + "success when URL has no wantMetrics suffix": { + wantFail: false, config: Config{ HTTPConfig: web.HTTPConfig{ - RequestConfig: web.RequestConfig{URL: ""}, + RequestConfig: web.RequestConfig{URL: "http://127.0.0.1:38001"}, }, }, }, - "fail when URL has no wantMetrics suffix": { + "fail when URL not set": { wantFail: true, config: Config{ HTTPConfig: web.HTTPConfig{ - RequestConfig: web.RequestConfig{URL: "http://127.0.0.1:38001"}, + RequestConfig: web.RequestConfig{URL: ""}, }, }, }, diff --git a/src/go/plugin/go.d/collector/apache/init.go b/src/go/plugin/go.d/collector/apache/init.go index d27947d5895ee0..4c1ceec1f5e975 100644 --- a/src/go/plugin/go.d/collector/apache/init.go +++ b/src/go/plugin/go.d/collector/apache/init.go @@ -15,7 +15,7 @@ func (c *Collector) validateConfig() error { return errors.New("url not set") } if !strings.HasSuffix(c.URL, "?auto") { - return errors.New("invalid URL, should ends in '?auto'") + c.Warningf("missing '?auto' parameter - needed for machine-readable output") } return nil }