NOJIRA-270: add retry macro; add it to a failing test#318
NOJIRA-270: add retry macro; add it to a failing test#318ktakashi merged 5 commits intoktakashi:masterfrom
retry macro; add it to a failing test#318Conversation
|
I need to change how retry works; upon failure it should re-raise the last exception instead of returning a unique object (the unique object would signal failure, since it would be out of the result set of the function). |
|
@ktakashi , done, not retry simply runs the thunk on the last attempt (thus raising if that happens). |
|
The Here is the simple case to proof my point (import (rnrs))
(with-exception-handler
(lambda (e) #t) ;; this is not allowed
(lambda () (error 'test "msg")))
;; the above expression ends up an errorTo avoid this, you need to use |
Yes. I know the ideal scenario would be to tackle the root cause, but my suggestion (it's up for your approval, of course) would be to have the CI/CD stable and then become more stringent with failing tests, perhaps explicitly not allowing them to non-deterministically fail. It's a tough call; big test suites are hardly deterministic, specially supporting so many systems, and involving networking, etc.
Indeed, I did just that. I'm a novice in Scheme, so I have not internalized the idea of having continuable and non continuable exceptions. Now I'm using a The next step would be to add this to every test that's non deterministically failing, and consider the tests stable afterwards (with a possibly "policy" change on tests failing). What do you think? The ultimate goal is to a have a test suite that coincides with what is acceptable or not. Thanks for your review. |
|
If you know which procedure is raising an error during the test, then it'd be better to do it like this then ;; rewrite retry macro syntax like this
(define-syntax retry
(syntac-rules ()
((_ n-retry expr ...)
(let ((procedure (lambda () expr ...)))
// retry implementation
...))))
(let ((r (retry 5 (${target-procedure} ...))))
// proceed the test
(test-assert ...)
...)This way, the test failure won't be double (or more). |
|
This is the specific error I'm targeting, unfortunately I did not save CircleCI's URL (but it's there somewhere): If I understood your suggestion, I don't think that if I retry at the function level, It's a good point that having the test fail more than once is a bit weird, but between it failing 1 time versus say 3 times I don't think it changes much. I can add the retry at this level: But I'm not sure it will actually do the trick here. What do you think? Thanks for your feedback. |
|
It'd be better to then change the test like this (guard (e ((socket-error? e) (test-assert "server socket closed" #t))
(else (test-assert (condition-message e) #f)))
(let ((bv (socket-recv sock 5)))
(test-equal #vu8(1 2 3 4 5) bv)))The fundamental issue of the test failure is race condition, caused by the procedure of |
|
Sounds good. I tried to reproduce this on my Linux but it seems it has a different semantics on sockets closing compared to Windows (Linux seems to allow reading buffered data after the socket is closed). Anyway, here's your suggested fix; I'll move on to other test fixes (I'm open to ideas). Thanks for the feedback. |
No description provided.