termtest icon indicating copy to clipboard operation
termtest copied to clipboard

Test output expectations should fail if the process has prematurely exited.

Open mitchell-as opened this issue 1 year ago • 1 comments

The idea is to call exec.Cmd.Wait() in a goroutine (https://github.com/ActiveState/termtest/pull/12/files#diff-13ff3d9e77d1ebdf70d066552cb9e504472550dc97fd74aac53a8ab3a63e54a1) and edit the Expect() functions (https://github.com/ActiveState/termtest/pull/12/files#diff-a63ecf8315eeb0943ebec69499243bd650ae6b99635bde7aa1c0f6ac773368c2R106-R111 and https://github.com/ActiveState/termtest/pull/12/files#diff-2a74ac0f372490e4a5cf19a11e38b9329713643dc44c65ca5f7de285f84c9391R183-R187) to poll for a command's exit status alongside the usual expect checks. A helper function that returns a channel is used to facilitate use inside select{} statements (https://github.com/ActiveState/termtest/pull/12/files#diff-296a01a801f363652ec765418086e861f5db0287df573d54c8fde4eebe0e26e9R43).

https://github.com/ActiveState/cli/pull/3309 uses this PR's commit when running integration tests for State Tool to verify that it doesn't break anything at least.

mitchell-as avatar May 16 '24 19:05 mitchell-as

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar May 16 '24 19:05 CLAassistant

I'm flagging for re-review just to get feedback on my replies. I'll make the requested changes tomorrow and then submit for another review. Thanks for your understanding.

mitchell-as avatar May 21 '24 17:05 mitchell-as