Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Metricbeat] Add reporting interface with error #10727

Merged
merged 14 commits into from
Mar 6, 2019
Prev Previous commit
Next Next commit
make data_test compatible with both interfaces
  • Loading branch information
ruflin committed Mar 6, 2019
commit 5f4dce41ad21482140a71b9d58d5a53b2abd07cf
17 changes: 15 additions & 2 deletions metricbeat/mb/testing/data_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,21 @@ func runTest(t *testing.T, file string, module, metricSetName, url string) {
s := server(t, file, url)
defer s.Close()

metricSet := NewReportingMetricSetV2(t, getConfig(module, metricSetName, s.URL))
events, errs := ReportingFetchV2(metricSet)
metricSet := newMetricSet(t, getConfig(module, metricSetName, s.URL))

var events []mb.Event
var errs []error

switch v := metricSet.(type) {
case mb.ReportingMetricSetV2:
metricSet := NewReportingMetricSetV2(t, getConfig(module, metricSetName, s.URL))
events, errs = ReportingFetchV2(metricSet)
case mb.ReportingMetricSetV2Error:
metricSet := NewReportingMetricSetV2Error(t, getConfig(module, metricSetName, s.URL))
events, errs = ReportingFetchV2Error(metricSet)
default:
t.Fatalf("unknown type: %T", v)
}

// Gather errors to build also error events
for _, e := range errs {
Expand Down