Add json syntax checking to repo tests
In order to catch typos in data_bags, environments and roles that might not be used during the CI integration test, run them all at least thru a quick syntax validation check. Change-Id: I53613351d5956df466026688d684c56fe5322021
This commit is contained in:
parent
fabdf3bc8e
commit
4c8877dffe
13
Rakefile
13
Rakefile
|
@ -1,7 +1,7 @@
|
|||
task default: ["test"]
|
||||
|
||||
desc "Default gate tests to run"
|
||||
task :test => [:rubocop, :berks_vendor]
|
||||
task :test => [:rubocop, :berks_vendor, :json_check]
|
||||
|
||||
def run_command(command)
|
||||
if File.exist?('Gemfile.lock')
|
||||
|
@ -62,6 +62,17 @@ require 'rubocop/rake_task'
|
|||
desc 'Run RuboCop'
|
||||
RuboCop::RakeTask.new(:rubocop)
|
||||
|
||||
desc "Validate data bags, environments and roles"
|
||||
task :json_check do
|
||||
require 'json'
|
||||
['data_bags/*', 'environments', 'roles'].each do |sub_dir|
|
||||
Dir.glob(sub_dir + '/*.json') do |env_file|
|
||||
puts "Checking #{env_file}"
|
||||
JSON.parse(File.read(env_file))
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# Helper for running various testing commands
|
||||
def _run_commands(desc, commands, openstack=true)
|
||||
puts "## Running #{desc}"
|
||||
|
|
Loading…
Reference in New Issue