chore: lint

Signed-off-by: Manik Rana <manikrana54@gmail.com>
This commit is contained in:
Manik Rana 2024-07-12 01:07:06 +05:30
parent 5d19275c01
commit b8fcacddda

View file

@ -815,106 +815,106 @@ foobar{quantile="0.99"} 150.0`
ct *int64 ct *int64
typ model.MetricType typ model.MetricType
help string help string
expErr bool isErr bool
} }
exp := []expectCT{ exp := []expectCT{
{ {
m: "something", m: "something",
help: "Histogram with _created between buckets and summary", help: "Histogram with _created between buckets and summary",
expErr: false, isErr: false,
}, { }, {
m: "something", m: "something",
typ: model.MetricTypeHistogram, typ: model.MetricTypeHistogram,
expErr: false, isErr: false,
}, { }, {
m: `something_count`, m: `something_count`,
ct: int64p(1520430001), ct: int64p(1520430001),
expErr: false, isErr: false,
}, { }, {
m: `something_sum`, m: `something_sum`,
ct: int64p(1520430001), ct: int64p(1520430001),
expErr: false, isErr: false,
}, { }, {
m: `something_bucket{le="0.0"}`, m: `something_bucket{le="0.0"}`,
ct: int64p(1520430001), ct: int64p(1520430001),
expErr: true, isErr: true,
}, { }, {
m: `something_bucket{le="+Inf"}`, m: `something_bucket{le="+Inf"}`,
ct: int64p(1520430001), ct: int64p(1520430001),
expErr: true, isErr: true,
}, { }, {
m: "thing", m: "thing",
help: "Histogram with _created as first line", help: "Histogram with _created as first line",
expErr: false, isErr: false,
}, { }, {
m: "thing", m: "thing",
typ: model.MetricTypeHistogram, typ: model.MetricTypeHistogram,
expErr: false, isErr: false,
}, { }, {
m: `thing_count`, m: `thing_count`,
ct: int64p(1520430002), ct: int64p(1520430002),
expErr: true, isErr: true,
}, { }, {
m: `thing_sum`, m: `thing_sum`,
ct: int64p(1520430002), ct: int64p(1520430002),
expErr: true, isErr: true,
}, { }, {
m: `thing_bucket{le="0.0"}`, m: `thing_bucket{le="0.0"}`,
ct: int64p(1520430002), ct: int64p(1520430002),
expErr: true, isErr: true,
}, { }, {
m: `thing_bucket{le="+Inf"}`, m: `thing_bucket{le="+Inf"}`,
ct: int64p(1520430002), ct: int64p(1520430002),
expErr: true, isErr: true,
}, { }, {
m: "yum", m: "yum",
help: "Summary with _created between summary and quantiles", help: "Summary with _created between summary and quantiles",
expErr: false, isErr: false,
}, { }, {
m: "yum", m: "yum",
typ: model.MetricTypeSummary, typ: model.MetricTypeSummary,
expErr: false, isErr: false,
}, { }, {
m: "yum_count", m: "yum_count",
ct: int64p(1520430003), ct: int64p(1520430003),
expErr: false, isErr: false,
}, { }, {
m: "yum_sum", m: "yum_sum",
ct: int64p(1520430003), ct: int64p(1520430003),
expErr: false, isErr: false,
}, { }, {
m: `yum{quantile="0.95"}`, m: `yum{quantile="0.95"}`,
ct: int64p(1520430003), ct: int64p(1520430003),
expErr: true, isErr: true,
}, { }, {
m: `yum{quantile="0.99"}`, m: `yum{quantile="0.99"}`,
ct: int64p(1520430003), ct: int64p(1520430003),
expErr: true, isErr: true,
}, { }, {
m: "foobar", m: "foobar",
help: "Summary with _created as the first line", help: "Summary with _created as the first line",
expErr: false, isErr: false,
}, { }, {
m: "foobar", m: "foobar",
typ: model.MetricTypeSummary, typ: model.MetricTypeSummary,
expErr: false, isErr: false,
}, { }, {
m: "foobar_count", m: "foobar_count",
ct: int64p(1520430004), ct: int64p(1520430004),
expErr: true, isErr: true,
}, { }, {
m: "foobar_sum", m: "foobar_sum",
ct: int64p(1520430004), ct: int64p(1520430004),
expErr: true, isErr: true,
}, { }, {
m: `foobar{quantile="0.95"}`, m: `foobar{quantile="0.95"}`,
ct: int64p(1520430004), ct: int64p(1520430004),
expErr: true, isErr: true,
}, { }, {
m: `foobar{quantile="0.99"}`, m: `foobar{quantile="0.99"}`,
ct: int64p(1520430004), ct: int64p(1520430004),
expErr: true, isErr: true,
}, },
} }
@ -933,7 +933,7 @@ foobar{quantile="0.99"} 150.0`
case EntrySeries: case EntrySeries:
p.Metric(&res) p.Metric(&res)
if ct := p.CreatedTimestamp(); exp[i].expErr { if ct := p.CreatedTimestamp(); exp[i].isErr {
require.Nil(t, ct) require.Nil(t, ct)
} else { } else {
require.Equal(t, *exp[i].ct, *ct) require.Equal(t, *exp[i].ct, *ct)