-
Notifications
You must be signed in to change notification settings - Fork 240
pkg/term, pkg/utils: Stop the test functions if they fail their set-up #1727
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pkg/term, pkg/utils: Stop the test functions if they fail their set-up #1727
Conversation
Currently, if for some reason the set-up steps of a test fails, like
opening /dev/ptmx, the test continues to run and encounters subsequent
failures:
--- FAIL: TestIsTerminalTerminal (0.00s)
term_test.go:41:
Error Trace: toolbox/src/pkg/term/term_test.go:41
Error: Received unexpected error:
open /dev/ptmx: not a directory
Test: TestIsTerminalTerminal
term_test.go:45:
Error Trace: toolbox/src/pkg/term/term_test.go:45
Error: Should be true
Test: TestIsTerminalTerminal
FAIL
FAIL github.com/containers/toolbox/pkg/term 0.004s
The tests are only meaningful if the set-up succeeds, and continuing in
the case of a failure only leads to noise. Therefore, stop executing
the tests if they fail their set-up.
This changes the previous failure to:
--- FAIL: TestIsTerminalTerminal (0.00s)
term_test.go:42:
Error Trace: toolbox/src/pkg/term/term_test.go:42
Error: Received unexpected error:
open /dev/ptmx: not a directory
Test: TestIsTerminalTerminal
FAIL
FAIL github.com/containers/toolbox/pkg/term 0.003s
Fallout from 3d54993 and
aca4e9d
containers#1727
b71accf to
d1c8762
Compare
A subsequent commit will ensure that the test functions are stopped if they fail their set-up. This means that tests that don't share the same set-up shouldn't be in the same test function. Otherwise, a failure in one test's set-up will prevent the remaining tests that don't need the failed set-up from running. containers#1727
d1c8762 to
39673da
Compare
|
Build succeeded. ✔️ unit-test SUCCESS in 2m 15s |
A subsequent commit will ensure that the test functions are stopped if they fail their set-up. This means that tests that don't share the same set-up shouldn't be in the same test function. Otherwise, a failure in one test's set-up will prevent the remaining tests that don't need the failed set-up from running. containers#1727
Currently, if for some reason the set-up steps of a test function fails,
like opening /dev/ptmx, it continues to run and encounters subsequent
failures:
--- FAIL: TestIsTerminalTerminal (0.00s)
term_test.go:41:
Error Trace: toolbox/src/pkg/term/term_test.go:41
Error: Received unexpected error:
open /dev/ptmx: not a directory
Test: TestIsTerminalTerminal
term_test.go:45:
Error Trace: toolbox/src/pkg/term/term_test.go:45
Error: Should be true
Test: TestIsTerminalTerminal
FAIL
FAIL github.com/containers/toolbox/pkg/term 0.004s
The test functions are only meaningful if the set-up succeeds, and
continuing in the case of a failure only leads to noise. Therefore,
stop executing them if they fail their set-up.
This changes the previous failure to:
--- FAIL: TestIsTerminalTerminal (0.00s)
term_test.go:42:
Error Trace: toolbox/src/pkg/term/term_test.go:42
Error: Received unexpected error:
open /dev/ptmx: not a directory
Test: TestIsTerminalTerminal
FAIL
FAIL github.com/containers/toolbox/pkg/term 0.003s
Fallout from the following:
* 3d54993
* aca4e9d
* e9e77fb
containers#1727
39673da to
59c96c3
Compare
|
Build succeeded. ✔️ unit-test SUCCESS in 2m 09s |
|
Build succeeded. ✔️ unit-test SUCCESS in 2m 16s |
Currently, if for some reason the set-up steps of a test function fails,
like opening
/dev/ptmx, it continues to run and encounters subsequentfailures:
The test functions are only meaningful if the set-up succeeds, and
continuing in the case of a failure only leads to noise. Therefore,
stop executing them if they fail their set-up.
This changes the previous failure to:
Fallout from the following: