Commit 962aca5
committed
Make leak detector robust against leaks from preceding tests
[A CI test
run](https://app.circleci.com/pipelines/github/clj-commons/aleph/769/workflows/1be2f5bc-92a9-4768-aa93-845365476aaf/jobs/753/parallel-runs/0/steps/0-107)
recently failed with this error coming from the resource leak detector:
ERROR in (test-basic-auth-value-encoding) (core.clj:2362)
expected: (= "Basic Og==" (middleware/basic-auth-value nil))
actual: java.lang.ClassCastException: clojure.lang.Var$Unbound cannot be cast to clojure.lang.IAtom
at clojure.core$swap_BANG_.invokeStatic (core.clj:2362)
clojure.core$swap_BANG_.invoke (core.clj:2362)
aleph.resource_leak_detector$_reportTracedLeak.invokeStatic (resource_leak_detector.clj:138)
aleph.resource_leak_detector$_reportTracedLeak.invoke (resource_leak_detector.clj:137)
aleph.resource_leak_detector.reportTracedLeak (:-1)
However, the test namespace in question isn't even instrumented for leak detection (i.e. there is no
`aleph.resource-leak-detector/instrument-tests!` call at its bottom). Immediately before this error,
there is another one, though:
ERROR in (test-shutdown-timeout-1) (resource_leak_detector.clj:103)
Uncaught exception, not in assertion.
expected: nil
actual: java.lang.RuntimeException: Gave up awaiting leak probe. Try increasing `aleph.resource-leak-detector/max-probe-gc-runs`.
This indicates that there was still a pending leak detection probe which was then (attempted to be)
reported in the context of the following test. To prevent such red herrings in the future, we now
gracefully report such leaked leaks.1 parent 6465e3a commit 962aca5
1 file changed
+19
-11
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | | - | |
| 91 | + | |
| 92 | + | |
92 | 93 | | |
93 | 94 | | |
94 | 95 | | |
| |||
131 | 132 | | |
132 | 133 | | |
133 | 134 | | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
134 | 141 | | |
135 | 142 | | |
136 | 143 | | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
137 | 151 | | |
138 | | - | |
139 | | - | |
| 152 | + | |
| 153 | + | |
140 | 154 | | |
141 | 155 | | |
142 | 156 | | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
| 157 | + | |
| 158 | + | |
151 | 159 | | |
152 | 160 | | |
153 | 161 | | |
| |||
0 commit comments