Added the processing when did not match the rules.#1
Added the processing when did not match the rules.#1studio3104 wants to merge 3 commits intokentaro:masterfrom
Conversation
There was a problem hiding this comment.
ここ、なんでelement["pattern"]に変更したんでしょうか。
element["pattern"]だと、ルールにpatternと書いただけで空文字が入ってしまう(つまりtrueになる)ので、patternというキーを設定するってことは、それが空文字だろうがなんだろうが、なんか設定する意思を表示したものとして扱うためにhas_key?したような記憶があります。
でもあんま憶えてないので嘘かもですが…
|
ご指摘の箇所を修正し、エラーメッセージのテストを追加しました。 ご確認よろしくお願いいたします。 |
There was a problem hiding this comment.
test_emit d3のケースで通過します。
・replaceが設定されているが、同じkeyに対してのruleで、append_to_tagが設定されていない場合
コメント書いてて気づきましたがコレはapply_ruleのところに書くべきですね・・・
There was a problem hiding this comment.
あ、でもその場合はconfigErrorにしたほうが良い気もしてきました。
どう思われますか?
There was a problem hiding this comment.
Error投げるとfluentdとまりますよね? 止まったほうがいいのかなー
There was a problem hiding this comment.
起動しなくなりますね。
でも、該当する場合は未来永劫emitしないruleなわけですからね・・・
There was a problem hiding this comment.
ああ、最初のconfigのところでErrorにするわけですね。それならいいとおもいます。
There was a problem hiding this comment.
言葉足らずで申し訳ありません。。
では、cofigureメソッドでチェックして、ダメな場合はerrorにしますね。
There was a problem hiding this comment.
例外をテストするなら、assert_raise使う感じですねー
http://www.ruby-doc.org/stdlib-1.9.3/libdoc/test/unit/rdoc/Test/Unit/Assertions.html#method-i-assert_raise
|
・単一のkeyに対して最終的にappend_to_tagがセットされていない場合 に、raise ConfigErrorするようにしました。 |
Hi.
I've added the action to take if do not match the rules.
Changes
・Do not emit if the tag is not replaced.
・Output an error message depending on the situation.
・Set the rules required the 'key' and 'pattern'.
Thank you confirmation.