Two checks that would have been read wrong, and one that could have flaked
The unreadable-frame case wrote both frames as one string, where `(:a14' reads as a typo rather than as the end of one frame and the start of the next; they are two inserts now, with a line saying which is which. And the check that a request after a daemon restart does not wait out a reply the old connection owed was asserting against the same number it had bound the timeout to -- the one arrangement that cannot tell "fast" from "timed out a moment ago". The timeout is ten seconds and the assertion is three, which is the gap the claim is actually about.
This commit is contained in:
parent
f186284a4d
commit
866c0792e0
@ -139,7 +139,12 @@ is written instead — the real `message' call the real command makes."
|
||||
;; A payload that will not read, with a good frame behind it: the
|
||||
;; claim is that the second one arrives, which is the whole of
|
||||
;; self-healing and stronger than an empty buffer.
|
||||
(with-current-buffer buf (insert "3\n(:a14\n(:status \"ok\")"))
|
||||
;; Two frames, written one after the other because that is what
|
||||
;; they are: three bytes of `(:a', which will not read, and then a
|
||||
;; whole reply behind it.
|
||||
(with-current-buffer buf
|
||||
(insert "3\n(:a")
|
||||
(insert "14\n(:status \"ok\")"))
|
||||
(let ((raised nil))
|
||||
(condition-case err (flan-dev--take-reply stand-in)
|
||||
(error (setq raised (error-message-string err))))
|
||||
@ -799,12 +804,17 @@ is written instead — the real `message' call the real command makes."
|
||||
;; typed after a restart, which is why the wait itself is what is measured.
|
||||
(flan-watch--tick)
|
||||
(delete-process flan-dev--connection)
|
||||
(let ((flan-dev-reply-timeout 2)
|
||||
;; The timeout and the assertion are deliberately different numbers: what is
|
||||
;; being told apart is a request that waited one out from a request that did
|
||||
;; not, and the wider the gap the less this depends on how loaded the machine
|
||||
;; running the suite happens to be. A reconnect and a `describe' are
|
||||
;; milliseconds of work.
|
||||
(let ((flan-dev-reply-timeout 10)
|
||||
(started (float-time)))
|
||||
(let ((r (flan-dev--request '(:op "describe"))))
|
||||
(test-flan--check "a request after a restart does not wait out a reply the old connection owed"
|
||||
(and (member "step" (plist-get r :fns))
|
||||
(< (- (float-time) started) 2)))
|
||||
(< (- (float-time) started) 3)))
|
||||
(test-flan--check "and the watch is not left waiting for one either"
|
||||
(null flan-watch--pending))))
|
||||
;; A request in flight again, for the interleaving below.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user