Merge "Add basic rspec test"

This commit is contained in:
Zuul 2018-08-11 08:57:05 +00:00 committed by Gerrit Code Review
commit cd65ecbeb3
4 changed files with 94 additions and 0 deletions

View File

@ -79,6 +79,12 @@ class etherpad_lite (
anchor { 'nodejs-anchor': }
if !defined(Package['git']) {
package { 'git':
ensure => present
}
}
vcsrepo { "${base_install_dir}/etherpad-lite":
ensure => $ep_ensure,
provider => git,

View File

@ -0,0 +1,63 @@
require 'puppet-openstack_infra_spec_helper/spec_helper_acceptance'
describe 'puppet-etherpad_lite:: manifest', :if => ['debian', 'ubuntu'].include?(os[:family]) do
def pp_path
base_path = File.dirname(__FILE__)
File.join(base_path, 'fixtures')
end
def preconditions_puppet_module
module_path = File.join(pp_path, 'preconditions.pp')
File.read(module_path)
end
before(:all) do
apply_manifest(preconditions_puppet_module, catch_failures: true)
end
def init_puppet_module
module_path = File.join(pp_path, 'etherpad_lite.pp')
File.read(module_path)
end
it 'should work with no errors' do
apply_manifest(init_puppet_module, catch_failures: true)
end
describe 'required files' do
describe file('/opt/etherpad-lite/') do
it { should be_directory }
it { should be_grouped_into 'eplite' }
end
# check service file installed
describe file('/etc/systemd/system/etherpad-lite.service') do
it { should be_file }
end
# check git got all the source
describe file('/opt/etherpad-lite/etherpad-lite/bin/installDeps.sh') do
it { should be_file }
end
# check npm modules installed
describe file('/home/eplite/.npm') do
it { should be_directory }
end
end
# This needs more work before it's up in the test env ...
#
# describe 'required services' do
# describe 'ports are open and services are reachable' do
# describe port(80) do
# it { should be_listening }
# end
# describe command('curl -L -k http://localhost --verbose') do
# its(:stdout) { should contain('randomPadName()') }
# end
# end
# end
end

View File

@ -0,0 +1,21 @@
class { '::etherpad_lite::mysql':
database_password => 'password',
mysql_root_password => 'password',
}
class { '::etherpad_lite':
ep_ensure => 'latest',
eplite_version => '1.6.2',
nodejs_version => '6.x',
}
class { '::etherpad_lite::apache':
ssl_cert_file => '/etc/ssl/certs/ssl-cert-snakeoil.pem',
ssl_key_file => '/etc/ssl/private/ssl-cert-snakeoil.key',
vhost_name => 'localhost',
}
class { '::etherpad_lite::site':
database_password => 'password',
etherpad_title => 'A fake title',
}

View File

@ -0,0 +1,4 @@
# Installing ssl-cert in order to get snakeoil certs
package { 'ssl-cert':
ensure => present,
}