forked from twitter/finagle
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
finagle-mux: Preserve RetryableNackFailure log level when reusing fla…
…gs from context Problem If RdispatchNack propagates flags, it should still have similar behavior to if flags aren't propagated. Solution Copy the RetryableNackFailure instead of constructing a wholly new Failure. Result Instead of using the default log level, we reuse the RetryableNackFailure log level. Nothing else is changed. Differential Revision: https://phabricator.twitter.biz/D214841
- Loading branch information
Showing
2 changed files
with
22 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
finagle-mux/src/test/scala/com/twitter/finagle/mux/ReqRepFilterTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.twitter.finagle.mux | ||
|
||
import com.twitter.finagle.Failure | ||
import com.twitter.finagle.mux.transport.{Message, MuxFailure} | ||
import com.twitter.logging.Level | ||
import org.scalatest.FunSuite | ||
|
||
class ReqRepFilterTest extends FunSuite { | ||
test("Hydrate a mux failure from a message with encoded error codes, so that it preserves the" + | ||
" flags and uses the right log level") { | ||
val muxFailure = new MuxFailure(MuxFailure.NonRetryable | MuxFailure.Rejected) | ||
val contexts = muxFailure.contexts | ||
val msg = Message.RdispatchNack(1 /* tag */, contexts) | ||
val actual = intercept[Failure] { | ||
ReqRepFilter.reply(msg).get | ||
} | ||
assert(actual == Failure.RetryableNackFailure.withFlags(muxFailure.finagleFlags)) | ||
assert(actual.flags == muxFailure.finagleFlags) | ||
assert(actual.logLevel == Level.DEBUG) | ||
} | ||
} |