Rakefile now support Puppetfile to skip tests

This commit adds support to automatically exclude modules
defined in the fuel-library Puppetfile from rspec and
lint tests.

Change-Id: I398c7824d3cfb76002eaed962b9161252a14a529
Closes-Bug: #1540573
This commit is contained in:
Maksim Malchuk 2016-02-02 03:18:43 +03:00
parent 6e8ba8dabf
commit 4157206f3e
4 changed files with 34 additions and 90 deletions

View File

@ -155,11 +155,12 @@ bundle install
bundle exec rake spec_clean
```
Once you have downloaded the dependencies, you can also just work within a
particular module using the usual rake spec commands if you only want to run a
single module's unit tests. The upstream module dependencies are not included
in the unit tests run by this command. They are excluded by having their name
in the utils/jenkins/modules.disable_rspec file.
Once you have downloaded the dependencies, you can also just work with a
particular module using the usual 'rake spec' commands if you only want to run
a single module's unit tests. The upstream modules defined in the fuel-library
Puppetfile are automatically excluded from rspec unit tests. To prevent non-
upstream modules that live in fuel-library from being included in unit tests,
add the name of the module to the utils/jenkins/modules.disable_rspec file.
### Module Syntax Tests
-----------------------
@ -194,7 +195,8 @@ bundle exec rake lint_all
This will run puppet-lint against all of the modules within fuel-library but
will skip checking the upstream module dependencies. The upstream module
dependencies are skipped by adding their name to the
dependencies are skipped by having their name in the deployment/Puppetfile
file, but also, additional modules could be defined in the
util/jenkins/modules.disable_rake-lint file.
## Building docs

View File

@ -64,14 +64,35 @@ namespace :common do
# desc "Task to load list of modules to skip"
task :load_skip_file, :skip_file do |t, args|
$skip_module_list = []
def mod(name, options = {})
@modules ||= {}
module_name = name.split('/', 2).last
@modules[module_name] = options
end
module_list = []
library_dir = Dir.pwd
puppetfile = "#{library_dir}/deployment/Puppetfile"
if File.exists?(puppetfile)
eval(File.read(puppetfile))
@modules.each { |module_name|
module_list << module_name[0]
}
end
# TODO(aschultz): Fix all modules so they have tests and we no longer need
# this file to exclude bad module tests
if not args[:skip_file].nil? and File.exists?(args[:skip_file])
File.open(args[:skip_file], 'r').each_line { |line|
$skip_module_list << line.chomp
next if line =~ /^\s*#/
module_list << line.chomp
}
end
$skip_module_list = module_list.uniq
end
# desc "Task to generate a list of modules with Git changes"

View File

@ -1,38 +1,3 @@
# List of modules with disabled 'rake lint' check.
# Such modules will be checked with 'puppet-lint' command.
apache
apt
ceilometer
cinder
concat
datacat
filemapper
firewall
glance
heat
horizon
inifile
ironic
keystone
mcollective
memcached
mongodb
monit
murano
neutron
nova
ntp
openssl
openstacklib
postgresql
rabbitmq
rsync
sahara
ssh
staging
stdlib
swift
sysctl
tftp
vcsrepo
xinetd
# No need to include here modules defined in the fuel-library Puppetfile.

View File

@ -1,54 +1,10 @@
anacron
apache
apt
ceilometer
cinder
common
concat
datacat
# List of modules with disabled 'rake spec' check.
# No need to include here modules defined in the fuel-library Puppetfile.
docker
erlang
filemapper
firewall
glance
heat
heat_ha
horizon
inifile
ironic
keystone
mcollective
mellanox_openstack
memcached
mongodb
monit
murano
mysql
neutron
nova
ntp
openssl
openstacklib
operatingsystem
pacemaker
pacemaker_wrappers
package
postgresql
puppet
puppet-network
puppetmaster
qpid
rabbitmq
rpmcache
rsync
rsyslog
sahara
ssh
staging
stdlib
swift
sysctl
tftp
vcsrepo
vmware
xinetd