From 3a1e5525fd5cb15ba34cfbeb15e45dd2113d2a73 Mon Sep 17 00:00:00 2001 From: Colleen Murphy Date: Sun, 11 Jun 2017 16:08:19 +0200 Subject: [PATCH] Remove unnecessary beaker tests We don't need beaker to check that every single file and package is installed. It is safe to assume that if puppet ran successfully then it was also able to successfully find and install packages and apply config files. Rather than update the tests to reflect new names of Java packages on xenial, we can reduce maintenance costs by just removing the tests. It's important to keep tests that check that the service is running and working correctly, because it is possible for puppet to claim success but for the application to not be working. Change-Id: Ifd41b858812638191049f415bbdf78c1f3145e46 --- spec/acceptance/master_spec.rb | 90 ------------------- spec/acceptance/slave_spec.rb | 156 --------------------------------- 2 files changed, 246 deletions(-) diff --git a/spec/acceptance/master_spec.rb b/spec/acceptance/master_spec.rb index 64fdc90..369ebd1 100644 --- a/spec/acceptance/master_spec.rb +++ b/spec/acceptance/master_spec.rb @@ -28,54 +28,6 @@ describe 'puppet-jenkins master module', :if => ['debian', 'ubuntu'].include?(os apply_manifest(jenkins_master_puppet_module, catch_changes: true) end - describe 'required files' do - describe 'jenkins master ssh keys' do - describe file('/var/lib/jenkins/.ssh/id_rsa') do - it { should be_file } - its(:content) { should match '-----BEGIN RSA PRIVATE KEY-----' } - end - - describe file('/var/lib/jenkins/.ssh/id_rsa.pub') do - it { should be_file } - its(:content) { should match 'ssh_rsa' } - end - end - - describe 'files and directories belonging to jenkins user and group' do - files = [ - file('/var/lib/jenkins/.ssh/id_rsa'), - file('/var/lib/jenkins/.ssh/id_rsa.pub'), - file('/var/lib/jenkins/logger.conf'), - file('/var/lib/jenkins/plugins/simple-theme-plugin/openstack-page-bkg.jpg'), - file('/var/lib/jenkins/plugins/simple-theme-plugin/openstack.css'), - file('/var/lib/jenkins/plugins/simple-theme-plugin/openstack.js'), - ] - - files.each do |file| - describe file do - it { should be_file } - it { should be_owned_by 'jenkins' } - it { should be_grouped_into 'jenkins' } - end - end - - directories = [ - file('/var/lib/jenkins/.ssh'), - file('/var/lib/jenkins/plugins'), - file('/var/lib/jenkins/plugins/simple-theme-plugin'), - ] - - directories.each do |directory| - describe directory do - it { should be_directory } - it { should be_owned_by 'jenkins' } - it { should be_grouped_into 'jenkins' } - end - end - - end - end - describe 'required services' do describe command('curl http://127.0.0.1 --verbose') do its(:stdout) { should contain('302 Found') } @@ -95,46 +47,4 @@ describe 'puppet-jenkins master module', :if => ['debian', 'ubuntu'].include?(os end end - describe 'required packages' do - required_packages = [ - package('jenkins'), - package('openjdk-7-jre-headless'), - package('python-babel'), - package('python-sqlalchemy'), - package('sqlite3'), - package('ssl-cert'), - ] - - required_packages << package('apache2') if ['ubuntu', 'debian'].include?(os[:family]) - required_packages << package('httpd') if ['centos', 'redhat'].include?(os[:family]) - - required_packages.each do |package| - describe package do - it { should be_installed } - end - end - - unnecessary_packages = [ - package('openjdk-6-jre-headless') - ] - - unnecessary_packages.each do |package| - describe package do - it { should_not be_installed } - end - end - end - - describe 'required users and groups' do - describe group('jenkins') do - it { should exist } - end - - describe user('jenkins') do - it { should exist } - it { should belong_to_group 'jenkins' } - it { should have_home_directory '/home/jenkins' } - it { should have_login_shell '/bin/bash' } - end - end end diff --git a/spec/acceptance/slave_spec.rb b/spec/acceptance/slave_spec.rb index 5e8d17f..c2e5e64 100644 --- a/spec/acceptance/slave_spec.rb +++ b/spec/acceptance/slave_spec.rb @@ -27,160 +27,4 @@ describe 'puppet-jenkins slave module', :if => ['debian', 'ubuntu'].include?(os[ it 'should be idempotent' do apply_manifest(jenkins_slave_puppet_module, catch_changes: true) end - - describe 'required files' do - describe file('/home/jenkins/.gitconfig') do - it { should be_file } - its(:content) { should match '[user]' } - its(:content) { should match 'name = OpenStack Jenkins' } - its(:content) { should match 'email = jenkins@openstack.org' } - its(:content) { should match '[gitreview]' } - its(:content) { should match 'username = jenkins' } - end - - describe file('/home/jenkins/.m2/settings.xml') do - it { should be_file } - its(:content) { should match 'jenkins' } - its(:content) { should match 'http://repo.jenkins-ci.org/public/' } - end - - describe file('/home/jenkins/.ssh/config') do - it { should be_file } - its(:content) { should match 'StrictHostKeyChecking=no' } - end - - jenkins_user_directories = [ - file('/home/jenkins/.pip'), - file('/home/jenkins/.config'), - ] - - jenkins_user_directories.each do |directory| - describe directory do - it { should be_directory } - it { should be_owned_by 'jenkins' } - it { should be_grouped_into 'jenkins' } - end - end - - jenkins_user_files = [ - file('/home/jenkins/.bash_logout'), - file('/home/jenkins/.bashrc'), - file('/home/jenkins/.profile'), - file('/home/jenkins/.ssh/authorized_keys'), - ] - - jenkins_user_files.each do |file| - describe file do - it { should be_file } - end - end - - describe 'symlinkies' do - symlinkies = { - file('/usr/local/bin/c++') => '/usr/bin/ccache', - file('/usr/local/bin/cc') => '/usr/bin/ccache', - file('/usr/local/bin/g++') => '/usr/bin/ccache', - file('/usr/local/bin/gcc') => '/usr/bin/ccache', - } - - symlinkies.each do |link, destination| - describe link do - it { should be_symlink } - it { should be_linked_to destination } - end - end - end - - describe file('/usr/local/jenkins') do - it { should be_directory } - it { should be_owned_by 'root' } - it { should be_grouped_into 'root' } - end - end - - describe 'required packages' do - if ['ubuntu', 'debian'].include?(os[:family]) then - required_packages = [ - package('build-essential'), - package('ccache'), - package('maven2'), - package('openjdk-7-jdk'), - package('python-netaddr'), - package('ruby1.9.1'), - ] - elsif ['centos', 'redhat'].include?(os[:family]) then - required_packages = [ - package('ccache'), - package('java-1.7.0-openjdk-devel'), - package('python-netaddr'), - ] - end - - required_packages.each do |package| - describe package do - it { should be_installed } - end - end - - unnecessary_packages = [ - package('openjdk-6-jre-headless') - ] - - unnecessary_packages.each do |package| - describe package do - it { should_not be_installed } - end - end - - pip_packages = [ - package('git-review'), - package('tox'), - ] - - pip_packages.each do |package| - describe package do - it { should be_installed.by('pip') } - end - end - end - - describe 'required users and groups' do - describe group('jenkins') do - it { should exist } - end - - describe user('jenkins') do - it { should exist } - it { should belong_to_group 'jenkins' } - it { should have_home_directory '/home/jenkins' } - it { should have_login_shell '/bin/bash' } - end - end -end - -describe 'puppet-jenkins jenkins-job-builder module', :if => ['debian', 'ubuntu'].include?(os[:family]) do - describe 'required files' do - describe file('/etc/jenkins_jobs/jenkins_jobs.ini') do - its(:content) { should match '[jenkins]' } - its(:content) { should match 'user=jenkins' } - its(:content) { should match 'password=secret' } - its(:content) { should match 'url=https://127.0.0.1' } - end - - describe file('/etc/jenkins_jobs/config') do - it { should be_directory } - it { should be_owned_by 'root' } - it { should be_grouped_into 'root' } - end - end - - describe 'required packages' do - describe package('python-jenkins') do - it { should be_installed.by('pip') } - end - - describe package('python-yaml') do - it { should be_installed } - end - end end