storm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bo...@apache.org
Subject [07/47] storm git commit: Change TEST-TIMEOUT-MS to be simpler and maybe faster
Date Wed, 12 Nov 2014 16:45:08 GMT
Change TEST-TIMEOUT-MS to be simpler and maybe faster


Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/7a93dd6c
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/7a93dd6c
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/7a93dd6c

Branch: refs/heads/security
Commit: 7a93dd6c6c5d2aec27512232c407750c5aa8a150
Parents: 00d9051
Author: Jungtaek Lim <kabhwan@gmail.com>
Authored: Fri Oct 3 09:57:04 2014 +0900
Committer: Jungtaek Lim <kabhwan@gmail.com>
Committed: Fri Oct 3 09:57:04 2014 +0900

----------------------------------------------------------------------
 storm-core/src/clj/backtype/storm/testing.clj       | 14 +++++++-------
 storm-core/test/clj/backtype/storm/metrics_test.clj |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/7a93dd6c/storm-core/src/clj/backtype/storm/testing.clj
----------------------------------------------------------------------
diff --git a/storm-core/src/clj/backtype/storm/testing.clj b/storm-core/src/clj/backtype/storm/testing.clj
index 6da243f..a144442 100644
--- a/storm-core/src/clj/backtype/storm/testing.clj
+++ b/storm-core/src/clj/backtype/storm/testing.clj
@@ -187,9 +187,9 @@
       ;; on windows, the host process still holds lock on the logfile
       (catch Exception e (log-message (.getMessage e)))) ))
 
-(defn default-test-timeout-ms []
-  (let [timeout-ms (System/getProperty "STORM_TEST_TIMEOUT_MS")]
-    (if (not-nil? timeout-ms) (Long/parseLong timeout-ms) 5000)))
+(def TEST-TIMEOUT-MS
+  (let [timeout (System/getenv "STORM_TEST_TIMEOUT_MS")]
+    (read-string (if timeout timeout "5000"))))
 
 (defmacro while-timeout [timeout-ms condition & body]
   `(let [end-time# (+ (System/currentTimeMillis) ~timeout-ms)]
@@ -200,7 +200,7 @@
 
 (defn wait-until-cluster-waiting
   "Wait until the cluster is idle. Should be used with time simulation."
-  ([cluster-map] (wait-until-cluster-waiting cluster-map (default-test-timeout-ms)))
+  ([cluster-map] (wait-until-cluster-waiting cluster-map TEST-TIMEOUT-MS))
   ([cluster-map timeout-ms]
   ;; wait until all workers, supervisors, and nimbus is waiting
   (let [supervisors @(:supervisors cluster-map)
@@ -459,7 +459,7 @@
    :storm-conf {}
    :cleanup-state true
    :topology-name nil
-   :timeout-ms (default-test-timeout-ms)]
+   :timeout-ms TEST-TIMEOUT-MS]
   ;; TODO: the idea of mocking for transactional topologies should be done an
   ;; abstraction level above... should have a complete-transactional-topology for this
   (let [{topology :topology capturer :capturer} (capture-topology topology)
@@ -585,9 +585,9 @@
 (defn tracked-wait
   "Waits until topology is idle and 'amt' more tuples have been emitted by spouts."
   ([tracked-topology]
-     (tracked-wait tracked-topology 1 (default-test-timeout-ms)))
+     (tracked-wait tracked-topology 1 TEST-TIMEOUT-MS))
   ([tracked-topology amt]
-     (tracked-wait tracked-topology amt (default-test-timeout-ms)))
+     (tracked-wait tracked-topology amt TEST-TIMEOUT-MS))
   ([tracked-topology amt timeout-ms]
       (let [target (+ amt @(:last-spout-emit tracked-topology))
             track-id (-> tracked-topology :cluster ::track-id)

http://git-wip-us.apache.org/repos/asf/storm/blob/7a93dd6c/storm-core/test/clj/backtype/storm/metrics_test.clj
----------------------------------------------------------------------
diff --git a/storm-core/test/clj/backtype/storm/metrics_test.clj b/storm-core/test/clj/backtype/storm/metrics_test.clj
index a17b8f8..4356d30 100644
--- a/storm-core/test/clj/backtype/storm/metrics_test.clj
+++ b/storm-core/test/clj/backtype/storm/metrics_test.clj
@@ -71,7 +71,7 @@
 (def metrics-data backtype.storm.metric.testing/buffer)
 
 (defn wait-for-atleast-N-buckets! [N comp-id metric-name cluster]
-  (while-timeout (default-test-timeout-ms)
+  (while-timeout TEST-TIMEOUT-MS
       (let [taskid->buckets (-> @metrics-data (get comp-id) (get metric-name))]
         (or
          (and (not= N 0) (nil? taskid->buckets))


Mime
View raw message