forked from skinny-framework/skinny-framework
-
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.
Merge pull request skinny-framework#257 from seratch/memory-leak
Fix memory leak at SkinnyFilterActivation
- Loading branch information
Showing
3 changed files
with
91 additions
and
37 deletions.
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
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
24 changes: 24 additions & 0 deletions
24
framework/src/test/scala/skinny/filter/SkinnyFilterActivationSpec.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,24 @@ | ||
package skinny.filter | ||
|
||
import org.scalatra.test.scalatest.ScalatraFlatSpec | ||
import skinny.SkinnyApiController | ||
import skinny.routing.Routes | ||
|
||
class SkinnyFilterActivationSpec extends ScalatraFlatSpec with skinny.Logging { | ||
|
||
object Controller extends SkinnyApiController with SkinnyFilterActivation with Routes { | ||
override def detectTooManyErrorFilterRegistrationnAsAnErrorAtSkinnyScalatraBase = true | ||
def index = "ok" | ||
get("/")(index).as('index) | ||
} | ||
addFilter(Controller, "/*") | ||
|
||
it should "not waste memory" in { | ||
(1 to 500).foreach { _ => | ||
get("/") { status should equal(200) } | ||
} | ||
// if possible leak detected, this status will be 500 | ||
get("/") { status should equal(200) } | ||
} | ||
|
||
} |