-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
System test cleanup for metricbeat. (#1398)
- Fix misspelled redis-info.persistence key name. - Added an 'integration' attribute to metricbeat system tests that require extra services like Redis. - Documented metricset-host in fields.yml (many more to document). - Change instantaneous_input_kbps and instantaneous_output_kbps to floats from ints. There was an error in the log that indicated the problem. The test has been updated to check for ERR and WARN.
- Loading branch information
1 parent
ba2433c
commit 2074dbe
Showing
16 changed files
with
171 additions
and
131 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import sys | ||
|
||
sys.path.append('../../../libbeat/tests/system') | ||
from beat.beat import TestCase | ||
|
||
COMMON_FIELDS = ["@timestamp", "beat", "metricset", "metricset-host", | ||
"module", "rtt", "type"] | ||
|
||
|
||
class BaseTest(TestCase): | ||
@classmethod | ||
def setUpClass(self): | ||
self.beat_name = "metricbeat" | ||
self.build_path = "../../build/system-tests/" | ||
self.beat_path = "../../metricbeat.test" | ||
|
||
def assert_fields_are_documented(self, evt): | ||
""" | ||
Assert that all keys present in evt are documented in fields.yml. | ||
""" | ||
expected_fields, _ = self.load_fields() | ||
flat = self.flatten_object(evt, []) | ||
|
||
for key in flat.keys(): | ||
if key not in expected_fields: | ||
raise Exception("Key '{}' found in event is not documented!".format(key)) |
Empty file.
This file was deleted.
Oops, something went wrong.
Empty file.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,24 @@ | ||
from metricbeat.metricbeat import BaseTest | ||
import re | ||
from metricbeat import BaseTest | ||
|
||
class Test(BaseTest): | ||
|
||
def test_base(self): | ||
class Test(BaseTest): | ||
def test_start_stop(self): | ||
""" | ||
Basic test with exiting Mockbeat normally | ||
Metricbeat starts and stops without error. | ||
""" | ||
self.render_config_template( | ||
) | ||
|
||
self.render_config_template() | ||
proc = self.start_beat() | ||
self.wait_until( lambda: self.log_contains("Setup Beat")) | ||
exit_code = proc.kill_and_wait() | ||
assert exit_code == 0 | ||
self.wait_until(lambda: self.log_contains("Setup Beat")) | ||
proc.check_kill_and_wait() | ||
|
||
# Ensure no errors or warnings exist in the log. | ||
log = self.get_log() | ||
self.assertNotRegexpMatches(log, "ERR|WARN") | ||
|
||
# Ensure all Beater stages are used. | ||
self.assertRegexpMatches(log, re.compile(".*".join([ | ||
"Setup Beat: metricbeat", | ||
"metricbeat start running", | ||
"metricbeat cleanup" | ||
]), re.DOTALL)) |
Oops, something went wrong.