-
Notifications
You must be signed in to change notification settings - Fork 518
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
inject! hangs up with current timestamps #941
Comments
Hello, I'm not able to reproduce your issue: (logging/init {:file "/var/log/riemann/riemann.log"})
(let [host "127.0.0.1"]
(tcp-server {:host host})
(udp-server {:host host})
(repl-server {:host host})
(ws-server {:host host}))
(streams
(tap :foo))
(tests (deftest timestamp-test
(let [result
(inject! [{:host "test.example.com" :service "test" :metric 1337 :time 109889374}
{:host "test.example.com" :service "test" :metric 1337 :time 109889375}
{:host "test.example.com" :service "test" :metric 1337 :time 1109889374}])]
(= (:foo result)
[{:host "test.example.com" :service "test" :metric 1337 :time 109889374}
{:host "test.example.com" :service "test" :metric 1337 :time 109889375}
{:host "test.example.com" :service "test" :metric 1337 :time 1109889374}]))))
What are you testing ? |
Hi, my apologies I should have added the whole config - but I managed to single out a possible culprit. (logging/init {:file "/var/log/riemann/riemann.log"})
(let [host "127.0.0.1"]
(tcp-server {:host host})
(udp-server {:host host})
(repl-server {:host host})
(ws-server {:host host}))
(periodically-expire 5)
(let [index (index)]
(streams
index
(tap :foo)))
(tests (deftest timestamp-test
(let [result
(inject! [{:host "test.example.com" :service "test" :metric 1337 :time 109889374}
{:host "test.example.com" :service "test" :metric 1337 :time 109889375}
{:host "test.example.com" :service "test" :metric 1337 :time 1109889374}])]
(= (:foo result)
[{:host "test.example.com" :service "test" :metric 1337 :time 109889374}
{:host "test.example.com" :service "test" :metric 1337 :time 109889375}
{:host "test.example.com" :service "test" :metric 1337 :time 1109889374}]))))
|
@bickerle few tips:
@mcorbin this is a weird bug that, when instrumentation is explicitly enabled or disabled, it will not happen. Unless instrumentation call is made with I'm not able to track what is difference between explicit For now, here is pretty dumb patch that take care of diff --git a/src/riemann/test.clj b/src/riemann/test.clj
index 09f224d..b112945 100644
--- a/src/riemann/test.clj
+++ b/src/riemann/test.clj
@@ -36,9 +36,9 @@
[name child]
(fn stream [event]
; Record event
- (-> *results*
- (get name)
- (swap! conj event))
+ (some-> *results*
+ (get name)
+ (swap! conj event))
; Forward downstream
(child event))) |
Behavior is explained on [1] In short, unless (instrumentation) is explicitly set and tests has time gap that will put Riemann in sleep, another thread will kick instrumentation while tests are running, causing NullPointerException. [1] riemann#941 (comment)
Hello fellow riemann enthusiasts,
while running tests with current event timestamps I encountered the problem that my test events were not injected into the streams. The following snippet showcases the issue. When run as is the test does not terminate. If you remove the last event (its timestamp has one more digit than the first two) it terminates within seconds.
I took a peek into the source code but could not find any reasons for this behavior.
The obvious workaround is to use smaller timestamps but it would be nice to be able to use real life examples as test cases.
Thanks in advance for any help!
The text was updated successfully, but these errors were encountered: