Skip to content
This repository has been archived by the owner on Jan 3, 2025. It is now read-only.

Run the test's heartbeat whenever the process emits output #17

Merged
merged 1 commit into from
Jan 14, 2020
Merged

Conversation

nex3
Copy link
Member

@nex3 nex3 commented Jan 14, 2020

No description provided.

@nex3 nex3 requested a review from grouma January 14, 2020 01:42
@nex3 nex3 merged commit 62e7aae into master Jan 14, 2020
@nex3 nex3 deleted the heartbeat branch January 14, 2020 18:47
@natebosch
Copy link
Member

This makes it hard to time out tests at all that run processes with continuous output.

What was the motivation for this change?

@nex3
Copy link
Member Author

nex3 commented Mar 20, 2020

Why would you want a process that runs a process that's continuously doing stuff to time out?

Timeouts are mostly useful for catching deadlocks, where the test is waiting on some future or stream to complete but no actual code is being executed. You don't want a test to time out if it's actually doing something—that's why it has a heartbeat, because as long as code is interacting with the test framework the framework can be confident that it's not deadlocked.

For processes, this often comes up in integration tests, where a process might be performing a series of steps or making a network request. Waiting for the entire process to complete can tickle timeouts (especially on slow systems like Travis CI's windows bots), even when the process in question is happily making progress. Triggering a heartbeat when it prints output solves that.

@natebosch
Copy link
Member

Why would you want a process that runs a process that's continuously doing stuff to time out?

All test infrastructure will time out at some point - we have better output when the test runner can time it out than Travis.

A busy loop that also prints is not less of a problem than a busy loop which doesn't print.

@nex3
Copy link
Member Author

nex3 commented Mar 20, 2020

Most of the time, a process that's continually printing output will be doing real work—just like most of the time, a test that's continuously calling expectAsync() will be doing real work. It's certainly possible to create infinite loops that violate this, just like it's possible to write an infinite synchronous loop that will also fail to time out, but you've got to strike a balance between gracefully handling edge-case failures and making the framework usable for more common cases.

Maybe it makes sense to have two tiers of timeout—one that respects the heartbeat, and one that's much longer but doesn't?

@natebosch
Copy link
Member

Maybe it makes sense to have two tiers of timeout—one that respects the heartbeat, and one that's much longer but doesn't?

That is likely.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants