diff --git a/spec/acceptance/basic_spec.rb b/spec/acceptance/basic_spec.rb new file mode 100755 index 0000000..49efae9 --- /dev/null +++ b/spec/acceptance/basic_spec.rb @@ -0,0 +1,24 @@ +require 'spec_helper_acceptance' + +describe 'basic openstackci' do + + if fact('osfamily') == 'Debian' + + context 'default parameters' do + + it 'should work with no errors' do + + base_path = File.dirname(__FILE__) + pp_path = File.join(base_path, 'fixtures', 'default.pp') + pp = File.read(pp_path) + + # Run it twice and test for idempotency + apply_manifest(pp, :catch_failures => true) + apply_manifest(pp, :catch_changes => true) + end + + end + + end + +end diff --git a/spec/acceptance/fixtures/default.pp b/spec/acceptance/fixtures/default.pp new file mode 100644 index 0000000..8753b23 --- /dev/null +++ b/spec/acceptance/fixtures/default.pp @@ -0,0 +1,5 @@ +# This test only runs on Debian flavors +class { '::openstackci::logserver': + domain => 'foo.openstack.org', + jenkins_ssh_key => 'AAAAB3NzaC1yc2EAAAADAQABAAACAQDW+zftKW0GvHKnIAZuE+WCcgLYzSj5LaJ1BEg1DXtBU8yKpTmdunjtJ47F0nVap/6nmbi3Xif4KHYEMoSkmyU+hqEbpFX/GzoJ0i69Kf+FYHfP5ZC8MD9NjdZ7pyPNIXvKTqRUc+ghDVwyDdtVOEiUtOTVrzDsKrDheZi9TvXTZ4fHj4ykuwDQeNwUoEBuhYZSg6/82+Bs1v/l5lOuZrOOOLikOK733KhBvXhEaeChxT2Tc0biaUuJFa7w+i/lc7uBuF3jY8H5cSd/FpKNgAMd4VaebX6m0WqYSWz+VlLARqyz8AP0jlK/2cHiB8Yu0zK34Q+os1tBzc6dc8jyxyjUA5ydDsUnRXaYlHAwsPGygb5EyCgll78EXR2MjSCWX6kfbG4NTM1T00Ezftld0jbcNG5t6skkYPnZQhTpesnauwc6Kj+ME+kftHpyd1HxWM24IeCRG0PznJuxNxBp8PlSMWDZtf1f5+ez7Z9rj0Qxi0Jd53EOMGSfYQUuMXRpnk7M/rX50J9wRts/+OnoH/4AxUAU5yB2ELzi6f4lt2Scqruj7Xp78SW++0nbdQQwYTqiNfLA789jIGaM2r1GAn06oX7jyEpniglaNf/9KGZVb+Y4WWLV4Wr8xfPrsQf1i5YK94qhN4C8NrXOG7hEcYT7Rvu2pKZ4dhwGxh4SmWNY0Q==', +} diff --git a/spec/acceptance/nodesets/default.yml b/spec/acceptance/nodesets/default.yml new file mode 100644 index 0000000..3bb3e62 --- /dev/null +++ b/spec/acceptance/nodesets/default.yml @@ -0,0 +1,11 @@ +HOSTS: + ubuntu-server-1404-x64: + roles: + - master + platform: ubuntu-14.04-amd64 + box: puppetlabs/ubuntu-14.04-64-nocm + box_url: https://vagrantcloud.com/puppetlabs/ubuntu-14.04-64-nocm + hypervisor: vagrant +CONFIG: + log_level: debug + type: git diff --git a/spec/acceptance/nodesets/nodepool-centos7.yml b/spec/acceptance/nodesets/nodepool-centos7.yml new file mode 100644 index 0000000..c552874 --- /dev/null +++ b/spec/acceptance/nodesets/nodepool-centos7.yml @@ -0,0 +1,10 @@ +HOSTS: + centos-70-x64: + roles: + - master + platform: el-7-x86_64 + hypervisor: none + ip: 127.0.0.1 +CONFIG: + type: foss + set_env: false diff --git a/spec/acceptance/nodesets/nodepool-trusty.yml b/spec/acceptance/nodesets/nodepool-trusty.yml new file mode 100644 index 0000000..9fc624e --- /dev/null +++ b/spec/acceptance/nodesets/nodepool-trusty.yml @@ -0,0 +1,10 @@ +HOSTS: + ubuntu-14.04-amd64: + roles: + - master + platform: ubuntu-14.04-amd64 + hypervisor: none + ip: 127.0.0.1 +CONFIG: + type: foss + set_env: false diff --git a/spec/spec_helper_acceptance.rb b/spec/spec_helper_acceptance.rb new file mode 100644 index 0000000..7e06ccb --- /dev/null +++ b/spec/spec_helper_acceptance.rb @@ -0,0 +1,41 @@ +require 'beaker-rspec' + +hosts.each do |host| + + install_puppet + + on host, "mkdir -p #{host['distmoduledir']}" +end + +RSpec.configure do |c| + # Project root + proj_root = File.expand_path(File.join(File.dirname(__FILE__), '..')) + + # Readable test descriptions + c.formatter = :documentation + + # Configure all nodes in nodeset + c.before :suite do + # Install module and dependencies + hosts.each do |host| + + # install git + install_package host, 'git' + + # clean out any module cruft + shell('rm -fr /etc/puppet/modules/*') + + # install library modules from the forge + on host, puppet('module','install','puppetlabs-apache', '--version', '0.0.4'), { :acceptable_exit_codes => 0 } + + # install puppet modules from git, use master, TODO: zuul-cloner this + shell('git clone https://git.openstack.org/openstack-infra/puppet-jenkins /etc/puppet/modules/jenkins') + shell('git clone https://git.openstack.org/openstack-infra/puppet-vcsrepo /etc/puppet/modules/vcsrepo') + + # Install the module being tested + puppet_module_install(:source => proj_root, :module_name => 'openstackci') + # List modules installed to help with debugging + on hosts[0], puppet('module','list'), { :acceptable_exit_codes => 0 } + end + end +end