Add beaker test for ca_text parameter and use electrical's docker image for testing

This commit is contained in:
Phil Fenstermacher 2015-02-26 16:10:36 -05:00
Родитель 54b2a9599e
Коммит c7d1e9a762
5 изменённых файлов: 66 добавлений и 25 удалений

1
.gitignore поставляемый
Просмотреть файл

@ -7,3 +7,4 @@ spec/fixtures
.vagrant .vagrant
.*sw* .*sw*
pkg/ pkg/
log/

Просмотреть файл

@ -3,11 +3,13 @@ require 'spec_helper_acceptance'
describe 'ca_cert::ca', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do describe 'ca_cert::ca', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily')) do
case fact('osfamily') case fact('osfamily')
when 'Debian' when 'Debian'
TRUSTED_CA_FILE = '/usr/local/share/ca-certificates/Globalsign_Org_Intermediate.crt' TRUSTED_CA_FILE_REMOTE = '/usr/local/share/ca-certificates/Globalsign_Org_Intermediate.crt'
ABSENT_CA_FILE = '/etc/pki/ca-trust/source/blacklist/CACert.crt' ABSENT_CA_FILE_REMOTE = '/etc/pki/ca-trust/source/blacklist/CACert.crt'
TRUSTED_CA_FILE_TEXT = '/usr/local/share/ca-certificates/InCommon.crt'
when 'RedHat' when 'RedHat'
TRUSTED_CA_FILE = '/etc/pki/ca-trust/source/anchors/Globalsign_Org_Intermediate.crt' TRUSTED_CA_FILE_REMOTE = '/etc/pki/ca-trust/source/anchors/Globalsign_Org_Intermediate.crt'
UNTRUSTED_CA_FILE = '/etc/pki/ca-trust/source/blacklist/CACert.crt' UNTRUSTED_CA_FILE_REMOTE = '/etc/pki/ca-trust/source/blacklist/CACert.crt'
TRUSTED_CA_FILE_TEXT = '/etc/pki/ca-trust/source/anchors/InCommon.crt'
end end
describe 'running puppet code' do describe 'running puppet code' do
@ -19,6 +21,37 @@ describe 'ca_cert::ca', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily
source => 'http://secure.globalsign.com/cacert/gsorganizationvalsha2g2r1.crt', source => 'http://secure.globalsign.com/cacert/gsorganiz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QVJvb3QuY3JsMIGz
BggrBgEFBQcBAQSBpjCBozA/BggrBgEFBQcwAoYzaHR0cDovL2NydC51c2VydHJ1
c3QuY29tL0FkZFRydXN0RXh0ZXJuYWxDQVJvb3QucDdjMDkGCCsGAQUFBzAChi1o
dHRwOi8vY3J0LnVzZXJ0cnVzdC5jb20vQWRkVHJ1c3RVVE5TR0NDQS5jcnQwJQYI
KwYBBQUHMAGGGWh0dHA6Ly9vY3NwLnVzZXJ0cnVzdC5jb20wDQYJKoZIhvcNAQEF
BQADggEBAJNmIYB0RYVLwqvOMrAp/t3f1iRbvwNqb1A+DhuzDYijW+7EpBI7Vu8G
f89/IZVWO0Ex/uGqk9KV85UNPEerylwmrT7x+Yw0bhG+9GfjAkn5pnx7ZCXdF0by
UOPjCiE6SSTNxoRlaGdosEUtR5nNnKuGKRFy3NacNkN089SXnlag/l9AWNLV1358
xY4asgRckmYOha0uBs7Io9jrFCeR3s8XMIFTtmYSrTfk9e+WXCAONumsYn0ZgYr1
kGGmSavOPN/mymTugmU5RZUWukEGAJi6DFZh5MbGhgHPZqkiKQLWPc/EKo2Z3vsJ
FJ4O0dXG14HdrSSrrAcF4h1ow3BmX9M=
-----END CERTIFICATE-----',
}
ca_cert::ca { 'CACert': ca_cert::ca { 'CACert':
source => 'http://www.cacert.org/certs/root.crt', source => 'http://www.cacert.org/certs/root.crt',
ensure => 'distrusted', ensure => 'distrusted',
@ -27,18 +60,22 @@ describe 'ca_cert::ca', :unless => UNSUPPORTED_PLATFORMS.include?(fact('osfamily
apply_manifest(pp, :catch_failures => true) apply_manifest(pp, :catch_failures => true)
end end
describe file(TRUSTED_CA_FILE) do describe file(TRUSTED_CA_FILE_REMOTE) do
it { is_expected.to be_file }
end
describe file(TRUSTED_CA_FILE_TEXT) do
it { is_expected.to be_file } it { is_expected.to be_file }
end end
case fact('osfamily') case fact('osfamily')
when 'Debian' when 'Debian'
describe file(ABSENT_CA_FILE) do describe file(ABSENT_CA_FILE_REMOTE) do
it { is_expected.to_not be_file } it { is_expected.to_not be_file }
end end
when 'RedHat' when 'RedHat'
describe file(UNTRUSTED_CA_FILE) do describe file(UNTRUSTED_CA_FILE_REMOTE) do
it { is_expected.to be_file } it { is_expected.to be_file }
end end
end end

Просмотреть файл

@ -1,9 +1,12 @@
HOSTS: HOSTS:
ubuntu-12-04: ubuntu-14-04:
platform: ubuntu-12.04-x64 platform: ubuntu-14.04-x64
image: ubuntu:precise platform: ubuntu-14.04-amd64
image: electrical/ubuntu:14.04
hypervisor: docker hypervisor: docker
docker_cmd: '["/sbin/init"]'
docker_image_commands: docker_image_commands:
- 'apt-get install -yq wget net-tools curl lsb-release rubygems' - 'apt-get install -yq ruby ruby1.9.1-dev libaugeas-dev libaugeas-ruby lsb-release wget net-tools curl'
CONFIG: docker_preserve_image: true
CONFIG:
type: foss type: foss

Просмотреть файл

@ -0,0 +1,12 @@
HOSTS:
ubuntu-12-04:
platform: ubuntu-12.04-x64
platform: ubuntu-12.04-amd64
image: electrical/ubuntu:12.04
hypervisor: docker
docker_cmd: '["/sbin/init"]'
docker_image_commands:
- 'apt-get install -yq ruby1.8-dev libaugeas-dev libaugeas-ruby ruby rubygems lsb-release wget net-tools curl'
docker_preserve_image: true
CONFIG:
type: foss

Просмотреть файл

@ -1,12 +0,0 @@
HOSTS:
ubuntu-14-04:
platform: ubuntu-14.04-x64
image: ubuntu:trusty
hypervisor: docker
docker_image_commands:
- 'apt-get install -yq wget net-tools curl lsb-release ruby ruby-dev'
- "sed -ri 's/^session\\s+required\\s+pam_loginuid.so$/session optional pam_loginuid.so/g' /etc/pam.d/sshd"
- "sed -ri 's/PermitRootLogin without-password/PermitRootLogin yes/g' /etc/ssh/sshd_config"
- "sed -ri 's/PermitEmptyPasswords no/PermitEmptyPasswords yes/g' /etc/ssh/sshd_config"
CONFIG:
type: foss