@@ -65,6 +65,13 @@ func TestClient(t *testing.T) {
65
65
t .Run ("Integration" , otest .RunClientTests (factory ))
66
66
}
67
67
68
+ func TestNewWithInvalidEndpoint (t * testing.T ) {
69
+ ctx := context .Background ()
70
+ exp , err := New (ctx , WithEndpoint ("host:invalid-port" ))
71
+ assert .Error (t , err )
72
+ assert .Nil (t , exp )
73
+ }
74
+
68
75
func TestConfig (t * testing.T ) {
69
76
factoryFunc := func (ePt string , rCh <- chan otest.ExportResult , o ... Option ) (metric.Exporter , * otest.HTTPCollector ) {
70
77
coll , err := otest .NewHTTPCollector (ePt , rCh )
@@ -113,7 +120,7 @@ func TestConfig(t *testing.T) {
113
120
t .Cleanup (func () { close (rCh ) })
114
121
t .Cleanup (func () { require .NoError (t , exp .Shutdown (ctx )) })
115
122
err := exp .Export (ctx , & metricdata.ResourceMetrics {})
116
- assert .ErrorContains (t , err , context . DeadlineExceeded . Error ( ))
123
+ assert .ErrorAs (t , err , new ( retryableError ))
117
124
})
118
125
119
126
t .Run ("WithCompressionGZip" , func (t * testing.T ) {
@@ -174,17 +181,6 @@ func TestConfig(t *testing.T) {
174
181
assert .Len (t , coll .Collect ().Dump (), 1 )
175
182
})
176
183
177
- t .Run ("WithURLPath" , func (t * testing.T ) {
178
- path := "/prefix/v2/metrics"
179
- ePt := fmt .Sprintf ("http://localhost:0%s" , path )
180
- exp , coll := factoryFunc (ePt , nil , WithURLPath (path ))
181
- ctx := context .Background ()
182
- t .Cleanup (func () { require .NoError (t , coll .Shutdown (ctx )) })
183
- t .Cleanup (func () { require .NoError (t , exp .Shutdown (ctx )) })
184
- assert .NoError (t , exp .Export (ctx , & metricdata.ResourceMetrics {}))
185
- assert .Len (t , coll .Collect ().Dump (), 1 )
186
- })
187
-
188
184
t .Run ("WithTLSClientConfig" , func (t * testing.T ) {
189
185
ePt := "https://localhost:0"
190
186
tlsCfg := & tls.Config {InsecureSkipVerify : true }
0 commit comments