From cc2246a43d79a479e1e2776cd59fcf9700e11bf0 Mon Sep 17 00:00:00 2001 From: Dave Ray Date: Fri, 19 Jul 2013 21:39:12 -0700 Subject: [PATCH] Reset Hystrix after tests have run. Without the resets, running the tests more than once will fail due to collapser instance caching behind the scenes. --- .../test/clojure/com/netflix/hystrix/core_test.clj | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/hystrix-contrib/hystrix-clj/src/test/clojure/com/netflix/hystrix/core_test.clj b/hystrix-contrib/hystrix-clj/src/test/clojure/com/netflix/hystrix/core_test.clj index 86606d498..1da742058 100644 --- a/hystrix-contrib/hystrix-clj/src/test/clojure/com/netflix/hystrix/core_test.clj +++ b/hystrix-contrib/hystrix-clj/src/test/clojure/com/netflix/hystrix/core_test.clj @@ -1,9 +1,19 @@ (ns com.netflix.hystrix.core-test (:use com.netflix.hystrix.core) (:require [clojure.test :refer [deftest testing is are use-fixtures]]) - (:import [com.netflix.hystrix HystrixExecutable] + (:import [com.netflix.hystrix Hystrix HystrixExecutable] [com.netflix.hystrix.strategy.concurrency HystrixRequestContext])) +; reset hystrix after each execution, for consistency and sanity +(defn reset-fixture + [f] + (try + (f) + (finally + (Hystrix/reset)))) + +(use-fixtures :once reset-fixture) + ; wrap each test in hystrix context (defn request-context-fixture [f]