Draft/Feature/memory statistics/show commands #3629
Draft
Azure Pipelines / Azure.sonic-utilities
failed
Dec 10, 2024 in 25m 49s
Build #20241210.18 had test failures
Details
- Failed: 2 (0.06%)
- Passed: 3,309 (99.85%)
- Other: 3 (0.09%)
- Total: 3,314
Annotations
Check failure on line 6818 in Build log
azure-pipelines / Azure.sonic-utilities
Build log #L6818
Bash exited with code '1'.
Check failure on line 22 in Build log
azure-pipelines / Azure.sonic-utilities
Build log #L22
There are one or more test failures detected in result files. Detailed summary of published test results can be viewed in the Tests tab.
Check failure on line 1 in test_send_data_no_response
azure-pipelines / Azure.sonic-utilities
test_send_data_no_response
show.memory_statistics.ConnectionError: No response received from memory statistics service
Raw output
self = <tests.memory_statistics_test.TestSendData testMethod=test_send_data_no_response>
mock_socket_manager = <MagicMock name='SocketManager' id='139839656347856'>
@patch('show.memory_statistics.SocketManager')
def test_send_data_no_response(self, mock_socket_manager):
"""Test no response received from the server."""
# Mock the SocketManager instance
mock_socket = MagicMock()
mock_socket_manager.return_value = mock_socket
# Simulate no response from the server
mock_socket.receive_all.return_value = ""
# Ensure a ConnectionError is raised with the expected message
with self.assertRaises(ConnectionError) as context:
> send_data("test_command", {"key": "value"})
tests/memory_statistics_test.py:327:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
def send_data(command: str, data: Dict[str, Any], quiet: bool = False) -> Dict2Obj:
"""Sends a command and data to the memory statistics service."""
socket_manager = SocketManager()
try:
socket_manager.connect()
request = {"command": command, "data": data}
socket_manager.sock.sendall(json.dumps(request).encode('utf-8'))
response = socket_manager.receive_all()
if not response:
> raise ConnectionError("No response received from memory statistics service")
E show.memory_statistics.ConnectionError: No response received from memory statistics service
show/memory_statistics.py:243: ConnectionError
Check failure on line 1 in test_send_data_quiet_mode
azure-pipelines / Azure.sonic-utilities
test_send_data_quiet_mode
show.memory_statistics.ConnectionError: No response received from memory statistics service
Raw output
self = <tests.memory_statistics_test.TestSendData testMethod=test_send_data_quiet_mode>
mock_click_echo = <MagicMock name='echo' id='139839508027664'>
mock_socket_manager = <MagicMock name='SocketManager' id='139839512241040'>
@patch('show.memory_statistics.SocketManager')
@patch('click.echo')
def test_send_data_quiet_mode(self, mock_click_echo, mock_socket_manager):
"""Test send_data in quiet mode, ensuring no output on error."""
mock_socket = MagicMock()
mock_socket_manager.return_value = mock_socket
mock_socket.receive_all.return_value = ""
with self.assertRaises(ConnectionError):
> send_data("test_command", {"key": "value"}, quiet=True)
tests/memory_statistics_test.py:377:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
def send_data(command: str, data: Dict[str, Any], quiet: bool = False) -> Dict2Obj:
"""Sends a command and data to the memory statistics service."""
socket_manager = SocketManager()
try:
socket_manager.connect()
request = {"command": command, "data": data}
socket_manager.sock.sendall(json.dumps(request).encode('utf-8'))
response = socket_manager.receive_all()
if not response:
> raise ConnectionError("No response received from memory statistics service")
E show.memory_statistics.ConnectionError: No response received from memory statistics service
show/memory_statistics.py:243: ConnectionError
Loading