Skip to content

Conversation

@kenhys
Copy link
Collaborator

@kenhys kenhys commented Feb 20, 2025

Since Ruby 3.4, evaluated Hash notation was changed.

Before:

:symbol => value

After:

symbol: value

To keep compatibility, embed evaluated hash.

It fixes the following error:

  Failure:
  test_writes_to_extracted_host_with_placeholder_replaced_in_exception_message(ElasticsearchOutputTest::HostnamePlaceholders)
  /work/fluent/plugins/fluent-plugin-elasticsearch.work/test/plugin/test_out_elasticsearch.rb:5008:in
  'ElasticsearchOutputTest::HostnamePlaceholders#test_writes_to_extracted_host_with_placeholder_replaced_in_exception_message'
  <"could not push logs to Elasticsearch
  cluster ({:host=>\"myhost-1\", :port=>9200, :scheme=>\"http\"}):
  [503] "> expected but was <"could not push logs to Elasticsearch
  cluster ({host: \"myhost-1\", port: 9200, scheme: \"http\"}): [503]
  ">

(check all that apply)

  • [- ] tests added
  • tests passing
  • [- ] README updated (if needed)
  • [-] README Table of Contents updated (if needed)
  • History.md and version in gemspec are untouched
  • backward compatible
  • [-] feature works in elasticsearch_dynamic (not required but recommended)

Since Ruby 3.4, evaluated Hash notation was changed.

Before:

  :symbol => value

After:

  symbol: value

To keep compatibility, embed evaluated hash.

It fixes the following error:

  Failure:
  test_writes_to_extracted_host_with_placeholder_replaced_in_exception_message(ElasticsearchOutputTest::HostnamePlaceholders)
  /work/fluent/plugins/fluent-plugin-elasticsearch.work/test/plugin/test_out_elasticsearch.rb:5008:in
  'ElasticsearchOutputTest::HostnamePlaceholders#test_writes_to_extracted_host_with_placeholder_replaced_in_exception_message'
  <"could not push logs to Elasticsearch
  cluster ({:host=>\"myhost-1\", :port=>9200, :scheme=>\"http\"}):
  [503] "> expected but was <"could not push logs to Elasticsearch
  cluster ({host: \"myhost-1\", port: 9200, scheme: \"http\"}): [503]
  ">

Signed-off-by: Kentaro Hayashi <[email protected]>
@kenhys kenhys changed the title test: fix hash expression incompatibility test: fix hash expression incompatibility for Ruby 3.4 Feb 20, 2025
@kenhys kenhys mentioned this pull request Feb 20, 2025
4 tasks
@kenhys kenhys requested a review from cosmo0920 February 21, 2025 04:06
@cosmo0920 cosmo0920 merged commit 9bfdc35 into uken:master Feb 22, 2025
9 checks passed
@cosmo0920
Copy link
Collaborator

Good catch. Could you address the CI tasks to spin up Ruby 3.3 and 3.4 later, @kenhys?

@kenhys kenhys deleted the fix-ruby34 branch February 22, 2025 12:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants