Skip to content

Commit e4c8a9a

Browse files
committed
updated tests ✅
1 parent 44d4a27 commit e4c8a9a

File tree

1 file changed

+15
-14
lines changed

1 file changed

+15
-14
lines changed

spec/fluent/plugin/out_logtail_spec.rb

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -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\xA3age\x1A\xAArequest_id\xA242\xA9parent_id\xA6parent\xAArouting_id\xA7routing\xA2dt\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\xA3age\x1A\xAArequest_id\xA242\xA9parent_id\xA6parent\xAArouting_id\xA7routing\xA2dt\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

Comments
 (0)