Skip to content
This repository was archived by the owner on Oct 3, 2023. It is now read-only.

Commit 76f086b

Browse files
rghetiabogdandrutu
authored andcommitted
Unit test using input and output proto files (#223)
* use input/output files for protos in test. * remove proto generated from code. * update resource test to use files. * use generic data file for scale test. * remove unused files. * replace panic with t.Fatalf * refactor testdata files.
1 parent 4339afa commit 76f086b

17 files changed

Lines changed: 2103 additions & 1196 deletions

File tree

metrics_proto_api_test.go

Lines changed: 181 additions & 1196 deletions
Large diffs are not rendered by default.
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
metric_descriptor: <
2+
name: "ocagent.io/calls"
3+
description: "Number of calls"
4+
unit: "1"
5+
type: CUMULATIVE_INT64
6+
label_keys: <
7+
key: "empty_key"
8+
>
9+
label_keys: <
10+
key: "operation_type"
11+
>
12+
>
13+
timeseries: <
14+
start_timestamp: <
15+
seconds: 1543160298
16+
nanos: 100000090
17+
>
18+
label_values: <
19+
has_value: true
20+
>
21+
label_values: <
22+
value: "test_1"
23+
has_value: true
24+
>
25+
points: <
26+
timestamp: <
27+
seconds: 1543160298
28+
nanos: 100000997
29+
>
30+
int64_value: 1
31+
>
32+
>
33+
timeseries: <
34+
start_timestamp: <
35+
seconds: 1543160298
36+
nanos: 100000090
37+
>
38+
label_values: <
39+
has_value: true
40+
>
41+
label_values: <
42+
value: "test_2"
43+
has_value: true
44+
>
45+
points: <
46+
timestamp: <
47+
seconds: 1543160298
48+
nanos: 100000997
49+
>
50+
int64_value: 1
51+
>
52+
>
53+
timeseries: <
54+
start_timestamp: <
55+
seconds: 1543160298
56+
nanos: 100000090
57+
>
58+
label_values: <
59+
>
60+
label_values: <
61+
value: "test_1"
62+
has_value: true
63+
>
64+
points: <
65+
timestamp: <
66+
seconds: 1543160298
67+
nanos: 100000997
68+
>
69+
int64_value: 1
70+
>
71+
>
72+
timeseries: <
73+
start_timestamp: <
74+
seconds: 1543160298
75+
nanos: 100000090
76+
>
77+
label_values: <
78+
has_value: true
79+
>
80+
label_values: <
81+
>
82+
points: <
83+
timestamp: <
84+
seconds: 1543160298
85+
nanos: 100000997
86+
>
87+
int64_value: 1
88+
>
89+
>

testdata/ExportLabels/outMDR.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: "projects/metrics_proto_test"
2+
metric_descriptor: <
3+
name: "projects/metrics_proto_test/metricDescriptors/custom.googleapis.com/opencensus/ocagent.io/calls"
4+
type: "custom.googleapis.com/opencensus/ocagent.io/calls"
5+
labels: <
6+
key: "empty_key"
7+
>
8+
labels: <
9+
key: "operation_type"
10+
>
11+
metric_kind: CUMULATIVE
12+
value_type: INT64
13+
unit: "1"
14+
description: "Number of calls"
15+
display_name: "OpenCensus/ocagent.io/calls"
16+
>

testdata/ExportLabels/outTSR.txt

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
name: "projects/metrics_proto_test"
2+
time_series: <
3+
metric: <
4+
type: "custom.googleapis.com/opencensus/ocagent.io/calls"
5+
labels: <
6+
key: "empty_key"
7+
value: ""
8+
>
9+
labels: <
10+
key: "operation_type"
11+
value: "test_1"
12+
>
13+
>
14+
resource: <
15+
type: "global"
16+
>
17+
metric_kind: CUMULATIVE
18+
value_type: INT64
19+
points: <
20+
interval: <
21+
end_time: <
22+
seconds: 1543160298
23+
nanos: 100000997
24+
>
25+
start_time: <
26+
seconds: 1543160298
27+
nanos: 100000090
28+
>
29+
>
30+
value: <
31+
int64_value: 1
32+
>
33+
>
34+
>
35+
time_series: <
36+
metric: <
37+
type: "custom.googleapis.com/opencensus/ocagent.io/calls"
38+
labels: <
39+
key: "empty_key"
40+
value: ""
41+
>
42+
labels: <
43+
key: "operation_type"
44+
value: "test_2"
45+
>
46+
>
47+
resource: <
48+
type: "global"
49+
>
50+
metric_kind: CUMULATIVE
51+
value_type: INT64
52+
points: <
53+
interval: <
54+
end_time: <
55+
seconds: 1543160298
56+
nanos: 100000997
57+
>
58+
start_time: <
59+
seconds: 1543160298
60+
nanos: 100000090
61+
>
62+
>
63+
value: <
64+
int64_value: 1
65+
>
66+
>
67+
>
68+
time_series: <
69+
metric: <
70+
type: "custom.googleapis.com/opencensus/ocagent.io/calls"
71+
labels: <
72+
key: "operation_type"
73+
value: "test_1"
74+
>
75+
>
76+
resource: <
77+
type: "global"
78+
>
79+
metric_kind: CUMULATIVE
80+
value_type: INT64
81+
points: <
82+
interval: <
83+
end_time: <
84+
seconds: 1543160298
85+
nanos: 100000997
86+
>
87+
start_time: <
88+
seconds: 1543160298
89+
nanos: 100000090
90+
>
91+
>
92+
value: <
93+
int64_value: 1
94+
>
95+
>
96+
>
97+
time_series: <
98+
metric: <
99+
type: "custom.googleapis.com/opencensus/ocagent.io/calls"
100+
labels: <
101+
key: "empty_key"
102+
value: ""
103+
>
104+
>
105+
resource: <
106+
type: "global"
107+
>
108+
metric_kind: CUMULATIVE
109+
value_type: INT64
110+
points: <
111+
interval: <
112+
end_time: <
113+
seconds: 1543160298
114+
nanos: 100000997
115+
>
116+
start_time: <
117+
seconds: 1543160298
118+
nanos: 100000090
119+
>
120+
>
121+
value: <
122+
int64_value: 1
123+
>
124+
>
125+
>

0 commit comments

Comments
 (0)