File tree Expand file tree Collapse file tree 1 file changed +25
-4
lines changed Expand file tree Collapse file tree 1 file changed +25
-4
lines changed Original file line number Diff line number Diff line change 18
18
(def clojure-artifacts [" clojure" ])
19
19
(def clojars-artifacts (resource " clojars-artifacts.edn" ))
20
20
21
+ (defn retry-flaky
22
+ " Retries a flaky fn `f`.
23
+
24
+ In our case the flakiness is outside of our control since Maven Central,
25
+ Clojars, etc can always have hiccups."
26
+ ([f]
27
+ (retry-flaky f 0 ))
28
+ ([f ^long attempts]
29
+ (try
30
+ (f )
31
+ (catch Exception e
32
+ ; ; give Maven a break:
33
+ (Thread/sleep 12000 )
34
+ (if (< attempts 4 )
35
+ (retry-flaky f (inc attempts))
36
+ (throw e))))))
37
+
21
38
(deftest get-mvn-artifacts!-test
22
- (is (> (count (#'artifacts/get-mvn-artifacts! " org.clojure" ))
39
+ (is (> (count (retry-flaky (fn []
40
+ (#'artifacts/get-mvn-artifacts! " org.clojure" ))))
23
41
10 )))
24
42
25
43
(deftest get-clojars-artifacts!-test
26
- (is (> (count (#'artifacts/get-clojars-artifacts! ))
44
+ (is (> (count (retry-flaky (fn []
45
+ (#'artifacts/get-clojars-artifacts! ))))
27
46
1000 )))
28
47
29
48
(deftest get-mvn-versions!-test
30
- (is (> (count (#'artifacts/get-mvn-versions! " org.clojure/clojure" ))
49
+ (is (> (count (retry-flaky (fn []
50
+ (#'artifacts/get-mvn-versions! " org.clojure/clojure" ))))
31
51
20 )))
32
52
33
53
(deftest get-clojars-versions!-test
34
- (is (> (count (#'artifacts/get-clojars-versions! " refactor-nrepl/refactor-nrepl" ))
54
+ (is (> (count (retry-flaky (fn []
55
+ (#'artifacts/get-clojars-versions! " refactor-nrepl/refactor-nrepl" ))))
35
56
30 )))
36
57
37
58
(deftest creates-a-map-of-artifacts
You can’t perform that action at this time.
0 commit comments