Skip to content

Commit

Permalink
Fix nonsensical in fileclient timeout error message
Browse files Browse the repository at this point in the history
  • Loading branch information
dwoz committed Dec 27, 2023
1 parent 1561671 commit dc1c8b5
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions changelog/65752.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix nonsensical time in fileclient timeout error.
2 changes: 1 addition & 1 deletion salt/fileclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
3 changes: 2 additions & 1 deletion tests/pytests/unit/fileclient/test_fileclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()


Expand Down

0 comments on commit dc1c8b5

Please sign in to comment.