fluent-plugin-obsolete-plugins 0.2.0 → 0.2.2
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.
- checksums.yaml +4 -4
- data/fluent-plugin-obsolete-plugins.gemspec +1 -1
- data/lib/fluent/plugin/in_obsolete_plugins.rb +4 -0
- data/lib/fluent/plugin/obsolete_plugins_utils.rb +5 -1
- data/test/plugin/test_filter_obsolete_plugins.rb +27 -20
- data/test/plugin/test_in_obsolete_plugins.rb +18 -10
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b6c07c6ed495bdfdd502305198967a85e1d6f805ef16bc01b8ce742b05eb6512
|
4
|
+
data.tar.gz: afb33857dc7feff9a7cc1b8e843ee27bfdadf298d0b950b388c6700c884a7bb0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: decd922d81f4646b86fd12a39cd05545503560f0b968d0a5f37b14cb9153c837ba8a9cf99e7303e22d20a48c0858c8022197cf836aabf117963df69a78dee08e
|
7
|
+
data.tar.gz: 9f4da101e8d69efba32bc1f95ef7622b8947b2968c940e474ffaceafc0773ade65ed32e22de874bfe8491c898de23960517ca3bd86c51823dcc8995e511c1440
|
@@ -28,8 +28,12 @@ class Fluent::Plugin::ObsoletePluginsUtils
|
|
28
28
|
end
|
29
29
|
end
|
30
30
|
|
31
|
+
def self.installed_plugins
|
32
|
+
Gem::Specification.find_all.select { |x| x.name =~ /^fluent(d|-(plugin|mixin)-.*)$/ }.map(&:name)
|
33
|
+
end
|
34
|
+
|
31
35
|
def self.notify(logger, obsolete_plugins, raise_error: false)
|
32
|
-
plugins =
|
36
|
+
plugins = Fluent::Plugin::ObsoletePluginsUtils.installed_plugins & obsolete_plugins.keys
|
33
37
|
plugins.each do |name|
|
34
38
|
logger.warn("#{name} is obsolete: #{obsolete_plugins[name].chomp}")
|
35
39
|
end
|
@@ -14,12 +14,25 @@ class ObsoletePluginsFilterTest < Test::Unit::TestCase
|
|
14
14
|
Timecop.return
|
15
15
|
end
|
16
16
|
|
17
|
+
test "multi worker" do
|
18
|
+
config = %[
|
19
|
+
obsolete_plugins_yml #{fixture_path("obsolete-plugins.yml")}
|
20
|
+
]
|
21
|
+
|
22
|
+
d = create_driver(config)
|
23
|
+
assert_true d.instance.multi_workers_ready?
|
24
|
+
end
|
25
|
+
|
17
26
|
sub_test_case "obsolete_plugins_yml" do
|
18
27
|
CONFIG_YAML = %[
|
19
28
|
obsolete_plugins_yml #{fixture_path("obsolete-plugins.yml")}
|
20
29
|
]
|
21
30
|
|
22
31
|
test "no obsolete plugins" do
|
32
|
+
stub(Fluent::Plugin::ObsoletePluginsUtils).installed_plugins do
|
33
|
+
[]
|
34
|
+
end
|
35
|
+
|
23
36
|
d = create_driver(CONFIG_YAML)
|
24
37
|
d.run(default_tag: "test") do
|
25
38
|
d.feed({ message: "This is test message." })
|
@@ -32,12 +45,10 @@ class ObsoletePluginsFilterTest < Test::Unit::TestCase
|
|
32
45
|
end
|
33
46
|
|
34
47
|
test "obsolete plugins" do
|
35
|
-
|
36
|
-
|
37
|
-
"fluent-plugin-tail-multiline" => nil,
|
38
|
-
"fluent-plugin-hostname" => nil
|
39
|
-
}
|
48
|
+
stub(Fluent::Plugin::ObsoletePluginsUtils).installed_plugins do
|
49
|
+
["fluent-plugin-tail-multiline", "fluent-plugin-hostname"]
|
40
50
|
end
|
51
|
+
|
41
52
|
d = create_driver(CONFIG_YAML)
|
42
53
|
d.run(default_tag: "test") do
|
43
54
|
d.feed({ message: "This is test message." })
|
@@ -52,11 +63,8 @@ class ObsoletePluginsFilterTest < Test::Unit::TestCase
|
|
52
63
|
end
|
53
64
|
|
54
65
|
test "raise error when detect obsolete plugins" do
|
55
|
-
|
56
|
-
|
57
|
-
"fluent-plugin-tail-multiline" => nil,
|
58
|
-
"fluent-plugin-hostname" => nil
|
59
|
-
}
|
66
|
+
stub(Fluent::Plugin::ObsoletePluginsUtils).installed_plugins do
|
67
|
+
["fluent-plugin-tail-multiline", "fluent-plugin-hostname"]
|
60
68
|
end
|
61
69
|
|
62
70
|
ex = assert_raise(Fluent::ConfigError) do
|
@@ -72,6 +80,10 @@ class ObsoletePluginsFilterTest < Test::Unit::TestCase
|
|
72
80
|
]
|
73
81
|
|
74
82
|
test "no obsolete plugins" do
|
83
|
+
stub(Fluent::Plugin::ObsoletePluginsUtils).installed_plugins do
|
84
|
+
[]
|
85
|
+
end
|
86
|
+
|
75
87
|
d = create_driver(CONFIG_JSON)
|
76
88
|
d.run(default_tag: "test") do
|
77
89
|
d.feed({ message: "This is test message." })
|
@@ -81,12 +93,10 @@ class ObsoletePluginsFilterTest < Test::Unit::TestCase
|
|
81
93
|
end
|
82
94
|
|
83
95
|
test "obsolete plugins" do
|
84
|
-
|
85
|
-
|
86
|
-
"fluent-plugin-tail-multiline" => nil,
|
87
|
-
"fluent-plugin-hostname" => nil
|
88
|
-
}
|
96
|
+
stub(Fluent::Plugin::ObsoletePluginsUtils).installed_plugins do
|
97
|
+
["fluent-plugin-tail-multiline", "fluent-plugin-hostname"]
|
89
98
|
end
|
99
|
+
|
90
100
|
d = create_driver(CONFIG_JSON)
|
91
101
|
d.run(default_tag: "test") do
|
92
102
|
d.feed({ message: "This is test message." })
|
@@ -100,11 +110,8 @@ class ObsoletePluginsFilterTest < Test::Unit::TestCase
|
|
100
110
|
end
|
101
111
|
|
102
112
|
test "raise error when detect obsolete plugins" do
|
103
|
-
|
104
|
-
|
105
|
-
"fluent-plugin-tail-multiline" => nil,
|
106
|
-
"fluent-plugin-hostname" => nil
|
107
|
-
}
|
113
|
+
stub(Fluent::Plugin::ObsoletePluginsUtils).installed_plugins do
|
114
|
+
["fluent-plugin-tail-multiline", "fluent-plugin-hostname"]
|
108
115
|
end
|
109
116
|
|
110
117
|
ex = assert_raise(Fluent::ConfigError) do
|
@@ -15,12 +15,25 @@ class ObsoletePluginsInputTest < Test::Unit::TestCase
|
|
15
15
|
Timecop.return
|
16
16
|
end
|
17
17
|
|
18
|
+
test "multi worker" do
|
19
|
+
config = %[
|
20
|
+
obsolete_plugins_yml #{fixture_path("obsolete-plugins.yml")}
|
21
|
+
]
|
22
|
+
|
23
|
+
d = create_driver(config)
|
24
|
+
assert_true d.instance.multi_workers_ready?
|
25
|
+
end
|
26
|
+
|
18
27
|
sub_test_case "plugins_json" do
|
19
28
|
CONFIG_JSON = %[
|
20
29
|
plugins_json #{fixture_path("plugins.json")}
|
21
30
|
]
|
22
31
|
|
23
32
|
test "no obsolete plugins" do
|
33
|
+
stub(Fluent::Plugin::ObsoletePluginsUtils).installed_plugins do
|
34
|
+
[]
|
35
|
+
end
|
36
|
+
|
24
37
|
d = create_driver(CONFIG_JSON)
|
25
38
|
d.run
|
26
39
|
assert_equal([], d.events)
|
@@ -28,12 +41,10 @@ class ObsoletePluginsInputTest < Test::Unit::TestCase
|
|
28
41
|
end
|
29
42
|
|
30
43
|
test "obsolete plugins" do
|
31
|
-
stub(
|
32
|
-
|
33
|
-
"fluent-plugin-tail-multiline" => nil,
|
34
|
-
"fluent-plugin-hostname" => nil
|
35
|
-
}
|
44
|
+
stub(Fluent::Plugin::ObsoletePluginsUtils).installed_plugins do
|
45
|
+
["fluent-plugin-tail-multiline", "fluent-plugin-hostname"]
|
36
46
|
end
|
47
|
+
|
37
48
|
d = create_driver(CONFIG_JSON)
|
38
49
|
d.run
|
39
50
|
assert_equal([], d.events)
|
@@ -45,11 +56,8 @@ class ObsoletePluginsInputTest < Test::Unit::TestCase
|
|
45
56
|
end
|
46
57
|
|
47
58
|
test "raise error when detect obsolete plugins" do
|
48
|
-
stub(
|
49
|
-
|
50
|
-
"fluent-plugin-tail-multiline" => nil,
|
51
|
-
"fluent-plugin-hostname" => nil
|
52
|
-
}
|
59
|
+
stub(Fluent::Plugin::ObsoletePluginsUtils).installed_plugins do
|
60
|
+
["fluent-plugin-tail-multiline", "fluent-plugin-hostname"]
|
53
61
|
end
|
54
62
|
|
55
63
|
ex = assert_raise(Fluent::ConfigError) do
|