Skip to content

Commit

Permalink
Fix AWS module flaky tests (#24852) (#25024)
Browse files Browse the repository at this point in the history
(cherry picked from commit 6e6666c)
  • Loading branch information
kaiyan-sheng committed Apr 13, 2021
1 parent 5b3122f commit bcfecfd
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 bcfecfd

Please sign in to comment.