fluent-plugin-dedot_filter 1.0.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CHANGELOG.md ADDED
@@ -0,0 +1,37 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented in this file.
4
+
5
+ ## 1.0.1 - 2026-12-05
6
+
7
+ ### Fixed
8
+
9
+ - `de_dot false` no longer drops every record; records now pass through
10
+ unchanged (#6, #8).
11
+
12
+ ### Changed
13
+
14
+ - `required_ruby_version` is now `>= 2.7` (#7).
15
+ - CI moved from Travis CI to GitHub Actions and runs on Ruby 2.7 and
16
+ 3.1 - 4.0 (#7).
17
+ - Gem metadata now includes `source_code_uri`, `bug_tracker_uri` and
18
+ `rubygems_mfa_required` (#7).
19
+ - README expanded with a parameter table, examples, Docker / Helm notes and
20
+ development instructions (#7, #8).
21
+
22
+ ## 1.0.0 - 2017-12-03
23
+
24
+ ### Changed
25
+
26
+ - Migrated to the Fluentd v0.14 plugin API; requires Fluentd v0.14 or later
27
+ (#2).
28
+
29
+ ## 0.2.0 - 2016-05-30
30
+
31
+ ### Added
32
+
33
+ - `de_dot_nested` option to de-dot keys inside nested hashes and arrays (#1).
34
+
35
+ ## 0.1.0 - 2016-03-05
36
+
37
+ - Initial release.
data/Gemfile CHANGED
@@ -2,3 +2,7 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in fluent-plugin-dedot_filter.gemspec
4
4
  gemspec
5
+
6
+ group :development, :test do
7
+ gem 'simplecov', require: false
8
+ end
data/LICENSE.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2016 TODO: Write your name
3
+ Copyright (c) 2017 Tomoyuki Sugimura
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,36 +1,65 @@
1
1
  # fluent-plugin-dedot_filter
2
2
 
3
- Fluentd Filter plugin to de-dot field name for elasticsearch.
3
+ [![Gem Version](https://badge.fury.io/rb/fluent-plugin-dedot_filter.svg)](https://badge.fury.io/rb/fluent-plugin-dedot_filter)
4
+ [![Test](https://github.com/lunardial/fluent-plugin-dedot_filter/actions/workflows/test.yml/badge.svg)](https://github.com/lunardial/fluent-plugin-dedot_filter/actions/workflows/test.yml)
5
+ [![downloads](https://img.shields.io/gem/dt/fluent-plugin-dedot_filter.svg)](https://rubygems.org/gems/fluent-plugin-dedot_filter)
6
+ [![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE)
7
+
8
+ A [Fluentd](https://www.fluentd.org/) filter plugin that replaces dots (`.`) in
9
+ record keys with another character (`_` by default).
10
+
11
+ Elasticsearch (2.x and later) and OpenSearch treat a dot in a field name as an
12
+ object path, so a key such as `kubernetes.labels.app.kubernetes.io/name` can
13
+ cause mapping conflicts or rejected documents. This filter rewrites such keys
14
+ before they reach the output plugin.
4
15
 
5
16
  ## Requirements
6
17
 
7
- | fluent-plugin-dedot_filter | fluentd |
8
- |-----------------------------|---------|
9
- | >= 1.0.0 | >= v0.14.0 |
10
- | < 1.0.0 | >= v0.12.0 |
18
+ | fluent-plugin-dedot_filter | fluentd | Ruby |
19
+ |----------------------------|------------|---------|
20
+ | >= 1.0.1 | >= v0.14.0 | >= 2.7 |
21
+ | 1.0.0 | >= v0.14.0 | - |
22
+ | < 1.0.0 | v0.12.x | - |
11
23
 
12
- ## Installation
24
+ The 1.x series is tested against Fluentd v1 on Ruby 2.7 and 3.1 - 4.0.
13
25
 
14
- Add this line to your application's Gemfile:
26
+ ## Installation
15
27
 
16
28
  ```bash
17
- # for fluentd v0.12
18
- gem install fluent-plugin-dedot_filter -v "< 1.0.0"
29
+ # for fluentd v1 / fluent-package (formerly td-agent)
30
+ fluent-gem install fluent-plugin-dedot_filter
31
+
32
+ # for fluentd v0.12 / td-agent2 (legacy)
33
+ fluent-gem install fluent-plugin-dedot_filter -v "< 1.0.0"
34
+ ```
35
+
36
+ Or add it to your Gemfile:
37
+
38
+ ```ruby
39
+ gem "fluent-plugin-dedot_filter"
40
+ ```
19
41
 
20
- # for fluentd v0.14 or higher
21
- gem install fluent-plugin-dedot_filter
42
+ ### Docker / Kubernetes (Helm)
22
43
 
23
- # for td-agent2
24
- td-agent-gem install fluent-plugin-dedot_filter -v "< 1.0.0"
44
+ Official Fluentd container images and Helm charts do not include this plugin.
45
+ If you see `Unknown filter plugin 'dedot'`, the gem is not installed in the
46
+ image. Build an image that installs it, for example:
25
47
 
26
- # for td-agent3
27
- td-agent-gem install fluent-plugin-dedot_filter
48
+ ```dockerfile
49
+ # use the Fluentd image tag you already run
50
+ FROM fluent/fluentd:v1.17-debian-1
51
+ USER root
52
+ RUN fluent-gem install fluent-plugin-dedot_filter
53
+ USER fluent
28
54
  ```
29
55
 
56
+ and point your chart at that image (or use the chart's plugin-install option,
57
+ if it has one).
58
+
30
59
  ## Usage
31
60
 
32
61
  ```xml
33
- <filter access.apache>
62
+ <filter kubernetes.**>
34
63
  @type dedot
35
64
  de_dot true
36
65
  de_dot_separator _
@@ -38,14 +67,70 @@ td-agent-gem install fluent-plugin-dedot_filter
38
67
  </filter>
39
68
  ```
40
69
 
41
- ## parameters
70
+ ## Parameters
71
+
72
+ | Name | Type | Default | Description |
73
+ |--------------------|--------|---------|-------------|
74
+ | `de_dot` | bool | `true` | Enables de-dotting. When `false`, records are passed through unchanged. |
75
+ | `de_dot_separator` | string | `_` | Replacement for each `.` in a key. Cannot be or contain `.`. |
76
+ | `de_dot_nested` | bool | `false` | Also rewrite keys inside nested hashes, including hashes inside arrays. |
77
+
78
+ Only keys are rewritten; values are never modified.
79
+
80
+ > **Note:** versions up to 1.0.0 dropped every record when `de_dot false` was
81
+ > set ([#6](https://github.com/lunardial/fluent-plugin-dedot_filter/issues/6)).
82
+ > Upgrade if you rely on that setting.
83
+
84
+ ## Example
85
+
86
+ Input record:
87
+
88
+ ```json
89
+ {"app.name": "web", "kubernetes": {"labels": {"app.kubernetes.io/name": "web"}}, "msg": "a.b.c"}
90
+ ```
91
+
92
+ With the default settings (`de_dot_nested false`), only top-level keys change:
93
+
94
+ ```json
95
+ {"app_name": "web", "kubernetes": {"labels": {"app.kubernetes.io/name": "web"}}, "msg": "a.b.c"}
96
+ ```
97
+
98
+ With `de_dot_nested true`, nested keys change as well:
99
+
100
+ ```json
101
+ {"app_name": "web", "kubernetes": {"labels": {"app_kubernetes_io/name": "web"}}, "msg": "a.b.c"}
102
+ ```
103
+
104
+ If two keys collide after rewriting (for example `a.b` and `a_b`), the one
105
+ that appears later in the record wins.
106
+
107
+ ## Development
108
+
109
+ The easiest way to get a working environment is the included
110
+ [Dev Container](https://containers.dev/): open the repository in VS Code with
111
+ the Dev Containers extension (or in GitHub Codespaces) and choose
112
+ "Reopen in Container". Dependencies are installed automatically.
113
+
114
+ Then run:
115
+
116
+ ```bash
117
+ bundle exec rake spec
118
+
119
+ # with a local coverage report (coverage/index.html)
120
+ COVERAGE=1 bundle exec rake spec
121
+ ```
122
+
123
+ Without the Dev Container, any Docker host works:
124
+
125
+ ```bash
126
+ docker run --rm -v "$PWD":/app -w /app ruby:3.4 \
127
+ bash -c "bundle install && bundle exec rake spec"
128
+ ```
42
129
 
43
- * `de_dot` (default: true)
44
- * `de_dot_separator` (default: '_')
45
- * `de_dot_nested` (default: false)
130
+ Or, with Ruby installed locally, run `bundle install` first.
46
131
 
47
- `de_dot_separator` cannot be or contain '.'.
48
- `de_dot_nested` will cause the plugin to recurse through nested structures (hashes and arrays), and remove dots in those key-names too.
132
+ Bug reports and pull requests are welcome on
133
+ [GitHub](https://github.com/lunardial/fluent-plugin-dedot_filter).
49
134
 
50
135
  ## License
51
136
 
data/Rakefile CHANGED
@@ -1,2 +1,6 @@
1
1
  require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
2
6
  task :default => :spec
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.1
@@ -1,36 +1,34 @@
1
1
  # coding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'fluent/plugin/filter_dedot/version'
5
4
 
6
5
  Gem::Specification.new do |spec|
7
6
  spec.name = "fluent-plugin-dedot_filter"
8
- spec.version = Fluent::Plugin::DedotFilter::VERSION
7
+ spec.version = File.read("VERSION").strip
9
8
  spec.authors = ["Tomoyuki Sugimura"]
10
- spec.email = ["tomoyuki.sugimura@gmail.com"]
9
+ spec.email = ["12116691+lunardial@users.noreply.github.com"]
11
10
 
12
- spec.summary = %q{de-dot field name for elasticsearch 2.x}
13
- spec.description = %q{de-dot field name for elasticsearch 2.x}
11
+ spec.summary = %q{de-dot field name for elasticsearch}
12
+ spec.description = %q{de-dot field name for elasticsearch}
14
13
  spec.homepage = "https://github.com/lunardial/fluent-plugin-dedot_filter"
15
14
  spec.license = "MIT"
15
+ spec.metadata = {
16
+ "source_code_uri" => "https://github.com/lunardial/fluent-plugin-dedot_filter",
17
+ "bug_tracker_uri" => "https://github.com/lunardial/fluent-plugin-dedot_filter/issues",
18
+ "rubygems_mfa_required" => "true",
19
+ }
16
20
 
17
- # Prevent pushing this gem to RubyGems.org by setting 'allowed_push_host', or
18
- # delete this section to allow pushing this gem to any host.
19
- #if spec.respond_to?(:metadata)
20
- # spac.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
21
- #else
22
- # raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
23
- #end
24
-
25
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
26
- spec.bindir = "exe"
27
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
21
+ spec.files = `git ls-files`.split($/)
22
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
23
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
28
24
  spec.require_paths = ["lib"]
29
25
 
30
- spec.add_runtime_dependency "fluentd", [">= 0.14.0", "< 2"]
26
+ spec.required_ruby_version = ">= 2.7"
27
+
28
+ spec.add_runtime_dependency "fluentd", ">= 0.14.0", "< 2"
31
29
 
32
- spec.add_development_dependency "bundler", "~> 1.11"
33
- spec.add_development_dependency "rake", "~> 10.0"
34
- spec.add_development_dependency "rspec"
35
- spec.add_development_dependency "test-unit"
30
+ spec.add_development_dependency "bundler"
31
+ spec.add_development_dependency "rake", ">= 13.0"
32
+ spec.add_development_dependency "rspec", "~> 3.0"
33
+ spec.add_development_dependency "test-unit", "~> 3.0"
36
34
  end
@@ -27,10 +27,15 @@ module Fluent::Plugin
27
27
  end
28
28
 
29
29
  def filter(tag, time, record)
30
+ # Returning nil from a filter drops the record, so pass it through
31
+ # untouched when de-dotting is disabled.
32
+ return record unless @de_dot
33
+
30
34
  begin
31
- de_dot(record) if @de_dot
35
+ de_dot(record)
32
36
  rescue => e
33
37
  router.emit_error_event(tag, time, record, e)
38
+ nil
34
39
  end
35
40
  end
36
41
 
@@ -0,0 +1,225 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ require 'helper'
4
+
5
+ class TestDedotFilter
6
+ RSpec.describe Fluent::Plugin::DedotFilter do
7
+
8
+ CONFIG = %[]
9
+
10
+ def create_driver(conf=CONFIG)
11
+ Fluent::Test::Driver::Filter.new(Fluent::Plugin::DedotFilter).configure(conf)
12
+ end
13
+
14
+ def filter_records(conf, records)
15
+ driver = create_driver(conf)
16
+ driver.run(default_tag: 'test') do
17
+ records.each { |record| driver.feed(record) }
18
+ end
19
+ driver.filtered_records
20
+ end
21
+
22
+ def create_filter
23
+ Fluent::Plugin::DedotFilter.new
24
+ end
25
+
26
+ before :all do
27
+ Fluent::Test.setup
28
+ end
29
+
30
+ before :each do
31
+ @filter = create_filter
32
+ end
33
+
34
+ context "#filter" do
35
+
36
+ it "de-dots keys when de_dot is true (default)" do
37
+ records = filter_records(%[], [{"key.dot" => "value"}])
38
+ expect(records).to eq [{"key_dot" => "value"}]
39
+ end
40
+
41
+ it "uses de_dot_separator" do
42
+ records = filter_records(%[de_dot_separator -], [{"key.dot" => "value"}])
43
+ expect(records).to eq [{"key-dot" => "value"}]
44
+ end
45
+
46
+ it "passes records through untouched when de_dot is false" do
47
+ input = [{"key.dot" => "value"}, {"a.b" => {"c.d" => 1}}]
48
+ records = filter_records(%[de_dot false], input)
49
+ expect(records).to eq input
50
+ end
51
+
52
+ it "allows a separator containing '.' when de_dot is false" do
53
+ expect { create_driver(%[de_dot false\nde_dot_separator .]) }.not_to raise_error
54
+ end
55
+
56
+ it "rejects a separator containing '.' when de_dot is true" do
57
+ expect { create_driver(%[de_dot_separator .]) }.to raise_error(Fluent::ConfigError)
58
+ end
59
+
60
+ it "uses the documented defaults" do
61
+ filter = create_driver.instance
62
+ # The plugin's de_dot(record) method shadows the de_dot config
63
+ # reader, so read the configured value directly.
64
+ expect(filter.instance_variable_get(:@de_dot)).to eq true
65
+ expect(filter.de_dot_separator).to eq "_"
66
+ expect(filter.de_dot_nested).to eq false
67
+ end
68
+
69
+ it "supports a multi-character separator" do
70
+ records = filter_records(%[de_dot_separator __], [{"a.b.c" => 1}])
71
+ expect(records).to eq [{"a__b__c" => 1}]
72
+ end
73
+
74
+ it "leaves values containing dots untouched" do
75
+ records = filter_records(%[], [{"host.name" => "web.example.com"}])
76
+ expect(records).to eq [{"host_name" => "web.example.com"}]
77
+ end
78
+
79
+ it "only rewrites top-level keys when de_dot_nested is false" do
80
+ input = {"a.b" => {"c.d" => 1}, "e.f" => [{"g.h" => 2}]}
81
+ records = filter_records(%[], [input])
82
+ expect(records).to eq [{"a_b" => {"c.d" => 1}, "e_f" => [{"g.h" => 2}]}]
83
+ end
84
+
85
+ it "rewrites nested hash and array keys when de_dot_nested is true" do
86
+ input = {"a.b" => {"c.d" => {"e.f" => 1}}, "g.h" => [{"i.j" => 2}, "k.l", 3]}
87
+ records = filter_records(%[de_dot_nested true], [input])
88
+ expect(records).to eq [{"a_b" => {"c_d" => {"e_f" => 1}}, "g_h" => [{"i_j" => 2}, "k.l", 3]}]
89
+ end
90
+
91
+ it "processes every record in a stream" do
92
+ input = [{"a.b" => 1}, {"c.d" => 2}, {"no_dot" => 3}]
93
+ records = filter_records(%[], input)
94
+ expect(records).to eq [{"a_b" => 1}, {"c_d" => 2}, {"no_dot" => 3}]
95
+ end
96
+
97
+ it "does not mutate the incoming record" do
98
+ input = {"a.b" => {"c.d" => 1}}
99
+ filter_records(%[de_dot_nested true], [input])
100
+ expect(input).to eq({"a.b" => {"c.d" => 1}})
101
+ end
102
+
103
+ it "routes records that fail to process to the error stream" do
104
+ # Integer keys cannot be de-dotted (no #gsub), which raises inside the filter.
105
+ driver = create_driver
106
+ driver.run(default_tag: 'test') do
107
+ driver.feed({1 => "value"})
108
+ driver.feed({"a.b" => "ok"})
109
+ end
110
+ expect(driver.filtered_records).to eq [{"a_b" => "ok"}]
111
+ expect(driver.error_events.size).to eq 1
112
+ end
113
+
114
+ end
115
+
116
+ context "#de_dot" do
117
+
118
+ it "no error because of empty record" do
119
+ expect(@filter.de_dot({})).to eq Hash.new
120
+ end
121
+
122
+ it "no error with non recursive hash" do
123
+ @filter.de_dot_nested = false
124
+ test_hash = {}
125
+ test_hash["key"] = "value"
126
+ test_hash["key.dot"] = "value.dot"
127
+ expect_hash = {}
128
+ expect_hash["key"] = test_hash["key"]
129
+ expect_hash["key_dot"] = test_hash["key.dot"]
130
+ expect(@filter.de_dot(test_hash)).to eq expect_hash
131
+ end
132
+
133
+ it "no error with recursive hash with de_dot_nested = false" do
134
+ # "child_dot" => {"key"=>"value", "key.dot"=>"value.dot"}
135
+ @filter.de_dot_nested = false
136
+ test_child_hash = {}
137
+ test_child_hash["key"] = "value"
138
+ test_child_hash["key.dot"] = "value.dot"
139
+ test_hash = {}
140
+ test_hash["key"] = "value"
141
+ test_hash["child.dot"] = test_child_hash
142
+ expect_child_hash = {}
143
+ expect_child_hash["key"] = test_child_hash["key"]
144
+ expect_child_hash["key.dot"] = test_child_hash["key.dot"]
145
+ expect_hash = {}
146
+ expect_hash["key"] = "value"
147
+ expect_hash["child_dot"] = expect_child_hash
148
+ expect(@filter.de_dot(test_hash)).to eq expect_hash
149
+ end
150
+
151
+ it "no error with recursive hash with de_dot_nested = true" do
152
+ # "child_dot" => {"key"=>"value", "key_dot"=>"value.dot"}
153
+ @filter.de_dot_nested = true
154
+ test_child_hash = {}
155
+ test_child_hash["key"] = "value"
156
+ test_child_hash["key.dot"] = "value.dot"
157
+ test_hash = {}
158
+ test_hash["key"] = "value"
159
+ test_hash["child.dot"] = test_child_hash
160
+ expect_child_hash = {}
161
+ expect_child_hash["key"] = test_child_hash["key"]
162
+ expect_child_hash["key_dot"] = test_child_hash["key.dot"]
163
+ expect_hash = {}
164
+ expect_hash["key"] = "value"
165
+ expect_hash["child_dot"] = expect_child_hash
166
+ expect(@filter.de_dot(test_hash)).to eq expect_hash
167
+ end
168
+
169
+ it "no error with recursive array with de_dot_nested = false" do
170
+ # "child_dot" => ["test", "test.dot", {"key"=>"value", "key.dot"=>"value.dot"}]
171
+ @filter.de_dot_nested = false
172
+ test_child_hash = {}
173
+ test_child_hash["key"] = "value"
174
+ test_child_hash["key.dot"] = "value.dot"
175
+ test_child_array = []
176
+ test_child_array.push("test")
177
+ test_child_array.push("test.dot")
178
+ test_child_array.push(test_child_hash)
179
+ test_hash = {}
180
+ test_hash["key"] = "value"
181
+ test_hash["child.dot"] = test_child_array
182
+ expect_child_hash = {}
183
+ expect_child_hash["key"] = test_child_hash["key"]
184
+ expect_child_hash["key.dot"] = test_child_hash["key.dot"]
185
+ expect_child_array = []
186
+ expect_child_array.push("test")
187
+ expect_child_array.push("test.dot")
188
+ expect_child_array.push(expect_child_hash)
189
+ expect_hash = {}
190
+ expect_hash["key"] = "value"
191
+ expect_hash["child_dot"] = expect_child_array
192
+ expect(@filter.de_dot(test_hash)).to eq expect_hash
193
+ end
194
+
195
+ it "no error with recursive array with de_dot_nested = true" do
196
+ # "child_dot" => ["test", "test.dot", {"key"=>"value", "key_dot"=>"value.dot"}]
197
+ @filter.de_dot_nested = true
198
+ test_child_hash = {}
199
+ test_child_hash["key"] = "value"
200
+ test_child_hash["key.dot"] = "value.dot"
201
+ test_child_array = []
202
+ test_child_array.push("test")
203
+ test_child_array.push("test.dot")
204
+ test_child_array.push(test_child_hash)
205
+ test_hash = {}
206
+ test_hash["key"] = "value"
207
+ test_hash["child.dot"] = test_child_array
208
+ expect_child_hash = {}
209
+ expect_child_hash["key"] = test_child_hash["key"]
210
+ expect_child_hash["key_dot"] = test_child_hash["key.dot"]
211
+ expect_child_array = []
212
+ expect_child_array.push("test")
213
+ expect_child_array.push("test.dot")
214
+ expect_child_array.push(expect_child_hash)
215
+ expect_hash = {}
216
+ expect_hash["key"] = "value"
217
+ expect_hash["child_dot"] = expect_child_array
218
+ expect(@filter.de_dot(test_hash)).to eq expect_hash
219
+ end
220
+
221
+ end
222
+
223
+ end
224
+
225
+ end
data/spec/helper.rb ADDED
@@ -0,0 +1,32 @@
1
+ # -*- coding: utf-8 -*-
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+
6
+ begin
7
+ Bundler.setup(:default, :development)
8
+ rescue Bundler::BundlerError => e
9
+ $stderr.puts e.message
10
+ $stderr.puts "Run `bundle install` to install missing gems."
11
+ exit e.status_code
12
+ end
13
+
14
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
15
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
16
+
17
+ unless ENV.has_key?('VERBOSE')
18
+ nulllogger = Object.new
19
+ nulllogger.instance_eval { |obj|
20
+ def method_missing(method, *args)
21
+ #pass
22
+ end
23
+ }
24
+ $log = nulllogger
25
+ end
26
+
27
+ require 'fluent/test'
28
+ # fluent/test loads test-unit, whose at_exit autorunner would otherwise try
29
+ # to parse RSpec's command-line options (e.g. --pattern) and fail the run.
30
+ Test::Unit::AutoRunner.need_auto_run = false if defined?(Test::Unit::AutoRunner)
31
+ require 'fluent/test/driver/filter'
32
+ require 'fluent/plugin/filter_dedot'
@@ -0,0 +1,24 @@
1
+ # Loaded for every spec via `--require spec_helper` in .rspec.
2
+ # Keep this file lightweight; plugin-specific setup lives in spec/helper.rb.
3
+
4
+ # Local coverage report (no external service): COVERAGE=1 bundle exec rake spec
5
+ # The HTML report is written to coverage/index.html.
6
+ if ENV["COVERAGE"]
7
+ require "simplecov"
8
+ SimpleCov.start do
9
+ # SimpleCov 1.x renamed add_filter to skip; older releases (still
10
+ # resolved on Ruby < 3.3) only have add_filter.
11
+ respond_to?(:skip) ? skip("/spec/") : add_filter("/spec/")
12
+ enable_coverage :branch
13
+ end
14
+ end
15
+
16
+ RSpec.configure do |config|
17
+ config.expect_with :rspec do |expectations|
18
+ expectations.include_chain_clauses_in_custom_matcher_descriptions = true
19
+ end
20
+
21
+ config.mock_with :rspec do |mocks|
22
+ mocks.verify_partial_doubles = true
23
+ end
24
+ end