44package otelconf
55
66import (
7- "fmt"
87 "testing"
98
109 "github.com/stretchr/testify/assert"
@@ -14,10 +13,7 @@ import (
1413 semconv "go.opentelemetry.io/otel/semconv/v1.37.0"
1514)
1615
17- type mockType struct {}
18-
1916func TestNewResource (t * testing.T ) {
20- other := mockType {}
2117 tests := []struct {
2218 name string
2319 config OpenTelemetryConfigurationResource
@@ -68,40 +64,12 @@ func TestNewResource(t *testing.T) {
6864 Attributes : []AttributeNameValue {
6965 {Name : "service.name" , Value : "service-a" },
7066 {Name : "attr-bool" , Value : true },
71- {Name : "attr-int64" , Value : int64 (- 164 )},
72- {Name : "attr-uint64" , Value : uint64 (164 )},
73- {Name : "attr-float64" , Value : float64 (64.0 )},
74- {Name : "attr-int8" , Value : int8 (- 18 )},
75- {Name : "attr-uint8" , Value : uint8 (18 )},
76- {Name : "attr-int16" , Value : int16 (- 116 )},
77- {Name : "attr-uint16" , Value : uint16 (116 )},
78- {Name : "attr-int32" , Value : int32 (- 132 )},
79- {Name : "attr-uint32" , Value : uint32 (132 )},
80- {Name : "attr-float32" , Value : float32 (32.0 )},
81- {Name : "attr-int" , Value : int (- 1 )},
82- {Name : "attr-uint" , Value : uint (1 )},
83- {Name : "attr-string" , Value : "string-val" },
84- {Name : "attr-default" , Value : other },
8567 },
8668 SchemaUrl : ptr (semconv .SchemaURL ),
8769 },
8870 wantResource : resource .NewWithAttributes (semconv .SchemaURL ,
8971 semconv .ServiceName ("service-a" ),
90- attribute .Bool ("attr-bool" , true ),
91- attribute .String ("attr-uint64" , fmt .Sprintf ("%d" , 164 )),
92- attribute .Int64 ("attr-int64" , int64 (- 164 )),
93- attribute .Float64 ("attr-float64" , float64 (64.0 )),
94- attribute .Int64 ("attr-int8" , int64 (- 18 )),
95- attribute .Int64 ("attr-uint8" , int64 (18 )),
96- attribute .Int64 ("attr-int16" , int64 (- 116 )),
97- attribute .Int64 ("attr-uint16" , int64 (116 )),
98- attribute .Int64 ("attr-int32" , int64 (- 132 )),
99- attribute .Int64 ("attr-uint32" , int64 (132 )),
100- attribute .Float64 ("attr-float32" , float64 (32.0 )),
101- attribute .Int64 ("attr-int" , int64 (- 1 )),
102- attribute .String ("attr-uint" , fmt .Sprintf ("%d" , 1 )),
103- attribute .String ("attr-string" , "string-val" ),
104- attribute .String ("attr-default" , fmt .Sprintf ("%v" , other ))),
72+ attribute .Bool ("attr-bool" , true )),
10573 },
10674 }
10775 for _ , tt := range tests {
0 commit comments