Skip to content

Commit

Permalink
Revert test changes and fix original tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dwoz committed Dec 28, 2023
1 parent 6e13516 commit 6f5c0ac
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 8 deletions.
3 changes: 0 additions & 3 deletions salt/client/ssh/wrapper/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
14 changes: 14 additions & 0 deletions tests/filename_map.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
9 changes: 4 additions & 5 deletions tests/pytests/integration/netapi/test_ssh_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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(
Expand Down

0 comments on commit 6f5c0ac

Please sign in to comment.