From abe92390c36d6afbe377a2f7c718718e47326e7a Mon Sep 17 00:00:00 2001 From: "Daniel A. Wozniak" Date: Wed, 27 Dec 2023 11:15:09 -0700 Subject: [PATCH] Fix nonsensical in fileclient timeout error message --- changelog/65752.fixed.md | 1 + salt/fileclient.py | 2 +- tests/pytests/unit/fileclient/test_fileclient.py | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) create mode 100644 changelog/65752.fixed.md diff --git a/changelog/65752.fixed.md b/changelog/65752.fixed.md new file mode 100644 index 00000000000..f611c5e65ec --- /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 443861cc03f..321f41996ab 100644 --- a/salt/fileclient.py +++ b/salt/fileclient.py @@ -1157,7 +1157,7 @@ class RemoteClient(Client): ) 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 0e072e5c36f..f5cfce92eec 100644 --- a/tests/pytests/unit/fileclient/test_fileclient.py +++ b/tests/pytests/unit/fileclient/test_fileclient.py @@ -126,7 +126,8 @@ def test_fileclient_timeout(minion_opts, master_opts): # 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()