forked from phobos182/collectd-elasticsearch
-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fixed logic for removing deprecated metrics * string to int for version numbers * added unit test * add dependency * added dependency * added dependency * fixed test errors * mocked module collectd * fixed docker build error * edited README file * halting execution on unit test failure * halting execution on unit test failure * halting execution on unit test failure * halting execution on unit test failure * halting execution on unit test failure * halting execution on unit test failure * halting execution on unit test failure * halting execution on unit test failure
- Loading branch information
1 parent
9caaa5e
commit c11d5c0
Showing
7 changed files
with
52 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
.idea/ | ||
*.tmp | ||
*.tmp | ||
.Python | ||
bin/ | ||
include/ | ||
lib/ | ||
__pycache__/ |
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 |
---|---|---|
|
@@ -4,5 +4,6 @@ python: | |
- "2.7" | ||
install: | ||
pip install flake8 | ||
pip install pytest | ||
before_script: | ||
flake8 *.py |
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,30 @@ | ||
import sys | ||
|
||
import mock | ||
import pytest | ||
|
||
|
||
class MockCollectd(mock.MagicMock): | ||
pass | ||
|
||
|
||
sys.modules['collectd'] = MockCollectd() | ||
|
||
|
||
from elasticsearch_collectd import remove_deprecated_elements | ||
|
||
|
||
@pytest.mark.parametrize("deprecated_elements, input_elements, version, expected_elements", [ | ||
( | ||
[{'major': 1, 'minor': 3, 'revision': 100, 'keys': ['element1', 'element3']}], | ||
['element2', 'element3'], | ||
'1.03.00104', | ||
['element2'] | ||
) | ||
]) | ||
def test_remove_deprecated_elements(deprecated_elements, input_elements, version, expected_elements): | ||
print deprecated_elements, input_elements, version, expected_elements | ||
elements = remove_deprecated_elements(deprecated_elements, input_elements, version) | ||
assert len(elements) == len(expected_elements) | ||
for i in range(len(elements)): | ||
assert elements[i] == expected_elements[i] |
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