-
Notifications
You must be signed in to change notification settings - Fork 1
Support specifying the ingest host #6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 4 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -8,6 +8,13 @@ | |||||
| } | ||||||
| end | ||||||
|
|
||||||
| let(:cloud_config) do | ||||||
| %{ | ||||||
| source_token abcd1234 | ||||||
| ingesting_host s1234.g1.betterstackdata.com | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @lazandrei19 if you're stubbing this anyway, let's use the production cluster ( |
||||||
| } | ||||||
| end | ||||||
|
|
||||||
| let(:driver) do | ||||||
| tag = "test" | ||||||
| Fluent::Test::BufferedOutputTestDriver.new(Fluent::LogtailOutput, tag) { | ||||||
|
|
@@ -19,6 +26,19 @@ def format(tag, time, record) | |||||
| end | ||||||
| }.configure(config) | ||||||
| end | ||||||
|
|
||||||
| let(:cloud_driver) do | ||||||
| tag = "test" | ||||||
| Fluent::Test::BufferedOutputTestDriver.new(Fluent::LogtailOutput, tag) { | ||||||
| # v0.12's test driver assume format definition. This simulates ObjectBufferedOutput format | ||||||
| if !defined?(Fluent::Plugin::Output) | ||||||
| def format(tag, time, record) | ||||||
| [time, record].to_msgpack | ||||||
| end | ||||||
| end | ||||||
| }.configure(cloud_config) | ||||||
| end | ||||||
|
|
||||||
| let(:record) do | ||||||
| {'age' => 26, 'request_id' => '42', 'parent_id' => 'parent', 'routing_id' => 'routing'} | ||||||
| end | ||||||
|
|
@@ -29,21 +49,21 @@ def format(tag, time, record) | |||||
|
|
||||||
| describe "#write" do | ||||||
| it "should send a chunked request to the Logtail API" do | ||||||
| stub = stub_request(:post, "https://in.logtail.com/"). | ||||||
| stub = stub_request(:post, "https://s1234.g1.betterstackdata.com/"). | ||||||
| with( | ||||||
| :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")), | ||||||
| :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'} | ||||||
| ). | ||||||
| to_return(:status => 202, :body => "", :headers => {}) | ||||||
|
|
||||||
| driver.emit(record) | ||||||
| driver.run | ||||||
| cloud_driver.emit(record) | ||||||
| cloud_driver.run | ||||||
|
|
||||||
| expect(stub).to have_been_requested.times(1) | ||||||
| end | ||||||
|
|
||||||
| it "handles 500s" do | ||||||
| stub = stub_request(:post, "https://in.logtail.com/").to_return(:status => 500, :body => "", :headers => {}) | ||||||
| stub = stub_request(:post, "https://in.logs.betterstack.com/").to_return(:status => 500, :body => "", :headers => {}) | ||||||
|
|
||||||
| driver.emit(record) | ||||||
| driver.run | ||||||
|
|
@@ -52,7 +72,23 @@ def format(tag, time, record) | |||||
| end | ||||||
|
|
||||||
| it "handle auth failures" do | ||||||
| stub = stub_request(:post, "https://in.logtail.com/").to_return(:status => 403, :body => "", :headers => {}) | ||||||
| stub = stub_request(:post, "https://in.logs.betterstack.com/").to_return(:status => 403, :body => "", :headers => {}) | ||||||
|
|
||||||
| driver.emit(record) | ||||||
| driver.run | ||||||
|
|
||||||
| expect(stub).to have_been_requested.times(1) | ||||||
| end | ||||||
| end | ||||||
|
|
||||||
| describe "#write to cloud" do | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. cloud infra is tested
Suggested change
|
||||||
| it "should send a chunked request to the Logtail API" do | ||||||
| stub = stub_request(:post, "https://in.logs.betterstack.com/"). | ||||||
| with( | ||||||
| :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")), | ||||||
| :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'} | ||||||
| ). | ||||||
| to_return(:status => 202, :body => "", :headers => {}) | ||||||
|
|
||||||
| driver.emit(record) | ||||||
| driver.run | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems we already have
0.2.0released - https://rubygems.org/gems/fluent-plugin-logtail/versions/0.2.0Looks like the version wasn't bumped in 778fc64