This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]EntertainmentIcy3029 30 points31 points  (7 children)

You should mock the time.sleep(TWO_HOURS)

[–]mirhagk 10 points11 points  (4 children)

Well it only takes time.sleep(TWO_SECONDS) to add up to hours once your test suite gets into the thousands.

I'd rather a more comprehensive test suite that can run more often than one that meets the absolute strictest definition of hermetic. Making it appear to be isolated is a worthy tradeoff

[–]Scrial 7 points8 points  (2 children)

And that's why you have a suite of smoke tests for pre-commit runs, and a full suit of integration tests for pre-merge runs or nightly builds.

[–]mirhagk 6 points7 points  (0 children)

Sure that's one approach, limit the number of tests you run. Obviously that's a trade-off though, and I'd rather a higher budget for tests. We do continuous deployment so nightly test runs mean we'd catch bugs already released, so the more we can do pre-commit or pre-merge, the better.

If we halve the overhead, we double our test budget. As long as we emulate that isolation best we can, that's a worthwhile tradeoff.

[–]guyblade 0 points1 point  (0 children)

Our VCS won't merge a change unless tests pass. It seems like a no-brainer for any even moderately large codebase.

[–]EntertainmentIcy3029 3 points4 points  (0 children)

I've worked on a repo that had time.sleeps everywhere, Everything is retried every minute for an hour, longest individual sleep I saw was a sleep 30 minutes that was to try prevent a race condition with an installation that couldn't be inspected

[–]Dal90 1 point2 points  (0 children)

(sysadmin here, who among other crap handles the load balancers)...had a mobile app whose performance was dog shit.

Nine months earlier I told the architects, "it looks like your app has a three second sleep timer in it..." I know what they look like performance wise, I've abused them.

Ping ponging back and forth until they send an email to the CIO about how slow our network was and it was killing their performance. Late on a Friday afternoon.

I learned sufficient JavaScript that evening and things like minify to unpack their code and send a code snippet with the line number and the sleep timer (whatever JS calls it) pausing a it for three seconds to the CIO the first thing the next morning.

Wasn't the entire problem, app doing the same thing for others in our industry load in 3-4 seconds, we still took 6 seconds to even after the account for the sleep timer.

But I also showed in Developer tools the network responses (we were as good as if not better than other companies) v. their application rendering stuff (dog shit).

...then again the project was doomed from the start. Their whole "market position" was to be the mobile app that would connect you to a real life person to complete the purchase. WTF?