@@ -73,7 +73,7 @@ def test_receive_json(data)
7373 def test_receive_compressed_json
7474 d = create_driver
7575 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" } )
7777 end
7878
7979 expected_events = [ [ "otlp.test" , @event_time , { type : "otlp_logs" , message : TestData ::JSON ::LOGS } ] ]
@@ -122,7 +122,7 @@ def test_receive_protocol_buffers(data)
122122 def test_receive_compressed_protocol_buffers
123123 d = create_driver
124124 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" } )
126126 end
127127
128128 expected_events = [ [ "otlp.test" , @event_time , { type : "otlp_logs" , message : TestData ::JSON ::LOGS } ] ]
@@ -142,7 +142,7 @@ def test_invalid_protocol_buffers
142142 def test_invalid_content_type
143143 d = create_driver
144144 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" } )
146146 end
147147
148148 assert_equal ( 415 , res . status )
@@ -151,7 +151,7 @@ def test_invalid_content_type
151151 def test_invalid_content_encoding
152152 d = create_driver
153153 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" } )
155155 end
156156
157157 assert_equal ( 400 , res . status )
@@ -192,31 +192,31 @@ def compress(data)
192192 gz . close . string
193193 end
194194
195- def post_https_json ( path , json , headers = { } )
195+ def post_https_json ( path , json , headers : { } )
196196 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 )
198198 end
199199
200- def post_json ( path , json , headers = { } , opts = { } )
200+ def post_json ( path , json , headers : { } , options : { } )
201201 headers = headers . merge ( { "Content-Type" => "application/json" } )
202- post ( path , json , headers , opts )
202+ post ( path , json , headers : headers , options : options )
203203 end
204204
205- def post_protobuf ( path , binary , headers = { } , opts = { } )
205+ def post_protobuf ( path , binary , headers : { } , options : { } )
206206 headers = headers . merge ( { "Content-Type" => "application/x-protobuf" } )
207- post ( path , binary , headers , opts )
207+ post ( path , binary , headers : headers , options : options )
208208 end
209209
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 )
212212 connection . post
213213 end
214214
215215 def https_option
216216 Excon . defaults [ :ssl_verify_peer ] = false
217217 {
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" )
220220 }
221221 end
222222end
0 commit comments