Closed renegaderyu closed 11 months ago
So I thought this was environment config (it may still be). But I realized that if I make the changes below that I can test locally and do not receive the errors mentioned above
diff --git a/test/plugin/test_out_opensearch_data_stream.rb b/test/plugin/test_out_opensearch_data_stream.rb
index 872bf75..86e30ab 100644
--- a/test/plugin/test_out_opensearch_data_stream.rb
+++ b/test/plugin/test_out_opensearch_data_stream.rb
@@ -57,24 +57,24 @@ class OpenSearchOutputDataStreamTest < Test::Unit::TestCase
{'@timestamp' => Time.now.iso8601, 'message' => 'Sample record'}
end
- RESPONSE_ACKNOWLEDGED = {"acknowledged": true}
+ RESPONSE_ACKNOWLEDGED = '{"acknowledged": true}'
DUPLICATED_DATA_STREAM_EXCEPTION = {"error": {}, "status": 400}
NONEXISTENT_DATA_STREAM_EXCEPTION = {"error": {}, "status": 404}
def stub_index_template(name="foo_tpl", url="http://localhost:9200")
- stub_request(:put, "#{url}/_index_template/#{name}").to_return(:status => [200, RESPONSE_ACKNOWLEDGED])
+ stub_request(:put, "#{url}/_index_template/#{name}").to_return(status: 200, body: RESPONSE_ACKNOWLEDGED)
end
def stub_data_stream(name="foo", url="localhost:9200")
- stub_request(:put, "#{url}/_data_stream/#{name}").to_return(:status => [200, RESPONSE_ACKNOWLEDGED])
+ stub_request(:put, "#{url}/_data_stream/#{name}").to_return(status: 200, body: RESPONSE_ACKNOWLEDGED)
end
def stub_existent_data_stream?(name="foo", url="localhost:9200")
- stub_request(:get, "#{url}/_data_stream/#{name}").to_return(:status => [200, RESPONSE_ACKNOWLEDGED])
+ stub_request(:get, "#{url}/_data_stream/#{name}").to_return(status: 200, body: RESPONSE_ACKNOWLEDGED)
end
def stub_existent_template?(name="foo_tpl", url="localhost:9200")
- stub_request(:get, "#{url}/_index_template/#{name}").to_return(:status => [200, RESPONSE_ACKNOWLEDGED])
+ stub_request(:get, "#{url}/_index_template/#{name}").to_return(status: 200, body: RESPONSE_ACKNOWLEDGED)
end
def stub_nonexistent_data_stream?(name="foo", url="localhost:9200")
i managed to get the test setup running in both ubuntu and wsl2 on windows following the instructions given in the readme.
Already resolved at master.
(check apply)
Steps to replicate
While trying to add and run test cases for contributions to this repo I ran
bundle exec rake test
but it produces errors for most test in out_opensearch_data_stream.rb like below. I suspect there is something in environment setup that was either missed or done improperly. I'd like to figure it out and get it documented to make future contributions easier.Expected Behavior or What you need to ask
I'd like to be able to test locally
Using Fluentd and OpenSearch plugin versions
Gemfile.lock