"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/pytests/integration/proxy/test_shell.py" between
salt-3002.1.tar.gz and salt-3002.2.tar.gz

About: SaltStack is a systems management software for data center automation, cloud orchestration, server provisioning, configuration management and more. Community version.

test_shell.py  (salt-3002.1):test_shell.py  (salt-3002.2)
""" """
tests.integration.proxy.test_shell tests.integration.proxy.test_shell
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Test salt-call --proxyid <proxyid> commands Test salt-call --proxyid <proxyid> commands
""" """
import logging import logging
import os
import random import random
import pytest import pytest
import salt.proxy.dummy import salt.proxy.dummy
import salt.utils.path import salt.utils.path
import salt.utils.platform import salt.utils.platform
from tests.support.helpers import slowTest from tests.support.helpers import slowTest
log = logging.getLogger(__name__) log = logging.getLogger(__name__)
@pytest.fixture(scope="module") @pytest.fixture(scope="module")
def salt_proxy(salt_proxy):
cachefile = os.path.join(salt_proxy.config["cachedir"], "dummy-proxy.cache")
if os.path.exists(cachefile):
os.unlink(cachefile)
return salt_proxy
@pytest.fixture
def salt_call_cli(salt_proxy): def salt_call_cli(salt_proxy):
return salt_proxy.get_salt_call_cli(default_timeout=120) return salt_proxy.get_salt_call_cli(default_timeout=120)
@slowTest @slowTest
def test_can_it_ping(salt_call_cli): def test_can_it_ping(salt_call_cli):
""" """
Ensure the proxy can ping Ensure the proxy can ping
""" """
ret = salt_call_cli.run("test.ping") ret = salt_call_cli.run("test.ping")
assert ret.exitcode == 0, ret assert ret.exitcode == 0, ret
assert ret.json is True assert ret.json is True
@slowTest @slowTest
def test_list_pkgs(salt_call_cli): def test_list_pkgs(salt_call_cli):
""" """
Package test 1, really just tests that the virtual function capability Package test 1, really just tests that the virtual function capability
is working OK. is working OK.
""" """
ret = salt_call_cli.run("pkg.list_pkgs") ret = salt_call_cli.run("pkg.list_pkgs")
assert ret.exitcode == 0, ret assert ret.exitcode == 0, ret
for package_name in salt.proxy.dummy.DETAILS["packages"]: for package_name in salt.proxy.dummy._initial_state()["packages"]:
assert package_name in ret.json assert package_name in ret.json
@slowTest @slowTest
@pytest.mark.skip_if_not_root
@pytest.mark.destructive_test
def test_upgrade(salt_call_cli): def test_upgrade(salt_call_cli):
ret = salt_call_cli.run("pkg.upgrade") ret = salt_call_cli.run("pkg.upgrade")
assert ret.exitcode == 0, ret assert ret.exitcode == 0, ret
# Assert that something got upgraded # Assert that something got upgraded
assert ret.json assert ret.json
assert ret.json["coreutils"]["new"] == "2.0" assert ret.json["coreutils"]["new"] == "2.0"
assert ret.json["redbull"]["new"], "1000.99" assert ret.json["redbull"]["new"], "1000.99"
@pytest.fixture @pytest.fixture
def service_name(): def service_name():
return random.choice(list(salt.proxy.dummy.DETAILS["services"])) return random.choice(list(salt.proxy.dummy._initial_state()["services"]))
@slowTest @slowTest
@pytest.mark.skip_if_not_root
def test_service_list(salt_call_cli, service_name): def test_service_list(salt_call_cli, service_name):
ret = salt_call_cli.run("service.list") ret = salt_call_cli.run("service.list")
assert ret.exitcode == 0, ret assert ret.exitcode == 0, ret
assert service_name in ret.json assert service_name in ret.json
@slowTest @slowTest
@pytest.mark.skip_if_not_root def test_service_start(salt_call_cli):
def test_service_start(salt_call_cli, service_name): ret = salt_call_cli.run("service.start", "samba")
ret = salt_call_cli.run("service.start", service_name)
assert ret.exitcode == 0, ret assert ret.exitcode == 0, ret
ret = salt_call_cli.run("service.status", service_name) ret = salt_call_cli.run("service.status", "samba")
assert ret.exitcode == 0, ret assert ret.exitcode == 0, ret
assert ret.json is True assert ret.json is True
@slowTest @slowTest
@pytest.mark.skip_if_not_root
def test_service_get_all(salt_call_cli, service_name): def test_service_get_all(salt_call_cli, service_name):
ret = salt_call_cli.run("service.get_all") ret = salt_call_cli.run("service.get_all")
assert ret.exitcode == 0, ret assert ret.exitcode == 0, ret
assert service_name in ret.json assert service_name in ret.json
@slowTest @slowTest
def test_grains_items(salt_call_cli): def test_grains_items(salt_call_cli):
ret = salt_call_cli.run("grains.items") ret = salt_call_cli.run("grains.items")
assert ret.exitcode == 0, ret assert ret.exitcode == 0, ret
assert ret.json["kernel"] == "proxy" assert ret.json["kernel"] == "proxy"
 End of changes. 9 change blocks. 
10 lines changed or deleted 13 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)