mirror of
https://github.com/valitydev/salt.git
synced 2024-11-07 08:58:59 +00:00
Merge pull request #8820 from terminalmage/tests
Add pkgrepo tests for CentOS
This commit is contained in:
commit
25dcbefb9c
17
tests/integration/files/file/base/pkgrepo/absent.sls
Normal file
17
tests/integration/files/file/base/pkgrepo/absent.sls
Normal file
@ -0,0 +1,17 @@
|
||||
{% if grains['os'] == 'CentOS' %}
|
||||
|
||||
# START CentOS pkgrepo tests
|
||||
epel-salttest:
|
||||
pkgrepo:
|
||||
- absent
|
||||
# END CentOS pkgrepo tests
|
||||
|
||||
{% else %}
|
||||
|
||||
# No matching OS grain for pkgrepo management, just run something that will
|
||||
# return a True result
|
||||
date:
|
||||
cmd:
|
||||
- run
|
||||
|
||||
{% endif %}
|
@ -0,0 +1,30 @@
|
||||
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
||||
Version: GnuPG v1.2.6 (GNU/Linux)
|
||||
|
||||
mQGiBEXopTIRBACZDBMOoFOakAjaxw1LXjeSvh/kmE35fU1rXfM7T0AV31NATCLF
|
||||
l5CQiNDA4oWreDThg2Bf6+LIVTsGQb1V+XXuLak4Em5yTYwMTVB//4/nMxQEbpl/
|
||||
QB2XwlJ7EQ0vW+kiPDz/7pHJz1p1jADzd9sQQicMtzysS4qT2i5A23j0VwCg1PB/
|
||||
lpYqo0ZhWTrevxKMa1n34FcD/REavj0hSLQFTaKNLHRotRTF8V0BajjSaTkUT4uk
|
||||
/RTaZ8Kr1mTosVtosqmdIAA2XHxi8ZLiVPPSezJjfElsSqOAxEKPL0djfpp2wrTm
|
||||
l/1iVnX+PZH5DRKCbjdCMLDJhYap7YUhcPsMGSeUKrwmBCBJUPc6DhjFvyhA9IMl
|
||||
1T0+A/9SKTv94ToP/JYoCTHTgnG5MoVNafisfe0wojP2mWU4gRk8X4dNGKMj6lic
|
||||
vM6gne3hESyjcqZSmr7yELPPGhI9MNauJ6Ob8cTR2T12Fmv9w03DD3MnBstR6vhP
|
||||
QcqZKhc5SJYYY7oVf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CRA7Sd8qBgi4lR/GD/wLGPv9
|
||||
qO39eyb9NlrwfKdUEo1tHxKdrhNz+XYrO4yVDTBZRPSuvL2yaoeSIhQOKhNPfEgT
|
||||
9mdsbsgcfmoHxmGVcn+lbheWsSvcgrXuz0gLt8TGGKGGROAoLXpuUsb1HNtKEOwP
|
||||
Q4z1uQ2nOz5hLRyDOV0I2LwYV8BjGIjBKUMFEUxFTsL7XOZkrAg/WbTH2PW3hrfS
|
||||
WtcRA7EYonI3B80d39ffws7SmyKbS5PmZjqOPuTvV2F0tMhKIhncBwoojWZPExft
|
||||
HpKhzKVh8fdDO/3P1y1Fk3Cin8UbCO9MWMFNR27fVzCANlEPljsHA+3Ez4F7uboF
|
||||
p0OOEov4Yyi4BEbgqZnthTG4ub9nyiupIZ3ckPHr3nVcDUGcL6lQD/nkmNVIeLYP
|
||||
x1uHPOSlWfuojAYgzRH6LL7Idg4FHHBA0to7FW8dQXFIOyNiJFAOT2j8P5+tVdq8
|
||||
wB0PDSH8yRpn4HdJ9RYquau4OkjluxOWf0uRaS//SUcCZh+1/KBEOmcvBHYRZA5J
|
||||
l/nakCgxGb2paQOzqqpOcHKvlyLuzO5uybMXaipLExTGJXBlXrbbASfXa/yGYSAG
|
||||
iVrGz9CE6676dMlm8F+s3XXE13QZrXmjloc6jwOljnfAkjTGXjiB7OULESed96MR
|
||||
XtfLk0W5Ab9pd7tKDR6QHI7rgHXfCopRnZ2VVQ==
|
||||
=V/6I
|
||||
-----END PGP PUBLIC KEY BLOCK-----
|
55
tests/integration/files/file/base/pkgrepo/managed.sls
Normal file
55
tests/integration/files/file/base/pkgrepo/managed.sls
Normal file
@ -0,0 +1,55 @@
|
||||
{% if grains['os'] == 'CentOS' %}
|
||||
|
||||
# START CentOS pkgrepo tests
|
||||
{% if grains['osrelease'].startswith('6.') %}
|
||||
epel-salttest:
|
||||
pkgrepo.managed:
|
||||
- humanname: Extra Packages for Enterprise Linux 6 - $basearch (salttest)
|
||||
- comments:
|
||||
- '#baseurl=http://download.fedoraproject.org/pub/epel/6/$basearch'
|
||||
- mirrorlist: https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=$basearch
|
||||
- failovermethod: priority
|
||||
- enabled: 1
|
||||
- gpgcheck: 1
|
||||
- gpgkey: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6-salttest
|
||||
- require:
|
||||
- file: /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6-salttest
|
||||
|
||||
/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-6-salttest:
|
||||
file.managed:
|
||||
- source: salt://pkgrepo/files/RPM-GPG-KEY-EPEL-6-salttest
|
||||
- user: root
|
||||
- group: root
|
||||
- mode: 644
|
||||
{% elif grains['osrelease'].startswith('5.') %}
|
||||
epel-salttest:
|
||||
pkgrepo.managed:
|
||||
- humanname: Extra Packages for Enterprise Linux 5 - $basearch (salttest)
|
||||
- comments:
|
||||
- '#baseurl=http://download.fedoraproject.org/pub/epel/5/$basearch'
|
||||
- mirrorlist: http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=$basearch
|
||||
- failovermethod: priority
|
||||
- enabled: 1
|
||||
- gpgcheck: 1
|
||||
- gpgkey: file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-5-salttest
|
||||
- require:
|
||||
- file: /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-5-salttest
|
||||
|
||||
/etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-5-salttest:
|
||||
file.managed:
|
||||
- source: salt://pkgrepo/files/RPM-GPG-KEY-EPEL-5-salttest
|
||||
- user: root
|
||||
- group: root
|
||||
- mode: 644
|
||||
{% endif %}
|
||||
# END CentOS pkgrepo tests
|
||||
|
||||
{% else %}
|
||||
|
||||
# No matching OS grain for pkgrepo management, just run something that will
|
||||
# return a True result
|
||||
date:
|
||||
cmd:
|
||||
- run
|
||||
|
||||
{% endif %}
|
55
tests/integration/states/pkgrepo.py
Normal file
55
tests/integration/states/pkgrepo.py
Normal file
@ -0,0 +1,55 @@
|
||||
'''
|
||||
tests for pkgrepo states
|
||||
'''
|
||||
|
||||
# Import Salt Testing libs
|
||||
from salttesting import skipIf
|
||||
from salttesting.helpers import (
|
||||
destructiveTest,
|
||||
ensure_in_syspath,
|
||||
)
|
||||
ensure_in_syspath('../../')
|
||||
|
||||
# Import salt libs
|
||||
import integration
|
||||
import salt.utils
|
||||
|
||||
|
||||
class PkgrepoTest(integration.ModuleCase,
|
||||
integration.SaltReturnAssertsMixIn):
|
||||
'''
|
||||
pkgrepo state tests
|
||||
'''
|
||||
@destructiveTest
|
||||
@skipIf(salt.utils.is_windows(), 'minion is windows')
|
||||
def test_pkgrepo_01_managed(self):
|
||||
'''
|
||||
This is a destructive test as it adds a repository.
|
||||
'''
|
||||
ret = self.run_function('state.sls', mods='pkgrepo.managed')
|
||||
# If the below assert fails then no states were run, and the SLS in
|
||||
# tests/integration/files/file/base/pkgrepo/managed.sls needs to be
|
||||
# corrected.
|
||||
self.assertReturnNonEmptySaltType(ret)
|
||||
for state_id, state_result in ret.iteritems():
|
||||
self.assertSaltTrueReturn(dict([(state_id, state_result)]))
|
||||
|
||||
@destructiveTest
|
||||
@skipIf(salt.utils.is_windows(), 'minion is windows')
|
||||
def test_pkgrepo_02_absent(self):
|
||||
'''
|
||||
This is a destructive test as it removes the repository added in the
|
||||
above test.
|
||||
'''
|
||||
ret = self.run_function('state.sls', mods='pkgrepo.absent')
|
||||
# If the below assert fails then no states were run, and the SLS in
|
||||
# tests/integration/files/file/base/pkgrepo/absent.sls needs to be
|
||||
# corrected.
|
||||
self.assertReturnNonEmptySaltType(ret)
|
||||
for state_id, state_result in ret.iteritems():
|
||||
self.assertSaltTrueReturn(dict([(state_id, state_result)]))
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
from integration import run_tests
|
||||
run_tests(PkgrepoTest)
|
Loading…
Reference in New Issue
Block a user