From 6f5c0ac2e7330ee172743e607d1dbb8bc5c82255 Mon Sep 17 00:00:00 2001 From: "Daniel A. Wozniak" Date: Thu, 28 Dec 2023 11:51:48 -0700 Subject: [PATCH] Revert test changes and fix original tests --- salt/client/ssh/wrapper/__init__.py | 3 --- tests/filename_map.yml | 14 ++++++++++++++ .../pytests/integration/netapi/test_ssh_client.py | 9 ++++----- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/salt/client/ssh/wrapper/__init__.py b/salt/client/ssh/wrapper/__init__.py index 5cd337069ca4..0c6bc32d3849 100644 --- a/salt/client/ssh/wrapper/__init__.py +++ b/salt/client/ssh/wrapper/__init__.py @@ -85,9 +85,6 @@ def to_ret(self): if self.parsed and "local" in self.parsed: # Wrapped commands that indicate a non-zero retcode return self.parsed["local"] - elif self.stderr: - # Remote executions that indicate a non-zero retcode - return self.stderr return super().to_ret() def __str__(self): diff --git a/tests/filename_map.yml b/tests/filename_map.yml index ded66d324101..1c2c99398f87 100644 --- a/tests/filename_map.yml +++ b/tests/filename_map.yml @@ -204,6 +204,19 @@ salt/(client/ssh/.+|cli/ssh\.py): - pytests.integration.ssh.test_raw - integration.ssh.test_state - pytests.integration.ssh.test_py_versions + - pytests.integration.netapi.test_ssh_client + +salt/client/ssh/wrapper/*: + - pytests.integration.ssh.test_deploy + - pytests.integration.ssh.test_grains + - pytests.integration.ssh.test_mine + - pytests.integration.ssh.test_master + - pytests.integration.ssh.test_jinja_filters + - pytests.integration.ssh.test_pillar + - pytests.integration.ssh.test_raw + - integration.ssh.test_state + - pytests.integration.ssh.test_py_versions + - pytests.integration.netapi.test_ssh_client salt/config/*: - unit.test_config @@ -309,6 +322,7 @@ salt/utils/vt.py: - pytests.integration.ssh.test_pillar - pytests.integration.ssh.test_raw - integration.ssh.test_state + - pytests.integration.netapi.test_ssh_client salt/wheel/*: - pytests.integration.wheel.test_client diff --git a/tests/pytests/integration/netapi/test_ssh_client.py b/tests/pytests/integration/netapi/test_ssh_client.py index 7b32ee83d618..c2e948baf7a5 100644 --- a/tests/pytests/integration/netapi/test_ssh_client.py +++ b/tests/pytests/integration/netapi/test_ssh_client.py @@ -161,7 +161,8 @@ def test_shell_inject_ssh_priv( if ret: break assert path.exists() is False - assert "Network is unreachable" in ret[tgt] + assert not ret[tgt]["stdout"] + assert ret[tgt]["stderr"] def test_shell_inject_tgt(client, salt_ssh_roster_file, tmp_path, salt_auto_account): @@ -211,10 +212,8 @@ def test_shell_inject_ssh_options( } ret = client.run(low) assert path.exists() is False - assert ( - "Bad configuration option" in ret["127.0.0.1"] - or "no argument after keyword" in ret["127.0.0.1"] - ) + assert not ret["127.0.0.1"]["stdout"] + assert ret["127.0.0.1"]["stderr"] def test_shell_inject_ssh_port(