Some tests just need to get hosts ignored forced

This commit is contained in:
Pedro Algarvio 2024-04-04 09:50:21 +01:00
parent 20f4966ca0
commit 819270445b
4 changed files with 8 additions and 7 deletions

View file

@ -245,6 +245,7 @@ def test_shell_inject_ssh_port(
"roster_file": str(salt_ssh_roster_file),
"rosters": "/",
"ssh_port": f"hhhhh|id>{path} #",
"ignore_host_keys": True,
}
ret = client.run(low)
assert path.exists() is False
@ -272,6 +273,7 @@ def test_shell_inject_remote_port_forwards(
"eauth": "auto",
"username": salt_auto_account.username,
"password": salt_auto_account.password,
"ignore_host_keys": True,
}
ret = client.run(low)
assert path.exists() is False

View file

@ -102,6 +102,7 @@ def salt_ssh_cli(salt_master, salt_ssh_roster_file, ssh_keys, ssh_docker_contain
roster_file=salt_ssh_roster_file,
target_host="localhost",
ssh_user="app-admin",
base_script_args=["--ignore-host-keys"],
)

View file

@ -113,6 +113,7 @@ def salt_ssh_cli(salt_master, salt_ssh_roster_file, ssh_keys, ssh_docker_contain
roster_file=salt_ssh_roster_file,
target_host="localhost",
client_key=str(ssh_keys.priv_path),
base_script_args=["--ignore-host-keys"],
)

View file

@ -17,7 +17,7 @@ def minion_id():
@pytest.fixture(scope="module")
def terraform_roster_file(sshd_server, tmp_path_factory, minion_id, known_hosts_file):
def terraform_roster_file(sshd_server, salt_master, tmp_path_factory, minion_id):
darwin_addon = ""
if salt.utils.platform.is_darwin():
darwin_addon = ',\n "set_path": "$PATH:/usr/local/bin/"\n'
@ -49,10 +49,7 @@ def terraform_roster_file(sshd_server, tmp_path_factory, minion_id, known_hosts_
"thin_dir": null,
"timeout": null,
"tty": null,
"user": "{user}"{darwin_addon},
"ssh_options": [
"UserKnownHostsFile={known_hosts_file}"
]
"user": "{user}"{darwin_addon}
}}
}}
]
@ -66,7 +63,6 @@ def terraform_roster_file(sshd_server, tmp_path_factory, minion_id, known_hosts_
port=sshd_server.listen_port,
user=RUNTIME_VARS.RUNNING_TESTS_USER,
darwin_addon=darwin_addon,
known_hosts_file=known_hosts_file,
)
roster_file = tmp_path_factory.mktemp("terraform_roster") / "terraform.tfstate"
roster_file.write_text(roster_contents)
@ -75,7 +71,7 @@ def terraform_roster_file(sshd_server, tmp_path_factory, minion_id, known_hosts_
@pytest.fixture(scope="module")
def salt_ssh_cli(salt_master, terraform_roster_file, sshd_config_dir, known_hosts_file):
def salt_ssh_cli(salt_master, terraform_roster_file, sshd_config_dir):
"""
The ``salt-ssh`` CLI as a fixture against the running master
"""
@ -84,6 +80,7 @@ def salt_ssh_cli(salt_master, terraform_roster_file, sshd_config_dir, known_host
roster_file=terraform_roster_file,
target_host="*",
client_key=str(sshd_config_dir / "client_key"),
base_script_args=["--ignore-host-keys"],
)