"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "tests/integration/states/test_pkgrepo.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_pkgrepo.py  (salt-3002.1):test_pkgrepo.py  (salt-3002.2)
""" """
tests for pkgrepo states tests for pkgrepo states
""" """
# Import Python libs
import os import os
import salt.utils.files import salt.utils.files
# Import Salt libs
import salt.utils.platform import salt.utils.platform
# Import Salt Testing libs
from tests.support.case import ModuleCase from tests.support.case import ModuleCase
from tests.support.helpers import ( from tests.support.helpers import (
destructiveTest, destructiveTest,
requires_salt_modules, requires_salt_modules,
requires_salt_states, requires_salt_states,
requires_system_grains, requires_system_grains,
runs_on,
slowTest, slowTest,
) )
from tests.support.mixins import SaltReturnAssertsMixin from tests.support.mixins import SaltReturnAssertsMixin
from tests.support.pytest.helpers import temp_state_file
from tests.support.unit import skipIf from tests.support.unit import skipIf
@destructiveTest @destructiveTest
@skipIf(salt.utils.platform.is_windows(), "minion is windows") @skipIf(salt.utils.platform.is_windows(), "minion is windows")
class PkgrepoTest(ModuleCase, SaltReturnAssertsMixin): class PkgrepoTest(ModuleCase, SaltReturnAssertsMixin):
""" """
pkgrepo state tests pkgrepo state tests
""" """
@requires_salt_modules("pkgrepo.managed") @requires_salt_modules("pkgrepo.managed")
skipping to change at line 321 skipping to change at line 317
self.assertSaltTrueReturn(ret) self.assertSaltTrueReturn(ret)
ret = ret[next(iter(ret))] ret = ret[next(iter(ret))]
self.assertFalse(ret["changes"]) self.assertFalse(ret["changes"])
self.assertEqual( self.assertEqual(
ret["comment"], ret["comment"],
"Package repo '{}' already configured".format(kwargs["name"]), "Package repo '{}' already configured".format(kwargs["name"]),
) )
finally: finally:
# Clean up # Clean up
self.run_state("pkgrepo.absent", copr=kwargs["copr"]) self.run_state("pkgrepo.absent", copr=kwargs["copr"])
@runs_on(kernel="linux", os="Ubuntu")
def test_managed_multiple_comps(self):
state_file = """
ubuntu-backports:
pkgrepo.managed:
- name: 'deb http://fi.archive.ubuntu.com/ubuntu focal-backports'
- comps: main, restricted, universe, multiverse
- refresh: false
- disabled: false
- clean_file: true
- file: /etc/apt/sources.list.d/99-salt-archive-ubuntu-focal-backpor
ts.list
- require_in:
- pkgrepo: canonical-ubuntu
canonical-ubuntu:
pkgrepo.managed:
- name: 'deb http://archive.canonical.com/ubuntu {{ salt['grains.get
']('oscodename') }}'
- comps: partner
- refresh: false
- disabled: false
- clean_file: true
- file: /etc/apt/sources.list.d/99-salt-canonical-ubuntu.list
"""
def remove_apt_list_file(path):
if os.path.exists(path):
os.unlink(path)
self.addCleanup(
remove_apt_list_file,
"/etc/apt/sources.list.d/99-salt-canonical-ubuntu.list",
)
self.addCleanup(
remove_apt_list_file,
"/etc/apt/sources.list.d/99-salt-archive-ubuntu-focal-backports.list
",
)
with temp_state_file("multiple-comps-repos.sls", state_file):
ret = self.run_function("state.sls", ["multiple-comps-repos"])
for state_run in ret.values():
# On the first run, we must have changes
assert state_run["changes"]
ret = self.run_function("state.sls", ["multiple-comps-repos"])
for state_run in ret.values():
# On the second run though, we shouldn't have changes made
assert not state_run["changes"]
 End of changes. 6 change blocks. 
6 lines changed or deleted 2 lines changed or added

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