mirror of
https://github.com/saltstack/salt-bootstrap.git
synced 2025-04-16 09:40:21 +00:00
Test bootstrapped Salt and Python versions are the intended ones
This commit is contained in:
parent
5edbeeb199
commit
11d59fda89
4 changed files with 45 additions and 8 deletions
|
@ -232,4 +232,4 @@ suites:
|
|||
verifier:
|
||||
name: shell
|
||||
remote_exec: false
|
||||
command: pytest --cache-clear -v tests/integration/
|
||||
command: pytest --cache-clear -v -s -ra --log-cli-level=info tests/integration/
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
import os
|
||||
import pprint
|
||||
import pytest
|
||||
import testinfra
|
||||
import logging
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@pytest.fixture(scope='session')
|
||||
|
@ -14,3 +18,19 @@ def host():
|
|||
'paramiko://{KITCHEN_USERNAME}@{KITCHEN_HOSTNAME}:{KITCHEN_PORT}'.format(**os.environ),
|
||||
ssh_identity_file=os.environ.get('KITCHEN_SSH_KEY'))
|
||||
return testinfra.get_host('docker://{KITCHEN_USERNAME}@{KITCHEN_CONTAINER_ID}'.format(**os.environ))
|
||||
|
||||
|
||||
@pytest.fixture(scope='session')
|
||||
def target_python_version():
|
||||
target_python = os.environ["KITCHEN_SUITE"].split("-", 1)[0]
|
||||
if target_python == "latest":
|
||||
pytest.skip("Unable to get target python from {}".format(os.environ["KITCHEN_SUITE"]))
|
||||
return int(target_python.replace("py", ""))
|
||||
|
||||
|
||||
@pytest.fixture(scope='session')
|
||||
def target_salt_version():
|
||||
target_salt = os.environ["KITCHEN_SUITE"].split("-", 2)[-1].replace("-", ".")
|
||||
if target_salt in ("latest", "master"):
|
||||
pytest.skip("Don't have a specific salt version to test against")
|
||||
return target_salt
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import pytest
|
||||
|
||||
|
||||
def test_ping(host):
|
||||
with host.sudo():
|
||||
assert host.salt('test.ping', '--timeout=120')
|
24
tests/integration/test_installation.py
Normal file
24
tests/integration/test_installation.py
Normal file
|
@ -0,0 +1,24 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
import json
|
||||
import pytest
|
||||
import logging
|
||||
import pprint
|
||||
|
||||
log = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def test_ping(host):
|
||||
with host.sudo():
|
||||
assert host.salt('test.ping', '--timeout=120')
|
||||
|
||||
|
||||
def test_target_python_version(host, target_python_version):
|
||||
with host.sudo():
|
||||
ret = host.salt('grains.item', 'pythonversion', '--timeout=120')
|
||||
assert ret["pythonversion"][0] == target_python_version
|
||||
|
||||
|
||||
def test_target_salt_version(host, target_salt_version):
|
||||
with host.sudo():
|
||||
ret = host.salt('grains.item', 'saltversion', '--timeout=120')
|
||||
assert ret["saltversion"].startswith(target_salt_version)
|
Loading…
Add table
Reference in a new issue