node-red/node-red — pull request #347 by zobalogh (2014-08-19 16:12:06+00:00)
Title: Adding Delay node test

DO NOT MERGE YET. I just wanted to show my progress to @knolleary as I've got questions. My questions are:

1) Do you like/can you live with my approach to measure runtime, then compare it to the expected value using a "close enough" function? If I set the grace to be low (say 10%) then currently I get intermittent failures. Have to investigate why I'm receiving so severely different runtimes sometimes... Suspecting something to do with Node itself but not sure yet. Will be looking into this tomorrow.

2) The delay tests are naturally slow.. Maybe an alternative approach is to incorporate a test mode into the node (sadly) so that the test could check intentional delay instead of actual delay?

3) I've yet to add "rate" tests in other units other than seconds. I think adding huge rates will result in a measureable runtime. However I do wonder if the calculations for rate actually make sense, in terms of initial burst/message support. Say I could say, rate limit to 1 million messages per hour => here we could support two behaviours:

a) smooth out rate limit behaviour continuously throughout the hour
b) allow burst then deny further messages (add to buffer) once hourly limit reached, lift limit every hour

Which one of these do we want? (I'll wait for your answer before I add further rate limit tests. Note that for choice a, we're in trouble as I'd likely need to add tests that run for say a few seconds.)

4) I'm yet to fix issue #346 . Can you please confirm behaviour?

When finished, I'm squashing commits.

Thanks,

Zoltan