Skip to content

Commit 9b03382

Browse files
committed
add test coverage
Signed-off-by: ChrsMark <[email protected]>
1 parent c40ff18 commit 9b03382

5 files changed

Lines changed: 60 additions & 3 deletions

File tree

cmd/mdatagen/internal/loader_test.go

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,16 @@ func TestLoadMetadata(t *testing.T) {
519519
want: Metadata{},
520520
wantErr: "decoding failed due to the following error(s):\n\n'attributes[used_attr].type' invalid type: \"invalidtype\"",
521521
},
522+
{
523+
name: "testdata/invalid_metric_stability.yaml",
524+
want: Metadata{},
525+
wantErr: "decoding failed due to the following error(s):\n\n'metrics[default.metric]' decoding failed due to the following error(s):\n\n'stability' decoding failed due to the following error(s):\n\n'level' unsupported stability level: \"development42\"",
526+
},
527+
{
528+
name: "testdata/no_metric_stability.yaml",
529+
want: Metadata{},
530+
wantErr: "decoding failed due to the following error(s):\n\n'metrics[default.metric]' decoding failed due to the following error(s):\n\n'stability' missing required field: `stability.level`",
531+
},
522532
{
523533
name: "testdata/~~this file doesn't exist~~.yaml",
524534
wantErr: "unable to read the file file:testdata/~~this file doesn't exist~~.yaml",

cmd/mdatagen/internal/samplefactoryreceiver/internal/metadata/generated_telemetry.go

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
type: metricreceiver
2+
3+
status:
4+
class: receiver
5+
stability:
6+
development: [logs]
7+
beta: [traces]
8+
stable: [metrics]
9+
distributions: [contrib]
10+
warnings:
11+
- Any additional information that should be brought to the consumer's attention
12+
13+
metrics:
14+
default.metric:
15+
enabled: true
16+
description: Monotonic cumulative sum int metric enabled by default.
17+
extended_documentation: The metric will be become optional soon.
18+
stability:
19+
level: development42
20+
unit: s
21+
sum:
22+
value_type: int
23+
monotonic: true
24+
aggregation_temporality: cumulative
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
type: metricreceiver
2+
3+
status:
4+
class: receiver
5+
stability:
6+
development: [logs]
7+
beta: [traces]
8+
stable: [metrics]
9+
distributions: [contrib]
10+
warnings:
11+
- Any additional information that should be brought to the consumer's attention
12+
13+
metrics:
14+
default.metric:
15+
enabled: true
16+
description: Monotonic cumulative sum int metric enabled by default.
17+
extended_documentation: The metric will be become optional soon.
18+
stability: ~
19+
unit: s
20+
sum:
21+
value_type: int
22+
monotonic: true
23+
aggregation_temporality: cumulative

receiver/otlpreceiver/otlp_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1322,7 +1322,7 @@ func assertReceiverTraces(t *testing.T, tt *componenttest.Telemetry, id componen
13221322
metricdatatest.AssertEqual(t,
13231323
metricdata.Metrics{
13241324
Name: "otelcol_receiver_failed_spans",
1325-
Description: "The number of spans that failed to be processed by the receiver due to internal errors. [alpha]",
1325+
Description: "The number of spans that failed to be processed by the receiver due to internal errors. [Alpha]",
13261326
Unit: "{spans}",
13271327
Data: metricdata.Sum[int64]{
13281328
Temporality: metricdata.CumulativeTemporality,

0 commit comments

Comments
 (0)