diff --git a/changelog/65752.fixed.md b/changelog/65752.fixed.md new file mode 100644 index 000000000000..f611c5e65ec8 --- /dev/null +++ b/changelog/65752.fixed.md @@ -0,0 +1 @@ +Fix nonsensical time in fileclient timeout error. diff --git a/salt/fileclient.py b/salt/fileclient.py index 443861cc03fd..321f41996ab8 100644 --- a/salt/fileclient.py +++ b/salt/fileclient.py @@ -1157,7 +1157,7 @@ def _channel_send(self, load, raw=False): ) except salt.exceptions.SaltReqTimeoutError: raise SaltClientError( - f"File client timed out after {int(time.time() - start)}" + f"File client timed out after {int(time.monotonic() - start)}" ) def destroy(self): diff --git a/tests/pytests/unit/fileclient/test_fileclient.py b/tests/pytests/unit/fileclient/test_fileclient.py index 0e072e5c36f4..f5cfce92eeca 100644 --- a/tests/pytests/unit/fileclient/test_fileclient.py +++ b/tests/pytests/unit/fileclient/test_fileclient.py @@ -126,7 +126,8 @@ def mock_dumps(*args): # Crypticle must return bytes to pass to transport.RequestClient.send client.auth._crypticle = Mock() client.auth._crypticle.dumps = mock_dumps - with pytest.raises(salt.exceptions.SaltClientError): + msg = r"^File client timed out after \d{1,4}$" + with pytest.raises(salt.exceptions.SaltClientError, match=msg): client.file_list()