@@ -73,7 +73,7 @@ def test_receive_json(data)
73
73
def test_receive_compressed_json
74
74
d = create_driver
75
75
res = d . run ( expect_records : 1 ) do
76
- post_json ( "/v1/logs" , compress ( TestData ::JSON ::LOGS ) , { "Content-Encoding" => "gzip" } )
76
+ post_json ( "/v1/logs" , compress ( TestData ::JSON ::LOGS ) , headers : { "Content-Encoding" => "gzip" } )
77
77
end
78
78
79
79
expected_events = [ [ "otlp.test" , @event_time , { type : "otlp_logs" , message : TestData ::JSON ::LOGS } ] ]
@@ -122,7 +122,7 @@ def test_receive_protocol_buffers(data)
122
122
def test_receive_compressed_protocol_buffers
123
123
d = create_driver
124
124
res = d . run ( expect_records : 1 ) do
125
- post_json ( "/v1/logs" , compress ( TestData ::ProtocolBuffers ::LOGS ) , { "Content-Encoding" => "gzip" } )
125
+ post_protobuf ( "/v1/logs" , compress ( TestData ::ProtocolBuffers ::LOGS ) , headers : { "Content-Encoding" => "gzip" } )
126
126
end
127
127
128
128
expected_events = [ [ "otlp.test" , @event_time , { type : "otlp_logs" , message : TestData ::JSON ::LOGS } ] ]
@@ -142,7 +142,7 @@ def test_invalid_protocol_buffers
142
142
def test_invalid_content_type
143
143
d = create_driver
144
144
res = d . run ( expect_records : 0 ) do
145
- post ( "/v1/logs" , TestData ::JSON ::LOGS , { "Content-Type" => "text/plain" } )
145
+ post ( "/v1/logs" , TestData ::JSON ::LOGS , headers : { "Content-Type" => "text/plain" } )
146
146
end
147
147
148
148
assert_equal ( 415 , res . status )
@@ -151,7 +151,7 @@ def test_invalid_content_type
151
151
def test_invalid_content_encoding
152
152
d = create_driver
153
153
res = d . run ( expect_records : 0 ) do
154
- post_json ( "/v1/logs" , TestData ::JSON ::LOGS , { "Content-Encoding" => "deflate" } )
154
+ post_json ( "/v1/logs" , TestData ::JSON ::LOGS , headers : { "Content-Encoding" => "deflate" } )
155
155
end
156
156
157
157
assert_equal ( 400 , res . status )
@@ -192,31 +192,31 @@ def compress(data)
192
192
gz . close . string
193
193
end
194
194
195
- def post_https_json ( path , json , headers = { } )
195
+ def post_https_json ( path , json , headers : { } )
196
196
headers = headers . merge ( { "Content-Type" => "application/json" } )
197
- post ( path , json , "https://127.0.0.1:4318" , headers , https_option )
197
+ post ( path , json , endpoint : "https://127.0.0.1:4318" , headers : headers , options : https_option )
198
198
end
199
199
200
- def post_json ( path , json , headers = { } , opts = { } )
200
+ def post_json ( path , json , headers : { } , options : { } )
201
201
headers = headers . merge ( { "Content-Type" => "application/json" } )
202
- post ( path , json , headers , opts )
202
+ post ( path , json , headers : headers , options : options )
203
203
end
204
204
205
- def post_protobuf ( path , binary , headers = { } , opts = { } )
205
+ def post_protobuf ( path , binary , headers : { } , options : { } )
206
206
headers = headers . merge ( { "Content-Type" => "application/x-protobuf" } )
207
- post ( path , binary , headers , opts )
207
+ post ( path , binary , headers : headers , options : options )
208
208
end
209
209
210
- def post ( path , body , endpoint = "http://127.0.0.1:4318" , headers = { } , opts = { } )
211
- connection = Excon . new ( "#{ endpoint } #{ path } " , body : body , headers : headers , **opts )
210
+ def post ( path , body , endpoint : "http://127.0.0.1:4318" , headers : { } , options : { } )
211
+ connection = Excon . new ( "#{ endpoint } #{ path } " , body : body , headers : headers , **options )
212
212
connection . post
213
213
end
214
214
215
215
def https_option
216
216
Excon . defaults [ :ssl_verify_peer ] = false
217
217
{
218
- client_cert : " #{ File . expand_path ( File . dirname ( __FILE__ ) + ' /../resources/certs/ca.crt' ) } " ,
219
- client_key : " #{ File . expand_path ( File . dirname ( __FILE__ ) + ' /../resources/certs/ca.key' ) } "
218
+ client_cert : File . expand_path ( File . dirname ( __FILE__ ) + " /../resources/certs/ca.crt" ) ,
219
+ client_key : File . expand_path ( File . dirname ( __FILE__ ) + " /../resources/certs/ca.key" )
220
220
}
221
221
end
222
222
end
0 commit comments