Skip to content

Commit

Permalink
Fix AWS module flaky tests (elastic#24852)
Browse files Browse the repository at this point in the history
  • Loading branch information
kaiyan-sheng authored Apr 12, 2021
1 parent 8c9397f commit 485c737
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 3 deletions.
12 changes: 12 additions & 0 deletions metricbeat/docs/fields.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3263,6 +3263,18 @@ type: long



*`aws.rds.burst_balance.pct`*::
+
--
The percent of General Purpose SSD (gp2) burst-bucket I/O credits available.


type: scaled_float

format: percent

--

*`aws.rds.cpu.total.pct`*::
+
--
Expand Down
11 changes: 9 additions & 2 deletions metricbeat/mb/testing/testdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ func TestMetricsetFieldsDocumented(t *testing.T, metricSet mb.MetricSet, events
}

if err := checkDocumented(data, nil); err != nil {
t.Errorf("%v: check if fields are documented in `metricbeat/%s/%s/_meta/fields.yml` "+
t.Errorf("%v: check if fields are documented in `metricbeat/module/%s/%s/_meta/fields.yml` "+
"file or run 'make update' on Metricbeat folder to update fields in `metricbeat/fields.yml`",
err, metricSet.Module().Name(), metricSet.Name())
}
Expand Down Expand Up @@ -232,7 +232,7 @@ func runTest(t *testing.T, file string, module, metricSetName string, config Dat
})

if err := checkDocumented(data, config.OmitDocumentedFieldsCheck); err != nil {
t.Errorf("%v: check if fields are documented in `metricbeat/%s/%s/_meta/fields.yml` "+
t.Errorf("%v: check if fields are documented in `metricbeat/module/%s/%s/_meta/fields.yml` "+
"file or run 'make update' on Metricbeat folder to update fields in `metricbeat/fields.yml`",
err, module, metricSetName)
}
Expand Down Expand Up @@ -378,6 +378,13 @@ func documentedFieldCheck(foundKeys common.MapStr, knownKeys map[string]interfac
}
}

// case `aws.*.metrics.*.*`:
if len(splits) == 5 {
if _, ok := knownKeys[splits[0]+".*."+splits[2]+".*.*"]; ok {
continue
}
}

return errors.Errorf("field missing '%s'", foundKey)
}
}
Expand Down
Loading

0 comments on commit 485c737

Please sign in to comment.