-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
14aeb94
commit 07d3343
Showing
5 changed files
with
68 additions
and
6 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
Empty file.
30 changes: 30 additions & 0 deletions
30
plugins/ufm_log_analyzer_plugin/unit_tests/test_ibdiagnet_log_analyzer.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import unittest | ||
import sys | ||
import os | ||
|
||
sys.path.append(os.getcwd()) | ||
sys.path.append("/".join(os.getcwd().split("/")[:-1])) | ||
sys.path.append("/".join(os.getcwd().split("/")[:-1]) + "/src") | ||
|
||
from loganalyze.log_analyzers.ibdiagnet_log_analyzer import IBDIAGNETLogAnalyzer | ||
|
||
|
||
class TestIBDIAGNETLogAnalyzer(unittest.TestCase): | ||
def setUp(self): | ||
# Example initialization with dummy arguments | ||
self.logs_csvs = [] | ||
self.hours = 24 | ||
self.dest_image_path = "/dummy/path" | ||
self.analyzer = IBDIAGNETLogAnalyzer(self.logs_csvs, self.hours, self.dest_image_path) | ||
|
||
def test_get_fabric_size(self): | ||
# Mock the _log_data_sorted attribute | ||
expected_fabric_size = {"switch_count": 10, "link_count": 50} # Example data | ||
self.analyzer._log_data_sorted = expected_fabric_size # pylint: disable=protected-access | ||
|
||
# Call the method and check the result | ||
result = self.analyzer.get_fabric_size() | ||
self.assertEqual(result, expected_fabric_size) | ||
|
||
if __name__ == "__main__": | ||
unittest.main() |
5 changes: 0 additions & 5 deletions
5
plugins/ufm_log_analyzer_plugin/unit_tests/test_log_analyzer.py
This file was deleted.
Oops, something went wrong.
33 changes: 33 additions & 0 deletions
33
plugins/ufm_log_analyzer_plugin/unit_tests/test_ufm_top_analyzer.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import unittest | ||
import sys | ||
import os | ||
|
||
sys.path.append(os.getcwd()) | ||
sys.path.append("/".join(os.getcwd().split("/")[:-1])) | ||
sys.path.append("/".join(os.getcwd().split("/")[:-1]) + "/src") | ||
|
||
from loganalyze.log_analyzers.ufm_top_analyzer import UFMTopAnalyzer | ||
|
||
class TestUFMTopAnalyzer(unittest.TestCase): | ||
def setUp(self): | ||
self.analyzer = UFMTopAnalyzer() | ||
|
||
def test_add_analyzer(self): | ||
mock_analyzer_1 = "Analyzer1" | ||
mock_analyzer_2 = "Analyzer2" | ||
|
||
# Initially, the list should be empty | ||
self.assertEqual(len(self.analyzer._analyzers), 0) # pylint: disable=protected-access | ||
|
||
# Add first analyzer and check the length | ||
self.analyzer.add_analyzer(mock_analyzer_1) | ||
self.assertEqual(len(self.analyzer._analyzers), 1) # pylint: disable=protected-access | ||
self.assertIn(mock_analyzer_1, self.analyzer._analyzers) # pylint: disable=protected-access | ||
|
||
# Add second analyzer and check the updated length | ||
self.analyzer.add_analyzer(mock_analyzer_2) | ||
self.assertEqual(len(self.analyzer._analyzers), 2) # pylint: disable=protected-access | ||
self.assertIn(mock_analyzer_2, self.analyzer._analyzers) # pylint: disable=protected-access | ||
|
||
if __name__ == "__main__": | ||
unittest.main() |