opensearch-project / opensearch-ruby

Ruby Client for OpenSearch
Apache License 2.0
93 stars 47 forks source link

[BUG] Duplicate action method with the same name #230

Closed Earlopain closed 5 months ago

Earlopain commented 7 months ago

What is the bug?

delete_by_query_rethrottle.rb and delete_by_rethrottle.rb both define delete_by_query_rethrottle. This causes a ruby warning to be emitted when running with -w. Example output when running the test suite here:

[earlopain@DESKTOP-PC opensearch-ruby]$ RUBYOPT=-w bundle exec rake test:transport:unit
...
/home/earlopain/Documents/opensearch-ruby/lib/opensearch/api/actions/delete_by_rethrottle.rb:36: warning: method redefined; discarding old delete_by_query_rethrottle
/home/earlopain/Documents/opensearch-ruby/lib/opensearch/api/actions/delete_by_query_rethrottle.rb:37: warning: previous definition of delete_by_query_rethrottle was here
...

Finished in 0.20590s
109 tests, 236 assertions, 0 failures, 0 errors, 0 skips

Clearly one of these is wrong. I'm however not knowledgable enough to say what the correct version would be.

This doesn't actually impact me, apart from these messages appearing in my test logs when running tests with warnings in my own project.

nhtruong commented 5 months ago

Nice catch. Looks like only delete_by_query_rethrottle shows up in the Spec. Also the name of the file should match the name of the action. So 2 reasons to delete delete_by_rethrottle.rb

Earlopain commented 5 months ago

Thanks for the feedback, I have openend #236 to resolve this.