|
32 | 32 | from nodescraper.enums.systeminteraction import SystemInteractionLevel |
33 | 33 | from nodescraper.interfaces.task import SystemCompatibilityError |
34 | 34 | from nodescraper.models.systeminfo import OSFamily |
| 35 | +from nodescraper.plugins.inband.dmesg.collector_args import DmesgCollectorArgs |
35 | 36 | from nodescraper.plugins.inband.dmesg.dmesg_collector import DmesgCollector |
36 | 37 | from nodescraper.plugins.inband.dmesg.dmesgdata import DmesgData |
37 | 38 |
|
@@ -276,3 +277,27 @@ def run_map(cmd, **kwargs): |
276 | 277 |
|
277 | 278 | assert isinstance(data, DmesgData) |
278 | 279 | assert data.dmesg_content == "DMESG OUTPUT\n" |
| 280 | + |
| 281 | + |
| 282 | +def test_collect_data_with_args(conn_mock, system_info): |
| 283 | + """Test collect_data accepts DmesgCollectorArgs""" |
| 284 | + dmesg = "2023-06-01T01:00:00,685236-05:00 test message1\n" |
| 285 | + conn_mock.run_command.return_value = CommandArtifact( |
| 286 | + exit_code=0, |
| 287 | + stdout=dmesg, |
| 288 | + stderr="", |
| 289 | + command="dmesg --time-format iso", |
| 290 | + ) |
| 291 | + |
| 292 | + collector = DmesgCollector( |
| 293 | + system_info=system_info, |
| 294 | + system_interaction_level=SystemInteractionLevel.INTERACTIVE, |
| 295 | + connection=conn_mock, |
| 296 | + ) |
| 297 | + |
| 298 | + args = DmesgCollectorArgs(collect_dmesg_log=False) |
| 299 | + res, data = collector.collect_data(args=args) |
| 300 | + |
| 301 | + assert res.status == ExecutionStatus.OK |
| 302 | + assert data is not None |
| 303 | + assert data.dmesg_content == dmesg |
0 commit comments