backup-utils icon indicating copy to clipboard operation
backup-utils copied to clipboard

Tests hang when run individually due to odd test stubs and stdin differences

Open zarenner opened this issue 4 years ago • 1 comments

I noticed while working on tests that you cannot run e.g. test/test-ghe-restore.sh manually. At some point the test run will hang forever, and if you look at running processes you'll see a test stub e.g. ghe-nomad-cleanup is stuck.

The reason is that some test stubs wait for stdin (i.e. with the cat command), yet those commands will never receive any input: https://github.com/github/backup-utils/blob/e9f6218947db9cd6e59a6c69d3c56072afb78f8b/test/bin/ghe-nomad-cleanup#L1-L5

Why is this not an issue when run tests through the cibuild script? It's because we invoke them using xargs, which by default sets stdin to /dev/null (unless -o/--open-tty is set), and thus cat immediately exits and the test stubs work correctly. https://github.com/github/backup-utils/blob/e9f6218947db9cd6e59a6c69d3c56072afb78f8b/script/cibuild#L8

@jianghao0718 is there any reason this might be unintentional, or should we fix the test stubs?

zarenner avatar Dec 28 '21 18:12 zarenner

@zarenner - I think this is unintentional. We rarely run those tests manually and this is a bug. Thanks for reporting!

jianghao0718 avatar Jan 14 '22 22:01 jianghao0718