-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Test command #4590
Test command #4590
Conversation
930f275
to
9e5cbfe
Compare
3f56e23
to
d145d1a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. The color is nice touch. Look forward to trying this out.
libbeat/tests/system/test_cmd.py
Outdated
|
||
assert exit_code == 1 | ||
assert self.log_contains('parse url... OK') | ||
assert self.log_contains('dns lookup... ERROR lookup badhost: no such host') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would be careful with matching the specific error message coming from the stdlib or the OS. This has bit me a few times when running my tests on different OSes and Golang versions.
elasticsearch: http://badhost:9200...
parse url... OK
connection...
parse host... OK
dns lookup... ERROR lookup badhost on 127.0.0.11:53: no such host
======================================================================
FAIL: Test test wrong output works
----------------------------------------------------------------------
Traceback (most recent call last):
File "/go/src/github.com/elastic/beats/libbeat/tests/system/test_cmd.py", line 169, in test_test_wrong_output
assert self.log_contains('dns lookup... ERROR lookup badhost: no such host')
jenkins retest this please |
thanks for the review, btw I had a pending check that color works on Mac, I guess you just confirmed it? |
Yeah, the color works in Terminal on macOS. |
This PR adds a self-testing framework, different parts of beats can implement
Testable
interface to allow the user to test her settings.Current features:
example ERROR:
example OK:
TODO: