Skip to content

Commit

Permalink
Fix stress tests runner
Browse files Browse the repository at this point in the history
- Support for tests filtering/sorting
- Notify tests as ignored when disabled
  • Loading branch information
Sergey Mashkov committed Feb 5, 2020
1 parent d5f5525 commit 575afd2
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,30 @@
package io.ktor.server.testing

import org.junit.runner.*
import org.junit.runner.manipulation.*
import org.junit.runner.notification.*
import org.junit.runners.*

class StressSuiteRunner(klass: Class<*>) : Runner() {
class StressSuiteRunner(klass: Class<*>) : Runner(), Filterable, Sortable {
private val delegate = JUnit4(klass)

override fun run(notifier: RunNotifier?) {
if (System.getProperty("enable.stress.tests") != null) {
delegate.run(notifier)
} else {
delegate.description.children?.forEach { child ->
notifier?.fireTestIgnored(child)
}
}
}

override fun getDescription(): Description = delegate.description

override fun filter(filter: Filter?) {
delegate.filter(filter)
}

override fun sort(sorter: Sorter?) {
delegate.sort(sorter)
}
}

0 comments on commit 575afd2

Please sign in to comment.