Skip to content

x-pack/metricbeat: multiple unit tests failures on macOS arm64 #40496

Open

Description

Failed Tests

  • Test Names:
  1. x-pack/metricbeat/module/cockroachdb/status TestEventMapping/cockroachdb-status.v19.1.1.plain
  2. x-pack/metricbeat/module/cockroachdb/status TestEventMapping
  3. x-pack/metricbeat/module/coredns/stats TestData/coredns_1.5.0.plain
  4. x-pack/metricbeat/module/coredns/stats TestData/docs.plain
  5. x-pack/metricbeat/module/coredns/stats TestData/prometheus_full_output.plain
  6. x-pack/metricbeat/module/coredns/stats TestData/request_duration.plain
  7. x-pack/metricbeat/module/coredns/stats TestData/request_size.plain
  8. x-pack/metricbeat/module/coredns/stats TestData/response_size.plain
  9. x-pack/metricbeat/module/coredns/stats TestData
  10. x-pack/metricbeat/module/istio/citadel TestData/docs.plain
  11. x-pack/metricbeat/module/istio/citadel TestData
  12. x-pack/metricbeat/module/istio/galley TestData/docs.plain
  13. x-pack/metricbeat/module/istio/galley TestData
  14. x-pack/metricbeat/module/istio/mesh TestData/docs.plain
  15. x-pack/metricbeat/module/istio/mesh TestData
  16. x-pack/metricbeat/module/istio/proxy TestEventMapping/proxy.v1.7.1.plain
  17. x-pack/metricbeat/module/istio/proxy TestEventMapping
  18. x-pack/metricbeat/module/prometheus/collector TestPromHistogramToES/new_bucket_between_two_other_buckets_on_the_go
  19. x-pack/metricbeat/module/prometheus/collector TestPromHistogramToES
  • Link:
  1. x-pack/metricbeat/module/cockroachdb/status TestEventMapping
    func TestEventMapping(t *testing.T) {
    logp.TestingSetup()
    mbtest.TestDataFiles(t, "cockroachdb", "status")
    }
  2. x-pack/metricbeat/module/coredns/stats TestData
    func TestData(t *testing.T) {
    mbtest.TestDataFiles(t, "coredns", "stats")
    }
  3. x-pack/metricbeat/module/istio/citadel TestData
    func TestData(t *testing.T) {
    mbtest.TestDataFiles(t, "istio", "citadel")
    }
  4. x-pack/metricbeat/module/istio/galley TestData
    func TestData(t *testing.T) {
    mbtest.TestDataFiles(t, "istio", "galley")
    }
  5. x-pack/metricbeat/module/istio/mesh TestData
    func TestData(t *testing.T) {
    mbtest.TestDataFiles(t, "istio", "mesh")
    }
  6. x-pack/metricbeat/module/istio/proxy
    func TestEventMapping(t *testing.T) {
    logp.TestingSetup()
    mbtest.TestDataFiles(t, "istio", "proxy")
    }
  7. x-pack/metricbeat/module/prometheus/collector TestPromHistogramToES
    func TestPromHistogramToES(t *testing.T) {
    type sample struct {
    histogram p.Histogram
    expected mapstr.M
    }
    cases := map[string]struct {
    samples []sample
    }{
    "one histogram": {
    samples: []sample{
    {
    histogram: p.Histogram{
    SampleCount: proto.Uint64(10),
    SampleSum: proto.Float64(10),
    Bucket: []*p.Bucket{
    {
    UpperBound: proto.Float64(0.99),
    CumulativeCount: proto.Uint64(10),
    },
    },
    },
    expected: mapstr.M{
    "counts": []uint64{0},
    "values": []float64{0.495},
    },
    },
    },
    },
    "two histogram": {
    samples: []sample{
    {
    histogram: p.Histogram{
    SampleCount: proto.Uint64(10),
    SampleSum: proto.Float64(10),
    Bucket: []*p.Bucket{
    {
    UpperBound: proto.Float64(0.99),
    CumulativeCount: proto.Uint64(10),
    },
    },
    },
    expected: mapstr.M{
    "counts": []uint64{0},
    "values": []float64{0.495},
    },
    },
    {
    histogram: p.Histogram{
    SampleCount: proto.Uint64(12),
    SampleSum: proto.Float64(10.123),
    Bucket: []*p.Bucket{
    {
    UpperBound: proto.Float64(0.99),
    CumulativeCount: proto.Uint64(12),
    },
    },
    },
    expected: mapstr.M{
    "counts": []uint64{2},
    "values": []float64{0.495},
    },
    },
    },
    },
    "new bucket on the go": {
    samples: []sample{
    {
    histogram: p.Histogram{
    SampleCount: proto.Uint64(10),
    SampleSum: proto.Float64(10),
    Bucket: []*p.Bucket{
    {
    UpperBound: proto.Float64(0.99),
    CumulativeCount: proto.Uint64(10),
    },
    },
    },
    expected: mapstr.M{
    "counts": []uint64{0},
    "values": []float64{0.495},
    },
    },
    {
    histogram: p.Histogram{
    SampleCount: proto.Uint64(13),
    SampleSum: proto.Float64(15.23),
    Bucket: []*p.Bucket{
    {
    UpperBound: proto.Float64(0.99),
    CumulativeCount: proto.Uint64(12),
    },
    // New bucket on the go
    {
    UpperBound: proto.Float64(9.99),
    CumulativeCount: proto.Uint64(13),
    },
    },
    },
    expected: mapstr.M{
    "counts": []uint64{2, 0},
    "values": []float64{0.495, 5.49},
    },
    },
    {
    histogram: p.Histogram{
    SampleCount: proto.Uint64(15),
    SampleSum: proto.Float64(16.33),
    Bucket: []*p.Bucket{
    {
    UpperBound: proto.Float64(0.99),
    CumulativeCount: proto.Uint64(13),
    },
    {
    UpperBound: proto.Float64(9.99),
    CumulativeCount: proto.Uint64(15),
    },
    },
    },
    expected: mapstr.M{
    "counts": []uint64{1, 1},
    "values": []float64{0.495, 5.49},
    },
    },
    {
    histogram: p.Histogram{
    SampleCount: proto.Uint64(16),
    SampleSum: proto.Float64(16.33),
    Bucket: []*p.Bucket{
    {
    UpperBound: proto.Float64(0.99),
    CumulativeCount: proto.Uint64(13),
    },
    {
    UpperBound: proto.Float64(9.99),
    CumulativeCount: proto.Uint64(16),
    },
    },
    },
    expected: mapstr.M{
    "counts": []uint64{0, 1},
    "values": []float64{0.495, 5.49},
    },
    },
    },
    },
    "new smaller bucket on the go": {
    samples: []sample{
    {
    histogram: p.Histogram{
    SampleCount: proto.Uint64(10),
    SampleSum: proto.Float64(10),
    Bucket: []*p.Bucket{
    {
    UpperBound: proto.Float64(0.99),
    CumulativeCount: proto.Uint64(10),
    },
    },
    },
    expected: mapstr.M{
    "counts": []uint64{0},
    "values": []float64{0.495},
    },
    },
    {
    histogram: p.Histogram{
    SampleCount: proto.Uint64(13),
    SampleSum: proto.Float64(15.23),
    Bucket: []*p.Bucket{
    // New bucket on the go
    {
    UpperBound: proto.Float64(0.09),
    CumulativeCount: proto.Uint64(1),
    },
    {
    UpperBound: proto.Float64(0.99),
    CumulativeCount: proto.Uint64(13),
    },
    },
    },
    expected: mapstr.M{
    "counts": []uint64{0, 2},
    "values": []float64{0.045, 0.54},
    },
    },
    {
    histogram: p.Histogram{
    SampleCount: proto.Uint64(15),
    SampleSum: proto.Float64(16.33),
    Bucket: []*p.Bucket{
    {
    UpperBound: proto.Float64(0.09),
    CumulativeCount: proto.Uint64(2),
    },
    {
    UpperBound: proto.Float64(0.99),
    CumulativeCount: proto.Uint64(15),
    },
    },
    },
    expected: mapstr.M{
    "counts": []uint64{1, 1},
    "values": []float64{0.045, 0.54},
    },
    },
    {
    histogram: p.Histogram{
    SampleCount: proto.Uint64(16),
    SampleSum: proto.Float64(16.33),
    Bucket: []*p.Bucket{
    {
    UpperBound: proto.Float64(0.09),
    CumulativeCount: proto.Uint64(3),
    },
    {
    UpperBound: proto.Float64(0.99),
    CumulativeCount: proto.Uint64(16),
    },
    },
    },
    expected: mapstr.M{
    "counts": []uint64{1, 0},
    "values": []float64{0.045, 0.54},
    },
    },
    },
    },
    "new bucket between two other buckets on the go": {
    samples: []sample{
    {
    histogram: p.Histogram{
    SampleCount: proto.Uint64(10),
    SampleSum: proto.Float64(10),
    Bucket: []*p.Bucket{
    {
    UpperBound: proto.Float64(0.09),
    CumulativeCount: proto.Uint64(0),
    },
    {
    UpperBound: proto.Float64(0.99),
    CumulativeCount: proto.Uint64(10),
    },
    },
    },
    expected: mapstr.M{
    "counts": []uint64{0, 0},
    "values": []float64{0.045, 0.54},
    },
    },
    {
    histogram: p.Histogram{
    SampleCount: proto.Uint64(13),
    SampleSum: proto.Float64(15.23),
    Bucket: []*p.Bucket{
    {
    UpperBound: proto.Float64(0.09),
    CumulativeCount: proto.Uint64(1),
    },
    // New bucket
    {
    UpperBound: proto.Float64(0.49),
    CumulativeCount: proto.Uint64(2),
    },
    {
    UpperBound: proto.Float64(0.99),
    CumulativeCount: proto.Uint64(13),
    },
    },
    },
    expected: mapstr.M{
    "counts": []uint64{1, 0, 1},
    "values": []float64{0.045, 0.29000000000000004, 0.74},
    },
    },
    {
    histogram: p.Histogram{
    SampleCount: proto.Uint64(16),
    SampleSum: proto.Float64(16.33),
    Bucket: []*p.Bucket{
    {
    UpperBound: proto.Float64(0.09),
    CumulativeCount: proto.Uint64(2),
    },
    {
    UpperBound: proto.Float64(0.49),
    CumulativeCount: proto.Uint64(4),
    },
    {
    UpperBound: proto.Float64(0.99),
    CumulativeCount: proto.Uint64(16),
    },
    },
    },
    expected: mapstr.M{
    "counts": []uint64{1, 1, 1},
    "values": []float64{0.045, 0.29000000000000004, 0.74},
    },
    },
    {
    histogram: p.Histogram{
    SampleCount: proto.Uint64(18),
    SampleSum: proto.Float64(16.33),
    Bucket: []*p.Bucket{
    {
    UpperBound: proto.Float64(0.09),
    CumulativeCount: proto.Uint64(3),
    },
    {
    UpperBound: proto.Float64(0.49),
    CumulativeCount: proto.Uint64(5),
    },
    {
    UpperBound: proto.Float64(0.99),
    CumulativeCount: proto.Uint64(18),
    },
    },
    },
    expected: mapstr.M{
    "counts": []uint64{1, 0, 1},
    "values": []float64{0.045, 0.29000000000000004, 0.74},
    },
    },
    },
    },
    "wrong buckets": {
    samples: []sample{
    {
    histogram: p.Histogram{
    SampleCount: proto.Uint64(10),
    SampleSum: proto.Float64(10),
    Bucket: []*p.Bucket{
    {
    UpperBound: proto.Float64(0.09),
    CumulativeCount: proto.Uint64(10),
    },
    {
    UpperBound: proto.Float64(0.99),
    CumulativeCount: proto.Uint64(8),
    },
    },
    },
    expected: mapstr.M{
    "counts": []uint64{0, 0},
    "values": []float64{0.045, 0.54},
    },
    },
    {
    histogram: p.Histogram{
    SampleCount: proto.Uint64(12),
    SampleSum: proto.Float64(10.45),
    Bucket: []*p.Bucket{
    {
    UpperBound: proto.Float64(0.09),
    CumulativeCount: proto.Uint64(12),
    },
    {
    UpperBound: proto.Float64(0.99),
    CumulativeCount: proto.Uint64(8),
    },
    },
    },
    expected: mapstr.M{
    "counts": []uint64{2, 0},
    "values": []float64{0.045, 0.54},
    },
    },
    },
    },
    "histogram with negative buckets": {
    samples: []sample{
    {
    histogram: p.Histogram{
    SampleCount: proto.Uint64(30),
    SampleSum: proto.Float64(5),
    Bucket: []*p.Bucket{
    {
    UpperBound: proto.Float64(-100),
    CumulativeCount: proto.Uint64(2),
    },
    {
    UpperBound: proto.Float64(-99),
    CumulativeCount: proto.Uint64(10),
    },
    {
    UpperBound: proto.Float64(0),
    CumulativeCount: proto.Uint64(30),
    },
    },
    },
    expected: mapstr.M{
    // rate of the first bucket is always 0, meaning that it was not increased as it is the first
    // count rate: [0, 8, 20]
    "counts": []uint64{0, 0, 0},
    "values": []float64{-100, -99.5, -49.5},
    },
    },
    {
    histogram: p.Histogram{
    SampleCount: proto.Uint64(100),
    SampleSum: proto.Float64(20),
    Bucket: []*p.Bucket{
    {
    UpperBound: proto.Float64(-100),
    CumulativeCount: proto.Uint64(5),
    },
    {
    UpperBound: proto.Float64(-99),
    CumulativeCount: proto.Uint64(16),
    },
    {
    UpperBound: proto.Float64(0),
    CumulativeCount: proto.Uint64(100),
    },
    },
    },
    expected: mapstr.M{
    // counts calculation:
    // UpperBound -100: 5-2
    // UpperBound -99: 16 - 5 (undo accumulation) - 8 (calculate rate)
    // UpperBound 0: 100 - 16 (undo accumulation) - 20 (calculate rate)
    "counts": []uint64{3, 3, 64},
    "values": []float64{-100, -99.5, -49.5},
    },
    },
    },
    },
    }
    metricName := "somemetric"
    labels := mapstr.M{}
    for title, c := range cases {
    t.Run(title, func(t *testing.T) {
    cache := NewCounterCache(120 * time.Minute)
    for i, s := range c.samples {
    t.Logf("#%d: %+v", i, s.histogram)
    result := PromHistogramToES(cache, metricName, labels, &s.histogram)
    assert.EqualValues(t, s.expected, result)
    }
    })
    }
    }

Creating new issue, since #33036 was Jenkins related.

To execute tests on CI:

  1. Comment skip condition for :mac: x-pack/metricbeat macOS arm64 Unit Tests step
  2. Add macOS label on PR, otherwise tests won't be executed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Team:Cloudnative-MonitoringLabel for the Cloud Native Monitoring teamTeam:Obs-InfraObsLabel for the Observability Infrastructure Monitoring teamflaky-testUnstable or unreliable test cases.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions