@@ -62,32 +62,33 @@ def format(tag, time, record)
6262 expect ( stub ) . to have_been_requested . times ( 1 )
6363 end
6464
65- describe "#write to cloud" do
66- it "should send a chunked request to the Logtail API" do
67- stub = stub_request ( :post , "https://in.logs.betterstack.com/" ) .
68- with (
69- :body => start_with ( "\xDD \x00 \x00 \x00 \x01 \x85 \xA3 age\x1A \xAA request_id\xA2 42\xA9 parent_id\xA6 parent\xAA routing_id\xA7 routing\xA2 dt\xB4 " . force_encoding ( "ASCII-8BIT" ) ) ,
70- :headers => { 'Accept' => '*/*' , 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3' , 'Authorization' => 'Bearer abcd1234' , 'Content-Type' => 'application/msgpack' , 'User-Agent' => 'Logtail Fluentd/0.1.1' }
71- ) .
72- to_return ( :status => 202 , :body => "" , :headers => { } )
65+ it "handles 500s" do
66+ stub = stub_request ( :post , "https://in.logs.betterstack.com/" ) . to_return ( :status => 500 , :body => "" , :headers => { } )
7367
7468 driver . emit ( record )
7569 driver . run
7670
77- expect ( stub ) . to have_been_requested . times ( 1 )
71+ expect ( stub ) . to have_been_requested . times ( 3 )
7872 end
7973
80- it "handles 500s " do
81- stub = stub_request ( :post , "https://in.logs.betterstack.com/" ) . to_return ( :status => 500 , :body => "" , :headers => { } )
74+ it "handle auth failures " do
75+ stub = stub_request ( :post , "https://in.logs.betterstack.com/" ) . to_return ( :status => 403 , :body => "" , :headers => { } )
8276
8377 driver . emit ( record )
8478 driver . run
8579
86- expect ( stub ) . to have_been_requested . times ( 3 )
80+ expect ( stub ) . to have_been_requested . times ( 1 )
8781 end
82+ end
8883
89- it "handle auth failures" do
90- stub = stub_request ( :post , "https://in.logs.betterstack.com/" ) . to_return ( :status => 403 , :body => "" , :headers => { } )
84+ describe "#write to cloud" do
85+ it "should send a chunked request to the Logtail API" do
86+ stub = stub_request ( :post , "https://in.logs.betterstack.com/" ) .
87+ with (
88+ :body => start_with ( "\xDD \x00 \x00 \x00 \x01 \x85 \xA3 age\x1A \xAA request_id\xA2 42\xA9 parent_id\xA6 parent\xAA routing_id\xA7 routing\xA2 dt\xB4 " . force_encoding ( "ASCII-8BIT" ) ) ,
89+ :headers => { 'Accept' => '*/*' , 'Accept-Encoding' => 'gzip;q=1.0,deflate;q=0.6,identity;q=0.3' , 'Authorization' => 'Bearer abcd1234' , 'Content-Type' => 'application/msgpack' , 'User-Agent' => 'Logtail Fluentd/0.1.1' }
90+ ) .
91+ to_return ( :status => 202 , :body => "" , :headers => { } )
9192
9293 driver . emit ( record )
9394 driver . run
0 commit comments