mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
Migrate tests/integration/ssh/test_mine.py
to pytest
Signed-off-by: Pedro Algarvio <palgarvio@vmware.com>
This commit is contained in:
parent
8ca6bb29f7
commit
5160ea4284
3 changed files with 33 additions and 34 deletions
|
@ -197,8 +197,7 @@ salt/(client/ssh/.+|cli/ssh\.py):
|
|||
- integration.ssh.test_deploy
|
||||
- pytests.integration.ssh.test_grains
|
||||
- integration.ssh.test_jinja_filters
|
||||
- integration.ssh.test_master
|
||||
- integration.ssh.test_mine
|
||||
- pytests.integration.ssh.test_mine
|
||||
- pytests.integration.ssh.test_pillar
|
||||
- pytests.integration.ssh.test_raw
|
||||
- integration.ssh.test_state
|
||||
|
@ -304,7 +303,7 @@ salt/utils/vt.py:
|
|||
- integration.cli.test_custom_module
|
||||
- pytests.integration.ssh.test_grains
|
||||
- integration.ssh.test_jinja_filters
|
||||
- integration.ssh.test_mine
|
||||
- pytests.integration.ssh.test_mine
|
||||
- pytests.integration.ssh.test_pillar
|
||||
- pytests.integration.ssh.test_raw
|
||||
- integration.ssh.test_state
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
import os
|
||||
import shutil
|
||||
|
||||
import pytest
|
||||
|
||||
import salt.utils.platform
|
||||
from tests.support.case import SSHCase
|
||||
from tests.support.unit import skipIf
|
||||
|
||||
|
||||
@skipIf(salt.utils.platform.is_windows(), "salt-ssh not available on Windows")
|
||||
class SSHMineTest(SSHCase):
|
||||
"""
|
||||
testing salt-ssh with mine
|
||||
"""
|
||||
|
||||
@pytest.mark.slow_test
|
||||
def test_ssh_mine_get(self):
|
||||
"""
|
||||
test salt-ssh with mine
|
||||
"""
|
||||
ret = self.run_function("mine.get", ["localhost test.arg"], wipe=False)
|
||||
self.assertEqual(ret["localhost"]["args"], ["itworked"])
|
||||
|
||||
def tearDown(self):
|
||||
"""
|
||||
make sure to clean up any old ssh directories
|
||||
"""
|
||||
salt_dir = self.run_function("config.get", ["thin_dir"], wipe=False)
|
||||
if os.path.exists(salt_dir):
|
||||
shutil.rmtree(salt_dir)
|
31
tests/pytests/integration/ssh/test_mine.py
Normal file
31
tests/pytests/integration/ssh/test_mine.py
Normal file
|
@ -0,0 +1,31 @@
|
|||
import shutil
|
||||
|
||||
import pytest
|
||||
|
||||
pytestmark = [
|
||||
pytest.mark.slow_test,
|
||||
pytest.mark.skip_on_windows(reason="salt-ssh not available on Windows"),
|
||||
]
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def thin_dir(salt_ssh_cli):
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
ret = salt_ssh_cli.run("config.get", "thin_dir")
|
||||
assert ret.returncode == 0
|
||||
thin_dir_path = ret.data
|
||||
shutil.rmtree(thin_dir_path, ignore_errors=True)
|
||||
|
||||
|
||||
def test_ssh_mine_get(salt_ssh_cli):
|
||||
"""
|
||||
test salt-ssh with mine
|
||||
"""
|
||||
ret = salt_ssh_cli.run("mine.get", "localhost", "test.arg")
|
||||
assert ret.returncode == 0
|
||||
assert ret.data
|
||||
assert "localhost" in ret.data
|
||||
assert "args" in ret.data["localhost"]
|
||||
assert ret.data["localhost"]["args"] == ["itworked"]
|
Loading…
Add table
Reference in a new issue